Skip to content

Project architectureΒ€

This document describes how the project is architectured, both regarding boilerplate and actual code. We start by giving an overview of the project's contents:

πŸ“ .git/
πŸ“ .github/ # (1)!
πŸ“ .venv/ # (2)!
πŸ“ .venvs/ # (3)!
πŸ“ .vscode/ # (4)!
πŸ“ config/ # (5)!
πŸ“ docs/ # (6)!
πŸ“ htmlcov/ # (7)!
πŸ“ scripts/ # (8)!
πŸ“ site/ # (9)!
πŸ“ src/ # (10)!
πŸ“ tests/ # (11)!
 .copier-answers.yml # (12)!
 .envrc # (13)!
 .gitignore
 CHANGELOG.md
 CODE_OF_CONDUCT.md
 CONTRIBUTING.md
 LICENSE
 Makefile # (14)!
 README.md
 duties.py # (15)!
 logo.svg
 mkdocs.yml # (16)!
 pyproject.toml # (17)!
 uv.lock
  1. GitHub workflows, issue templates and other configuration.

    πŸ“ ISSUE_TEMPLATE/ # (1)!
    πŸ“ workflows/ # (2)!
     FUNDING.yml
    
    1.  1-bug.md
       2-feature.md
       3-docs.md
       4-change.md
       config.yml
      
    2.  ci.yml
       release.yml
      
  2. The default virtual environment (git-ignored). See make setup command.

  3. The virtual environments for all supported Python versions (git-ignored). See make setup command.

  4. The configuration for VSCode (git-ignored). See make vscode command.

     launch.json
     settings.json
     tasks.json
    
  5. Contains our tooling configuration. See Scripts, configuration.

    πŸ“ vscode/ # (1)!
     coverage.ini
     git-changelog.toml
     mypy.ini
     pytest.ini
     ruff.toml
    
    1.  launch.json
       settings.json
       tasks.json
      
  6. Documentation sources (Markdown pages). See make docs task.

    πŸ“ .overrides/ # (1)!
    πŸ“ css/ # (2)!
    πŸ“ extensions/ # (3)!
    πŸ“ guide/ # (4)!
    πŸ“ img/ # (5)!
    πŸ“ insiders/ # (6)!
    πŸ“ js/ # (7)!
    πŸ“ reference/ # (8)!
     alternatives.md
     changelog.md
     code-of-conduct.md
     community.md
     contributing.md
     credits.md
     downstream-projects.md
     extensions.md
     getting-help.md
     getting-started.md
     guide.md
     index.md
     installation.md
     introduction.md
     license.md
     logo.svg
     playground.md
     reference.md
     schema-docstrings-options.json
     schema.json
    
    1. Customization of Material for MkDocs' templates.

      πŸ“ partials/ # (1)!
       main.html
      
      1.  comments.html
         path-item.html
        
    2.  custom.css
       insiders.css
       material.css
       mkdocstrings.css
      
    3. πŸ“ built-in/ # (1)!
      πŸ“ official/ # (2)!
      πŸ“ third-party/ # (3)!
       built-in.md
       official.md
       third-party.md
      
      1.  dataclasses.md
        
      2.  autodocstringstyle.md
         inherited-docstrings.md
         public-redundant-aliases.md
         public-wildcard-imports.md
         pydantic.md
         runtime-objects.md
         sphinx.md
         typingdoc.md
         warnings-deprecated.md
        
      3.  docstring-inheritance.md
         fieldz.md
         generics.md
         inherited-method-crossrefs.md
         modernized-annotations.md
        
    4. πŸ“ contributors/ # (1)!
      πŸ“ users/ # (2)!
       contributors.md
       users.md
      
      1.  architecture.md
         commands.md
         setup.md
         workflow.md
        
      2. πŸ“ how-to/ # (1)!
        πŸ“ recommendations/ # (2)!
         checking.md
         extending.md
         loading.md
         navigating.md
         serializing.md
        
        1.  parse-docstrings.md
           selectively-inspect.md
           support-decorators.md
          
        2.  docstrings.md
           public-apis.md
           python-code.md
          
    5.  favicon.ico
       gha_annotations_1.png
       gha_annotations_2.png
      
    6.  changelog.md
       goals.yml
       index.md
       installation.md
      
    7.  feedback.js
       insiders.js
      
    8. πŸ“ api/ # (1)!
       api.md
       cli.md
       docstrings.md
      
      1. Python API reference, injected with mkdocstrings.

        πŸ“ docstrings/ # (1)!
        πŸ“ models/ # (2)!
         agents.md
         checks.md
         cli.md
         docstrings.md
         exceptions.md
         expressions.md
         extensions.md
         finder.md
         git.md
         helpers.md
         loaders.md
         loggers.md
         models.md
         serializers.md
        
        1.  models.md
           parsers.md
          
        2.  alias.md
           attribute.md
           class.md
           function.md
           module.md
          
  7. HTML report for Python code coverage (git-ignored), integrated in the Coverage report page. See make coverage task.

  8. Our different scripts. See Scripts, configuration.

     gen_credits.py
     gen_griffe_json.py
     gen_structure_docs.py
     insiders.py
     make
     make.py
    
  9. Documentation site, built with make run mkdocs build (git-ignored).

  10. The source of our Python package(s). See Sources and Program structure.

    πŸ“ _griffe/ # (1)!
    πŸ“ griffe/ # (2)!
    
    1. Our internal API, hidden from users. See Program structure.

      πŸ“ agents/ # (1)!
      πŸ“ docstrings/ # (2)!
      πŸ“ extensions/ # (3)!
       __init__.py
       c3linear.py
       cli.py
       collections.py
       debug.py
       diff.py
       encoders.py
       enumerations.py
       exceptions.py
       expressions.py
       finder.py
       git.py
       importer.py
       loader.py
       logger.py
       merger.py
       mixins.py
       models.py
       py.typed
       stats.py
       tests.py
      
      1. πŸ“ nodes/ # (1)!
         __init__.py
         inspector.py
         visitor.py
        
        1.  __init__.py
           assignments.py
           ast.py
           docstrings.py
           exports.py
           imports.py
           parameters.py
           runtime.py
           values.py
          
      2.  __init__.py
         google.py
         models.py
         numpy.py
         parsers.py
         sphinx.py
         utils.py
        
      3.  __init__.py
         base.py
         dataclasses.py
        
    2. Our public API, exposed to users. See Program structure.

       __init__.py
       __main__.py
       py.typed
      
  11. Our test suite. See Tests.

    πŸ“ fixtures/
    πŸ“ test_docstrings/ # (1)!
     __init__.py
     conftest.py
     helpers.py
     test_cli.py
     test_diff.py
     test_encoders.py
     test_expressions.py
     test_extensions.py
     test_finder.py
     test_functions.py
     test_git.py
     test_inheritance.py
     test_inspector.py
     test_internals.py
     test_loader.py
     test_merger.py
     test_mixins.py
     test_models.py
     test_nodes.py
     test_public_api.py
     test_stdlib.py
     test_visitor.py
    
    1.  __init__.py
       conftest.py
       helpers.py
       test_google.py
       test_numpy.py
       test_sphinx.py
       test_warnings.py
      
  12. The answers file generated by Copier. See Boilerplate.

  13. The environment configuration, automatically sourced by direnv. See commands.

  14. A dummy makefile, only there for auto-completion. See commands.

  15. Our project tasks, written with duty. See Tasks.

  16. The build configuration for our docs. See make docs task.

  17. The project metadata and production dependencies.

BoilerplateΒ€

This project's skeleton (the file-tree shown above) is actually generated from a Copier template called copier-uv. When generating the project, Copier asks a series of questions (configured by the template itself), and the answers are used to render the file and directory names, as well as the file contents. Copier also records answers in the .copier-answers.yml file, allowing to update the project with latest changes from the template while reusing previous answers.

To update the project (in order to apply latest changes from the template), we use the following command:

copier update --trust --skip-answered

Scripts, configurationΒ€

We have a few scripts that let us manage the various maintenance aspects for this project. The entry-point is the make script located in the scripts folder. It doesn't need any dependency to be installed to run. See Management commands for more information.

The make script can also invoke what we call "tasks". Tasks need our development dependencies to be installed to run. These tasks are written in the duties.py file, and the development dependencies are listed in devdeps.txt.

The tools used in tasks have their configuration files stored in the config folder, to unclutter the root of the repository. The tasks take care of calling the tools with the right options to locate their respective configuration files.

SourcesΒ€

Sources are located in the src folder, following the src-layout. We use PDM-Backend to build source and wheel distributions, and configure it in pyproject.toml to search for packages in the src folder.

TestsΒ€

Our test suite is located in the tests folder. It is located outside of the sources as to not pollute distributions (it would be very wrong to publish a tests package as part of our distributions, since this name is extremely common), or worse, the public API. The tests folder is however included in our source distributions (.tar.gz), alongside most of our metadata and configuration files. Check out pyproject.toml to get the full list of files included in our source distributions.

The test suite is based on pytest. Test modules reflect our internal API structure, and except for a few test modules that test specific aspects of our API, each test module tests the logic from the corresponding module in the internal API. For example, test_finder.py tests code of the _griffe.finder internal module, while test_functions tests our ability to extract correct information from function signatures, statically. The general rule of thumb when writing new tests is to mirror the internal API. If a test touches to many aspects of the loading process, it can be added to the test_loader test module.

Program structureΒ€

Griffe is composed of two packages:

  • _griffe, which is our internal API, hidden from users
  • griffe, which is our public API, exposed to users

When installing the griffe distribution from PyPI.org (or any other index where it is published), both the _griffe and griffe packages are installed. Users then import griffe directly, or import objects from it. The top-level griffe/__init__.py module exposes all the public API, by importing the internal objects from various submodules of _griffe.

We'll be honest: our code organization is not the most elegant, but it works 🀷 Have a look at the following module dependency graph, which will basically tell you nothing except that we have a lot of inter-module dependencies. Arrows read as "imports from". The code base is generally pleasant to work with though.

G_griffe_griffe_griffe_agents_griffe.agents_griffe_agents_inspector_griffe.agents.inspector_griffe_agents_nodes_griffe.agents.nodes_griffe_agents_inspector->_griffe_agents_nodes_griffe_agents_nodes_runtime_griffe.agents.nodes.runtime_griffe_agents_inspector->_griffe_agents_nodes_runtime_griffe_collections_griffe.collections_griffe_agents_inspector->_griffe_collections_griffe_enumerations_griffe.enumerations_griffe_agents_inspector->_griffe_enumerations_griffe_expressions_griffe.expressions_griffe_agents_inspector->_griffe_expressions_griffe_extensions_griffe.extensions_griffe_agents_inspector->_griffe_extensions_griffe_extensions_base_griffe.extensions.base_griffe_agents_inspector->_griffe_extensions_base_griffe_importer_griffe.importer_griffe_agents_inspector->_griffe_importer_griffe_logger_griffe.logger_griffe_agents_inspector->_griffe_logger_griffe_models_griffe.models_griffe_agents_inspector->_griffe_models_griffe_agents_nodes_assignments_griffe.agents.nodes.assignments_griffe_agents_nodes_ast_griffe.agents.nodes.ast_griffe_exceptions_griffe.exceptions_griffe_agents_nodes_ast->_griffe_exceptions_griffe_agents_nodes_docstrings_griffe.agents.nodes.docstrings_griffe_agents_nodes_exports_griffe.agents.nodes.exports_griffe_agents_nodes_values_griffe.agents.nodes.values_griffe_agents_nodes_exports->_griffe_agents_nodes_values_griffe_agents_nodes_exports->_griffe_enumerations_griffe_agents_nodes_exports->_griffe_expressions_griffe_agents_nodes_exports->_griffe_logger_griffe_agents_nodes_exports->_griffe_models_griffe_agents_nodes_imports_griffe.agents.nodes.imports_griffe_agents_nodes_imports->_griffe_models_griffe_agents_nodes_parameters_griffe.agents.nodes.parameters_griffe_agents_nodes_parameters->_griffe_enumerations_griffe_agents_nodes_runtime->_griffe_enumerations_griffe_agents_nodes_runtime->_griffe_logger_griffe_agents_nodes_values->_griffe_logger_griffe_agents_visitor_griffe.agents.visitor_griffe_agents_visitor->_griffe_agents_nodes_griffe_agents_visitor->_griffe_agents_nodes_assignments_griffe_agents_visitor->_griffe_agents_nodes_ast_griffe_agents_visitor->_griffe_agents_nodes_docstrings_griffe_agents_visitor->_griffe_agents_nodes_exports_griffe_agents_visitor->_griffe_agents_nodes_imports_griffe_agents_visitor->_griffe_agents_nodes_parameters_griffe_agents_visitor->_griffe_collections_griffe_agents_visitor->_griffe_enumerations_griffe_agents_visitor->_griffe_exceptions_griffe_agents_visitor->_griffe_expressions_griffe_agents_visitor->_griffe_extensions_griffe_agents_visitor->_griffe_models_griffe_c3linear_griffe.c3linear_griffe_cli_griffe.cli_griffe_diff_griffe.diff_griffe_cli->_griffe_diff_griffe_encoders_griffe.encoders_griffe_cli->_griffe_encoders_griffe_cli->_griffe_enumerations_griffe_cli->_griffe_exceptions_griffe_cli->_griffe_extensions_griffe_cli->_griffe_extensions_base_griffe_git_griffe.git_griffe_cli->_griffe_git_griffe_loader_griffe.loader_griffe_cli->_griffe_loader_griffe_cli->_griffe_logger_griffe_mixins_griffe.mixins_griffe_collections->_griffe_mixins_griffe_collections->_griffe_models_griffe_diff->_griffe_enumerations_griffe_diff->_griffe_exceptions_griffe_diff->_griffe_git_griffe_diff->_griffe_logger_griffe_diff->_griffe_models_griffe_docstrings_griffe.docstrings_griffe_docstrings_google_griffe.docstrings.google_griffe_docstrings_models_griffe.docstrings.models_griffe_docstrings_google->_griffe_docstrings_models_griffe_docstrings_utils_griffe.docstrings.utils_griffe_docstrings_google->_griffe_docstrings_utils_griffe_docstrings_google->_griffe_enumerations_griffe_docstrings_google->_griffe_expressions_griffe_docstrings_google->_griffe_models_griffe_docstrings_models->_griffe_enumerations_griffe_docstrings_models->_griffe_expressions_griffe_docstrings_numpy_griffe.docstrings.numpy_griffe_docstrings_numpy->_griffe_docstrings_models_griffe_docstrings_numpy->_griffe_docstrings_utils_griffe_docstrings_numpy->_griffe_enumerations_griffe_docstrings_numpy->_griffe_expressions_griffe_docstrings_numpy->_griffe_models_griffe_docstrings_parsers_griffe.docstrings.parsers_griffe_docstrings_parsers->_griffe_docstrings_google_griffe_docstrings_parsers->_griffe_docstrings_models_griffe_docstrings_parsers->_griffe_docstrings_numpy_griffe_docstrings_sphinx_griffe.docstrings.sphinx_griffe_docstrings_parsers->_griffe_docstrings_sphinx_griffe_docstrings_parsers->_griffe_enumerations_griffe_docstrings_sphinx->_griffe_docstrings_models_griffe_docstrings_sphinx->_griffe_docstrings_utils_griffe_docstrings_sphinx->_griffe_expressions_griffe_docstrings_sphinx->_griffe_models_griffe_docstrings_utils->_griffe_enumerations_griffe_docstrings_utils->_griffe_exceptions_griffe_docstrings_utils->_griffe_expressions_griffe_docstrings_utils->_griffe_logger_griffe_docstrings_utils->_griffe_models_griffe_encoders->_griffe_enumerations_griffe_encoders->_griffe_expressions_griffe_encoders->_griffe_models_griffe_exceptions->_griffe_models_griffe_expressions->_griffe_agents_griffe_expressions->_griffe_agents_nodes_griffe_expressions->_griffe_agents_nodes_parameters_griffe_expressions->_griffe_enumerations_griffe_expressions->_griffe_exceptions_griffe_expressions->_griffe_logger_griffe_expressions->_griffe_models_griffe_extensions_base->_griffe_agents_griffe_extensions_base->_griffe_agents_nodes_griffe_extensions_base->_griffe_agents_nodes_ast_griffe_extensions_base->_griffe_agents_nodes_runtime_griffe_extensions_base->_griffe_agents_visitor_griffe_extensions_base->_griffe_exceptions_griffe_extensions_dataclasses_griffe.extensions.dataclasses_griffe_extensions_base->_griffe_extensions_dataclasses_griffe_extensions_base->_griffe_importer_griffe_extensions_base->_griffe_loader_griffe_extensions_base->_griffe_models_griffe_extensions_dataclasses->_griffe_enumerations_griffe_extensions_dataclasses->_griffe_expressions_griffe_extensions_dataclasses->_griffe_logger_griffe_extensions_dataclasses->_griffe_models_griffe_finder_griffe.finder_griffe_finder->_griffe_exceptions_griffe_finder->_griffe_logger_griffe_finder->_griffe_models_griffe_git->_griffe_exceptions_griffe_loader->_griffe_agents_griffe_loader->_griffe_agents_inspector_griffe_loader->_griffe_agents_visitor_griffe_loader->_griffe_collections_griffe_loader->_griffe_enumerations_griffe_loader->_griffe_exceptions_griffe_loader->_griffe_expressions_griffe_loader->_griffe_extensions_griffe_loader->_griffe_finder_griffe_loader->_griffe_git_griffe_loader->_griffe_importer_griffe_loader->_griffe_logger_griffe_merger_griffe.merger_griffe_loader->_griffe_merger_griffe_loader->_griffe_models_griffe_stats_griffe.stats_griffe_loader->_griffe_stats_griffe_merger->_griffe_exceptions_griffe_merger->_griffe_logger_griffe_merger->_griffe_models_griffe_mixins->_griffe_encoders_griffe_mixins->_griffe_enumerations_griffe_mixins->_griffe_exceptions_griffe_mixins->_griffe_merger_griffe_mixins->_griffe_models_griffe_models->_griffe_c3linear_griffe_models->_griffe_docstrings_griffe_models->_griffe_docstrings_models_griffe_models->_griffe_docstrings_parsers_griffe_models->_griffe_enumerations_griffe_models->_griffe_logger_griffe_stats->_griffe_enumerations_griffe_stats->_griffe_models_griffe_tests_griffe.tests_griffe_tests->_griffe_agents_griffe_tests->_griffe_agents_inspector_griffe_tests->_griffe_agents_visitor_griffe_tests->_griffe_collections_griffe_tests->_griffe_enumerations_griffe_tests->_griffe_extensions_griffe_tests->_griffe_extensions_base_griffe_tests->_griffe_loader_griffe_tests->_griffe_modelsgriffegriffegriffe->_griffegriffe->_griffe_agentsgriffe->_griffe_agents_inspectorgriffe->_griffe_agents_nodesgriffe->_griffe_agents_nodes_assignmentsgriffe->_griffe_agents_nodes_astgriffe->_griffe_agents_nodes_docstringsgriffe->_griffe_agents_nodes_exportsgriffe->_griffe_agents_nodes_importsgriffe->_griffe_agents_nodes_parametersgriffe->_griffe_agents_nodes_runtimegriffe->_griffe_agents_nodes_valuesgriffe->_griffe_agents_visitorgriffe->_griffe_c3lineargriffe->_griffe_cligriffe->_griffe_collectionsgriffe->_griffe_diffgriffe->_griffe_docstringsgriffe->_griffe_docstrings_googlegriffe->_griffe_docstrings_modelsgriffe->_griffe_docstrings_numpygriffe->_griffe_docstrings_parsersgriffe->_griffe_docstrings_sphinxgriffe->_griffe_docstrings_utilsgriffe->_griffe_encodersgriffe->_griffe_enumerationsgriffe->_griffe_exceptionsgriffe->_griffe_expressionsgriffe->_griffe_extensionsgriffe->_griffe_extensions_basegriffe->_griffe_extensions_dataclassesgriffe->_griffe_findergriffe->_griffe_gitgriffe->_griffe_importergriffe->_griffe_loadergriffe->_griffe_loggergriffe->_griffe_mergergriffe->_griffe_mixinsgriffe->_griffe_modelsgriffe->_griffe_statsgriffe->_griffe_testsgriffe___main__griffe.__main__griffe___main__->_griffegriffe___main__->_griffe_cli

You can zoom and pan all diagrams on this page with mouse inputs.

The following sections are generated automatically by iterating on the modules of our public and internal APIs respectively, and extracting the comment blocks at the top of each module. The comment blocks are addressed to readers of the code (maintainers, contributors), while module docstrings are addressed to users of the API. Module docstrings in our internal API are never written, because our module layout is hidden, and therefore modules aren't part of the public API, so it doesn't make much sense to write "user documentation" in them.

CLI entrypointΒ€

griffe.__main__Β€

Entry-point module, in case you use python -m griffe.

Why does this file exist, and why __main__? For more info, read:

Public APIΒ€

griffeΒ€

This top-level module imports all public names from the package, and exposes them as public objects. We have tests to make sure no object is forgotten in this list.

Internal APIΒ€

The internal API layout doesn't follow any particular paradigm: we simply organize code in different modules, depending on what the code is used for.

agentsΒ€

These modules contain the different agents that are able to extract data.

inspector.pyΒ€

This module contains our dynamic analysis agent, capable of inspecting modules and objects in memory, at runtime.

G cluster_f2ae8593 File: inspector cluster_11d56cac Class: Inspector node_089a24f7 100: __init__() node_089a24f7->node_089a24f7 node_5e3bd95f 152: _get_docstring() node_af463a43 174: _get_linenos() node_44dab180 240: generic_inspect() node_44dab180->node_089a24f7 node_e72f3d16 232: inspect() node_44dab180->node_e72f3d16 node_d711f250 277: inspect_module() node_44dab180->node_d711f250 node_a1885574 184: get_module() node_a1885574->node_e72f3d16 node_2191280b 477: handle_attribute() node_2191280b->node_5e3bd95f node_d8c8846e 411: handle_function() node_d8c8846e->node_5e3bd95f node_d8c8846e->node_af463a43 node_e67a6c11 550: _convert_object_to_annotation() node_d8c8846e->node_e67a6c11 node_ea4442a9 534: _convert_parameter() node_d8c8846e->node_ea4442a9 node_e9fad8da 469: inspect_attribute() node_e9fad8da->node_2191280b node_4d67b3a0 379: inspect_builtin_function() node_4d67b3a0->node_d8c8846e node_64e0d927 355: inspect_builtin_method() node_64e0d927->node_d8c8846e node_e7c1a257 395: inspect_cached_property() node_e7c1a257->node_d8c8846e node_8e4ac52a 299: inspect_class() node_8e4ac52a->node_5e3bd95f node_8e4ac52a->node_af463a43 node_8e4ac52a->node_44dab180 node_f9d565b7 339: inspect_classmethod() node_f9d565b7->node_d8c8846e node_821d57d8 371: inspect_coroutine() node_821d57d8->node_d8c8846e node_7f8c11ff 387: inspect_function() node_7f8c11ff->node_d8c8846e node_c37773d9 363: inspect_method() node_c37773d9->node_d8c8846e node_60e1735b 347: inspect_method_descriptor() node_60e1735b->node_d8c8846e node_d711f250->node_5e3bd95f node_ccd7f86d 403: inspect_property() node_ccd7f86d->node_d8c8846e node_2324a961 331: inspect_staticmethod() node_2324a961->node_d8c8846e node_ea4442a9->node_e67a6c11 node_cd96c0a6 32: inspect() node_cd96c0a6->node_089a24f7 node_cd96c0a6->node_a1885574
nodesΒ€

These submodules contain utilities for working with AST and object nodes.

assignments.pyΒ€

This module contains utilities for extracting information from assignment nodes.

G cluster_b42bf277 File: assignments node_fef7f260 40: _get_annassign_names() node_261172c8 23: get_name() node_fef7f260->node_261172c8 node_705a08eb 35: _get_assign_names() node_705a08eb->node_261172c8 node_35c10305 9: _get_attribute_name() node_35c10305->node_261172c8 node_5db6042d 63: get_instance_names() node_ea5578df 51: get_names() node_5db6042d->node_ea5578df
ast.pyΒ€

This module contains utilities for navigating AST nodes.

G cluster_ea4853fd File: ast node_647bd545 26: ast_children() node_9a8582be 137: ast_first_child() node_9a8582be->node_647bd545 node_52d73102 155: ast_last_child() node_52d73102->node_647bd545 node_1fa404bc 119: ast_next() node_cbe0fedd 66: ast_next_siblings() node_1fa404bc->node_cbe0fedd node_cbe0fedd->node_647bd545 node_96c0de6f 100: ast_previous() node_1f4389b6 50: ast_previous_siblings() node_96c0de6f->node_1f4389b6 node_1f4389b6->node_647bd545 node_32bfee2d 82: ast_siblings() node_32bfee2d->node_647bd545
docstrings.pyΒ€

This module contains utilities for extracting docstrings from nodes.

exports.pyΒ€

This module contains utilities for extracting exports from __all__ assignments.

G cluster_9264c825 File: exports node_2f8cbce5 74: _extract() node_8a240bdf 33: _extract_attribute() node_8a240bdf->node_2f8cbce5 node_09e97fc6 37: _extract_binop() node_09e97fc6->node_2f8cbce5 node_04dc194d 51: _extract_sequence() node_04dc194d->node_2f8cbce5 node_6b1b1658 58: _extract_starred() node_6b1b1658->node_2f8cbce5 node_e7b88151 78: get__all__() node_e7b88151->node_2f8cbce5 node_e25c1ad6 93: safe_get__all__() node_e25c1ad6->node_e7b88151
imports.pyΒ€

This module contains utilities for working with imports and relative imports.

parameters.pyΒ€

This module contains utilities for extracting information from parameter nodes.

runtime.pyΒ€

This module contains utilities for extracting information from runtime objects.

G cluster_710413a7 File: runtime cluster_7dd6ac5b Class: ObjectNode node_546ecbff 40: __init__() node_7e199115 230: _pick_member() node_c2ac7db9 240: alias_target_path() node_08e1052d 24: _same_components() node_c2ac7db9->node_08e1052d node_b3be1e3b 138: children() node_b3be1e3b->node_546ecbff node_b3be1e3b->node_7e199115
values.pyΒ€

This module contains utilities for extracting attribute values.

G cluster_f1c577a2 File: values node_e5f3ea74 15: get_value() node_b4f4ad2a 29: safe_get_value() node_b4f4ad2a->node_e5f3ea74
visitor.pyΒ€

This module contains our static analysis agent, capable of parsing and visiting sources, statically.

G cluster_25d3191e File: visitor cluster_adf78777 Class: Visitor node_b2e23542 121: __init__() node_b2e23542->node_b2e23542 node_73611dd5 181: _get_docstring() node_db26bce1 292: decorators_to_labels() node_68db1352 215: generic_visit() node_2b8b11fa 207: visit() node_68db1352->node_2b8b11fa node_161022d3 310: get_base_property() node_46681c9c 193: get_module() node_46681c9c->node_2b8b11fa node_c1ff70fe 508: handle_attribute() node_c1ff70fe->node_73611dd5 node_8e73cb27 334: handle_function() node_8e73cb27->node_73611dd5 node_8e73cb27->node_db26bce1 node_8e73cb27->node_68db1352 node_8e73cb27->node_161022d3 node_4a4b0f5b 619: visit_annassign() node_4a4b0f5b->node_c1ff70fe node_289a1710 611: visit_assign() node_289a1710->node_c1ff70fe node_9df0b702 445: visit_asyncfunctiondef() node_9df0b702->node_8e73cb27 node_7249b6d3 246: visit_classdef() node_7249b6d3->node_73611dd5 node_7249b6d3->node_db26bce1 node_7249b6d3->node_68db1352 node_0eddf457 437: visit_functiondef() node_0eddf457->node_8e73cb27 node_71d76007 648: visit_if() node_71d76007->node_68db1352 node_772a47ac 224: visit_module() node_772a47ac->node_73611dd5 node_772a47ac->node_68db1352 node_9083ab3b 64: visit() node_9083ab3b->node_b2e23542 node_9083ab3b->node_46681c9c

c3linear.pyΒ€

This module contains a single function, c3linear_merge. The function is generic enough to be in its own module.

G cluster_46d0cad5 File: c3linear cluster_523d3d52 Class: _Dependency cluster_09d3e622 Class: _DependencyList node_fde06d4f 29: tail() node_6c8e3b4b 60: __len__() node_fde06d4f->node_6c8e3b4b node_66ffb9dd 48: __init__() node_6187f599 64: __repr__() node_6187f599->node_6187f599 node_51453f34 82: remove() node_6e154abf 93: c3linear_merge() node_6e154abf->node_66ffb9dd node_6e154abf->node_51453f34

cli.pyΒ€

This module contains all CLI-related things. Why does this file exist, and why not put this in __main__?

We might be tempted to import things from __main__ later, but that will cause problems; the code will get executed twice:

  • When we run python -m griffe, Python will execute __main__.py as a script. That means there won't be any griffe.__main__ in sys.modules.
  • When you import __main__ it will get executed again (as a module) because there's no griffe.__main__ in sys.modules.
G cluster_74f2fc8c File: cli cluster_a5ca9061 Class: _DebugInfo node_fba18316 51: __init__() node_fba18316->node_fba18316 node_b0a07217 69: _load_packages() node_f8d71121 59: _print_data() node_819be35c 331: dump() node_819be35c->node_b0a07217 node_819be35c->node_f8d71121 node_2447f3c9 130: get_parser() node_52a9a063 564: main() node_52a9a063->node_2447f3c9

collections.pyΒ€

This module contains collection-related classes, which are used throughout the API.

G cluster_9cf62953 File: collections cluster_ac45cdae Class: LinesCollection node_9aab09df 56: items() node_9aab09df->node_9aab09df node_cba535ba 40: keys() node_cba535ba->node_cba535ba node_6f7a6361 48: values() node_6f7a6361->node_6f7a6361

debug.pyΒ€

This module is here to help users report bugs. It provides a function to print environment information, which is called from the public griffe.debug module (when called with python -m griffe.debug) or thanks to the --debug-info CLI flag.

G cluster_d5607cec File: debug node_d64d045e 80: _get_debug_info() node_9390ebe3 65: _get_version() node_d64d045e->node_9390ebe3 node_92f8c21b 54: _interpreter_name_version() node_d64d045e->node_92f8c21b node_d4ef4d5b 99: _print_debug_info() node_d4ef4d5b->node_d64d045e

diff.pyΒ€

This module exports "breaking changes" related utilities. The logic here is to iterate on objects and their members recursively, to yield found breaking changes.

The breakage class definitions might sound a bit verbose, but declaring them this way helps with (de)serialization, which we don't use yet, but could use in the future.

G cluster_aad52ba0 File: diff cluster_400b6ab2 Class: Breakage node_09962eee 217: _explain_github() node_21bfbe0d 160: _format_new_value() node_09962eee->node_21bfbe0d node_5f9debd5 157: _format_old_value() node_09962eee->node_5f9debd5 node_204640a5 151: _format_title() node_09962eee->node_204640a5 node_1a753bba 197: _explain_markdown() node_1a753bba->node_21bfbe0d node_1a753bba->node_5f9debd5 node_cabdeaf4 163: _explain_oneline() node_38373741 154: _format_kind() node_cabdeaf4->node_38373741 node_d4e6dcbb 148: _format_location() node_cabdeaf4->node_d4e6dcbb node_cabdeaf4->node_21bfbe0d node_cabdeaf4->node_5f9debd5 node_cabdeaf4->node_204640a5 node_30357d6a 179: _explain_verbose() node_30357d6a->node_38373741 node_30357d6a->node_d4e6dcbb node_30357d6a->node_21bfbe0d node_30357d6a->node_5f9debd5 node_30357d6a->node_204640a5 node_79b5bb40 484: _alias_incompatibilities() node_addef497 521: _type_based_yield() node_79b5bb40->node_addef497 node_bf9f1fef 473: _attribute_incompatibilities() node_0c040548 385: _class_incompatibilities() node_da9673d2 500: _member_incompatibilities() node_0c040548->node_da9673d2 node_99172742 398: _function_incompatibilities() node_d3c64599 558: _returns_are_compatible() node_99172742->node_d3c64599 node_da9673d2->node_addef497 node_addef497->node_bf9f1fef node_addef497->node_0c040548 node_addef497->node_99172742 node_e60b7b27 582: find_breaking_changes() node_e60b7b27->node_da9673d2

docstringsΒ€

These submodules define models and parsers for docstrings.

google.pyΒ€

This module defines functions to parse Google-style docstrings into structured data.

G cluster_30d4dca1 File: google node_06e4cde0 487: _annotation_from_parent() node_787d092c 458: _get_name_annotation_description() node_5e5c5297 721: _is_empty_line() node_f39585f6 261: _read_attributes_section() node_652437a8 84: _read_block_items() node_f39585f6->node_652437a8 node_9734e28b 147: _read_block() node_9734e28b->node_5e5c5297 node_652437a8->node_5e5c5297 node_bdeed63f 445: _read_block_items_maybe() node_bdeed63f->node_9734e28b node_bdeed63f->node_652437a8 node_897d9092 332: _read_classes_section() node_897d9092->node_652437a8 node_6a5c8ee4 697: _read_deprecated_section() node_6a5c8ee4->node_9734e28b node_d49ac0c8 638: _read_examples_section() node_d49ac0c8->node_5e5c5297 node_d49ac0c8->node_9734e28b node_e420d098 297: _read_functions_section() node_e420d098->node_652437a8 node_f55ecbd4 367: _read_modules_section() node_f55ecbd4->node_652437a8 node_81cb963f 250: _read_other_parameters_section() node_d2ee7974 178: _read_parameters() node_81cb963f->node_d2ee7974 node_d2ee7974->node_652437a8 node_e0ac6ad3 240: _read_parameters_section() node_e0ac6ad3->node_d2ee7974 node_1e91e3e3 392: _read_raises_section() node_1e91e3e3->node_652437a8 node_bcd3172b 594: _read_receives_section() node_bcd3172b->node_06e4cde0 node_bcd3172b->node_787d092c node_bcd3172b->node_bdeed63f node_98c76f11 506: _read_returns_section() node_98c76f11->node_06e4cde0 node_98c76f11->node_787d092c node_98c76f11->node_bdeed63f node_701d4c37 420: _read_warns_section() node_701d4c37->node_652437a8 node_dd6571dd 550: _read_yields_section() node_dd6571dd->node_06e4cde0 node_dd6571dd->node_787d092c node_dd6571dd->node_bdeed63f node_37c537fe 744: parse_google() node_37c537fe->node_5e5c5297 node_37c537fe->node_9734e28b
models.pyΒ€

This module contains the models for storing docstrings structured data.

G cluster_13018e55 File: models cluster_8499cc4b Class: DocstringSection node_f29fa0c8 202: as_dict() node_f29fa0c8->node_f29fa0c8
numpy.pyΒ€

This module defines functions to parse Numpy-style docstrings into structured data.

Based on https://numpydoc.readthedocs.io/en/latest/format.html, it seems Numpydoc is a superset of RST. Since fully parsing RST is a non-goal of this project, some things are stripped from the Numpydoc specification.

Rejected as non particularly Pythonic or useful as sections:

  • See also: this section feels too subjective (specially crafted as a standard for Numpy itself), and there are may ways to reference related items in a docstring, depending on the chosen markup.

Rejected as naturally handled by the user-chosen markup:

  • Warnings: this is just markup.
  • Notes: again, just markup.
  • References: again, just markup.
G cluster_23f77723 File: numpy node_6f3dbff0 723: _append_section() node_29d3594c 89: _is_dash_line() node_f64f3c1b 85: _is_empty_line() node_29d3594c->node_f64f3c1b node_4be4c932 534: _read_attributes_section() node_5f986961 93: _read_block_items() node_4be4c932->node_5f986961 node_d498fd99 153: _read_block() node_d498fd99->node_29d3594c node_d498fd99->node_f64f3c1b node_5f986961->node_29d3594c node_5f986961->node_f64f3c1b node_2f0ed491 600: _read_classes_section() node_2f0ed491->node_5f986961 node_e1702dff 316: _read_deprecated_section() node_e1702dff->node_5f986961 node_18bc8d1a 660: _read_examples_section() node_18bc8d1a->node_f64f3c1b node_18bc8d1a->node_d498fd99 node_c5b3b472 570: _read_functions_section() node_c5b3b472->node_5f986961 node_df70da5e 630: _read_modules_section() node_df70da5e->node_5f986961 node_f67ef747 300: _read_other_parameters_section() node_1f2dc332 215: _read_parameters() node_f67ef747->node_1f2dc332 node_1f2dc332->node_5f986961 node_6ebf695c 285: _read_parameters_section() node_6ebf695c->node_1f2dc332 node_16bbc7ad 488: _read_raises_section() node_16bbc7ad->node_5f986961 node_2db3295b 444: _read_receives_section() node_2db3295b->node_5f986961 node_446dfd90 340: _read_returns_section() node_446dfd90->node_5f986961 node_c5139b37 511: _read_warns_section() node_c5139b37->node_5f986961 node_7e5b8c03 396: _read_yields_section() node_7e5b8c03->node_5f986961 node_0ece3745 759: parse_numpy() node_0ece3745->node_6f3dbff0 node_0ece3745->node_29d3594c node_0ece3745->node_f64f3c1b
parsers.pyΒ€

This module imports all the defined parsers and provides a generic function to parse docstrings.

G cluster_b35f4822 File: parsers node_fbcc0ae8 106: infer_docstring_style() node_9d5de607 214: parse() node_3af30d2b 168: parse_auto() node_3af30d2b->node_fbcc0ae8 node_3af30d2b->node_9d5de607
sphinx.pyΒ€

This module defines functions to parse Sphinx docstrings into structured data.

G cluster_e72e0671 File: sphinx cluster_6e50949c Class: _FieldType node_0954865d 49: matches() node_e7a4d708 399: _consolidate_continuation_lines() node_b0589007 412: _consolidate_descriptive_type() node_810e3a96 180: _determine_param_annotation() node_123a6631 173: _determine_param_default() node_79e3ffa3 387: _parse_directive() node_79e3ffa3->node_e7a4d708 node_467da58c 371: _parsed_values_to_sections() node_e26e126b 416: _strip_blank_lines() node_467da58c->node_e26e126b node_11ac9fde 239: _read_attribute() node_11ac9fde->node_79e3ffa3 node_711adf22 281: _read_attribute_type() node_711adf22->node_b0589007 node_711adf22->node_79e3ffa3 node_fab932df 308: _read_exception() node_fab932df->node_79e3ffa3 node_a2c28b24 122: _read_parameter() node_a2c28b24->node_810e3a96 node_a2c28b24->node_123a6631 node_a2c28b24->node_79e3ffa3 node_5de3a798 212: _read_parameter_type() node_5de3a798->node_b0589007 node_5de3a798->node_79e3ffa3 node_e834d30f 327: _read_return() node_e834d30f->node_79e3ffa3 node_d3af2e4f 352: _read_return_type() node_d3af2e4f->node_b0589007 node_d3af2e4f->node_79e3ffa3 node_bc2c7415 86: parse_sphinx() node_bc2c7415->node_0954865d node_bc2c7415->node_467da58c
utils.pyΒ€

This module contains utilities for docstrings parsers.

encoders.pyΒ€

This module contains data encoders/serializers and decoders/deserializers. We only support JSON for now, but might want to add more formats in the future.

G cluster_3ef9b237 File: encoders cluster_c6a810d9 Class: JSONEncoder node_81a2490e 48: __init__() node_81a2490e->node_81a2490e node_81062b3b 125: _attach_parent_to_expr() node_e08952b8 135: _attach_parent_to_exprs() node_e08952b8->node_81062b3b node_4d797862 211: _load_attribute() node_63d37b62 85: _load_docstring() node_4d797862->node_63d37b62 node_7772ed3d 174: _load_class() node_7772ed3d->node_e08952b8 node_48a9d14a 91: _load_decorators() node_7772ed3d->node_48a9d14a node_7772ed3d->node_63d37b62 node_87f92d94 95: _load_expression() node_df5b1653 197: _load_function() node_df5b1653->node_48a9d14a node_df5b1653->node_63d37b62 node_c4f433bc 159: _load_module() node_c4f433bc->node_e08952b8 node_c4f433bc->node_63d37b62 node_a847ae48 115: _load_parameter() node_a847ae48->node_63d37b62 node_94d311c1 242: json_decoder() node_94d311c1->node_87f92d94 node_94d311c1->node_a847ae48

enumerations.pyΒ€

This module contains all the enumerations of the package.

exceptions.pyΒ€

This module contains all the exceptions specific to Griffe.

expressions.pyΒ€

This module contains the data classes that represent resolvable names and expressions. First we declare data classes for each kind of expression, mostly corresponding to Python's AST nodes. Then we declare builder methods, that iterate AST nodes and build the corresponding data classes, and two utilities _yield and _join to help iterate on expressions. Finally we declare a few public helpers to safely get expressions from AST nodes in different scenarios.

G cluster_7f18e952 File: expressions cluster_5d498851 Class: Expr cluster_dbddeff9 Class: ExprAttribute cluster_c073fc4d Class: ExprBinOp cluster_cf86fec1 Class: ExprBoolOp cluster_600e0d38 Class: ExprCall cluster_ab88156c Class: ExprCompare cluster_1b8779c8 Class: ExprComprehension cluster_514a2947 Class: ExprDict cluster_c25bd3cf Class: ExprDictComp cluster_440610a7 Class: ExprExtSlice cluster_a125fe7d Class: ExprFormatted cluster_49ad6779 Class: ExprGeneratorExp cluster_a1266681 Class: ExprIfExp cluster_0453c4d9 Class: ExprJoinedStr cluster_011329fe Class: ExprKeyword cluster_6028527d Class: ExprVarPositional cluster_8f326dca Class: ExprVarKeyword cluster_aa8f7d51 Class: ExprLambda cluster_449ba4c4 Class: ExprList cluster_9d5d998d Class: ExprListComp cluster_69dff87d Class: ExprNamedExpr cluster_afd20265 Class: ExprSet cluster_38fe1568 Class: ExprSetComp cluster_d80f5962 Class: ExprSlice cluster_4ee23ee5 Class: ExprSubscript cluster_258a3ea5 Class: ExprTuple cluster_3575a18e Class: ExprUnaryOp cluster_0ca6530c Class: ExprYield cluster_0141cc4d Class: ExprYieldFrom node_03aa83b1 98: __iter__() node_2e17f064 102: iterate() node_03aa83b1->node_2e17f064 node_f58fe04c 95: __str__() node_f58fe04c->node_2e17f064 node_3a50ea33 131: as_dict() node_74684e78 68: _expr_as_dict() node_3a50ea33->node_74684e78 node_b132ec99 200: append() node_b132ec99->node_b132ec99 node_4bd911ec 192: iterate() node_42dee7c3 41: _join() node_4bd911ec->node_42dee7c3 node_5ff16edd 245: iterate() node_d926c701 29: _yield() node_5ff16edd->node_d926c701 node_10b70492 261: iterate() node_10b70492->node_42dee7c3 node_86329e50 280: iterate() node_86329e50->node_42dee7c3 node_86329e50->node_d926c701 node_142312a6 299: iterate() node_142312a6->node_42dee7c3 node_142312a6->node_d926c701 node_03cab25e 319: iterate() node_03cab25e->node_42dee7c3 node_03cab25e->node_d926c701 node_5591346a 353: iterate() node_5591346a->node_42dee7c3 node_d9651d2e 375: iterate() node_d9651d2e->node_42dee7c3 node_d9651d2e->node_d926c701 node_ed0d2673 392: iterate() node_ed0d2673->node_42dee7c3 node_e315ff1d 404: iterate() node_e315ff1d->node_d926c701 node_75563816 420: iterate() node_75563816->node_42dee7c3 node_75563816->node_d926c701 node_badb6d0d 438: iterate() node_badb6d0d->node_d926c701 node_f83c899f 454: iterate() node_f83c899f->node_42dee7c3 node_0e0eed6d 495: iterate() node_0e0eed6d->node_d926c701 node_5693bd27 537: iterate() node_5693bd27->node_d926c701 node_fbfd152e 578: iterate() node_fbfd152e->node_42dee7c3 node_a96cb6f7 594: iterate() node_a96cb6f7->node_42dee7c3 node_a96cb6f7->node_d926c701 node_3f35e953 699: iterate() node_3f35e953->node_d926c701 node_97684aba 730: iterate() node_97684aba->node_42dee7c3 node_4db2451e 746: iterate() node_4db2451e->node_42dee7c3 node_4db2451e->node_d926c701 node_3b97846a 766: iterate() node_3b97846a->node_d926c701 node_c62eb53a 794: _to_binop() node_c62eb53a->node_c62eb53a node_0e6f0757 787: iterate() node_0e6f0757->node_d926c701 node_7a5a044e 809: modernize() node_7a5a044e->node_c62eb53a node_7a5a044e->node_7a5a044e node_0fd74eac 845: iterate() node_0fd74eac->node_42dee7c3 node_93900dad 869: iterate() node_93900dad->node_d926c701 node_f678bef8 522: iterate() node_f678bef8->node_d926c701 node_00fc637f 509: iterate() node_00fc637f->node_d926c701 node_26ed3575 882: iterate() node_26ed3575->node_d926c701 node_c6d5b9c3 897: iterate() node_c6d5b9c3->node_d926c701 node_036c82c0 1226: _build() node_f0bc46b2 944: _build_attribute() node_f0bc46b2->node_b132ec99 node_f0bc46b2->node_036c82c0 node_65eee42f 956: _build_binop() node_65eee42f->node_036c82c0 node_c10a6e7c 964: _build_boolop() node_c10a6e7c->node_036c82c0 node_e2efb754 971: _build_call() node_e2efb754->node_036c82c0 node_01076c26 978: _build_compare() node_01076c26->node_036c82c0 node_cd5fb70d 986: _build_comprehension() node_cd5fb70d->node_036c82c0 node_660e3958 995: _build_constant() node_660e3958->node_036c82c0 node_f2e1ec2c 1034: _build_dict() node_f2e1ec2c->node_036c82c0 node_0cafa730 1041: _build_dictcomp() node_0cafa730->node_036c82c0 node_4ee9c3ae 1049: _build_formatted() node_4ee9c3ae->node_036c82c0 node_2ebc8773 1059: _build_generatorexp() node_2ebc8773->node_036c82c0 node_230992d3 1066: _build_ifexp() node_230992d3->node_036c82c0 node_03949e06 1074: _build_joinedstr() node_03949e06->node_036c82c0 node_e64f8f84 1084: _build_keyword() node_e64f8f84->node_036c82c0 node_012b3514 1090: _build_lambda() node_012b3514->node_036c82c0 node_99fa7e31 1258: safe_get_expression() node_012b3514->node_99fa7e31 node_fe34b1b1 1107: _build_list() node_fe34b1b1->node_036c82c0 node_7d26ce7d 1111: _build_listcomp() node_7d26ce7d->node_036c82c0 node_8b1b3d2b 1119: _build_named_expr() node_8b1b3d2b->node_036c82c0 node_6620dd2d 1123: _build_set() node_6620dd2d->node_036c82c0 node_41583163 1127: _build_setcomp() node_41583163->node_036c82c0 node_7f989252 1131: _build_slice() node_7f989252->node_036c82c0 node_85239620 1139: _build_starred() node_85239620->node_036c82c0 node_c0d536b3 1143: _build_subscript() node_c0d536b3->node_036c82c0 node_4dbe4dea 1172: _build_tuple() node_4dbe4dea->node_036c82c0 node_1baa2d62 1182: _build_unaryop() node_1baa2d62->node_036c82c0 node_939af9ff 1186: _build_yield() node_939af9ff->node_036c82c0 node_d5a00e50 1190: _build_yield_from() node_d5a00e50->node_036c82c0 node_e2726823 57: _field_as_dict() node_74684e78->node_e2726823 node_e2726823->node_e2726823 node_42dee7c3->node_d926c701 node_d926c701->node_d926c701 node_e7e74eec 1230: get_expression() node_e7e74eec->node_036c82c0 node_99fa7e31->node_e7e74eec

extensionsΒ€

These submodules contain our extension system, as well as built-in extensions.

base.pyΒ€

This module contains the base class for extensions and the functions to load them.

G cluster_b67b4bfb File: base cluster_2b0c0edf Class: Extension cluster_a9fac9e6 Class: Extensions node_ac70aad9 56: generic_inspect() node_d4efaae4 48: inspect() node_ac70aad9->node_d4efaae4 node_5ef40b22 39: generic_visit() node_54444d63 31: visit() node_5ef40b22->node_54444d63 node_3d938cb2 287: __init__() node_fa028df2 296: add() node_3d938cb2->node_fa028df2 node_4b42d62e 333: _load_extension() node_752c7ebc 322: _load_extension_path() node_4b42d62e->node_752c7ebc node_773dc88b 424: load_extensions() node_773dc88b->node_3d938cb2 node_773dc88b->node_fa028df2 node_773dc88b->node_4b42d62e
dataclasses.pyΒ€

Built-in extension adding support for dataclasses.

This extension re-creates __init__ methods of dataclasses during static analysis.

G cluster_098f436e File: dataclasses cluster_3e488b88 Class: DataclassesExtension node_2492c4b5 227: on_package_loaded() node_0838db3a 203: _apply_recursively() node_2492c4b5->node_0838db3a node_0838db3a->node_0838db3a node_3f19b38d 195: _del_members_annotated_as_initvar() node_0838db3a->node_3f19b38d node_a7d06370 157: _set_dataclass_init() node_0838db3a->node_a7d06370 node_9db1ada6 49: _dataclass_arguments() node_79fd2ab0 25: _dataclass_decorator() node_9db1ada6->node_79fd2ab0 node_918cc05e 32: _expr_args() node_9db1ada6->node_918cc05e node_c86881b6 66: _dataclass_parameters() node_c86881b6->node_9db1ada6 node_a888dfbd 55: _field_arguments() node_c86881b6->node_a888dfbd node_918cc05e->node_918cc05e node_a888dfbd->node_918cc05e node_3e0c4cdf 139: _reorder_parameters() node_a7d06370->node_79fd2ab0 node_a7d06370->node_c86881b6 node_a7d06370->node_3e0c4cdf

finder.pyΒ€

This module contains the code allowing to find modules.

Note: It might be possible to replace a good part of this module's logic with utilities from importlib (however the util in question is private):

>>> from importlib.util import _find_spec
>>> _find_spec("griffe.agents", _find_spec("griffe", None).submodule_search_locations)
ModuleSpec(
    name='griffe.agents',
    loader=<_frozen_importlib_external.SourceFileLoader object at 0x7fa5f34e8110>,
    origin='/media/data/dev/griffe/src/griffe/agents/__init__.py',
    submodule_search_locations=['/media/data/dev/griffe/src/griffe/agents'],
)
G cluster_c63403ff File: finder cluster_52c60f41 Class: ModuleFinder node_a195cc3d 102: __init__() node_524bd289 387: _extend_from_pth_files() node_a195cc3d->node_524bd289 node_fff634f6 119: append_search_path() node_a195cc3d->node_fff634f6 node_26e5aec4 375: _contents() node_524bd289->node_26e5aec4 node_524bd289->node_fff634f6 node_2e06c02b 443: _handle_pth_file() node_524bd289->node_2e06c02b node_1ec6f848 396: _filter_py_modules() node_88c2bddf 360: _module_name_path() node_ccab29db 404: _top_module_name() node_460064f4 132: insert_search_path() node_ccab29db->node_460064f4 node_bddf8439 229: find_package() node_bddf8439->node_26e5aec4 node_88bacc56 428: _is_pkg_style_namespace() node_bddf8439->node_88bacc56 node_87dca720 146: find_spec() node_87dca720->node_88c2bddf node_87dca720->node_ccab29db node_87dca720->node_bddf8439 node_06f637b2 277: iter_submodules() node_06f637b2->node_1ec6f848 node_06f637b2->node_06f637b2 node_f685973a 343: submodules() node_f685973a->node_06f637b2 node_3c8bd907 473: _handle_editable_module() node_7c7be1e3 51: _match_pattern() node_3c8bd907->node_7c7be1e3 node_2e06c02b->node_3c8bd907

git.pyΒ€

This module contains Git utilities, used by our load_git function, which in turn is used to load the API for different snapshots of a Git repository and find breaking changes between them.

G cluster_bb9a2129 File: git node_72f703c1 25: _normalize() node_ba180226 31: assert_git_repo() node_f8884a1a 102: tmp_worktree() node_f8884a1a->node_72f703c1 node_f8884a1a->node_ba180226

importer.pyΒ€

This module contains utilities to dynamically import objects. These utilities are used by our Inspector to dynamically import objects specified as Python paths, like package.module.Class.method.

G cluster_c2f419dc File: importer node_c5ac95ad 17: _error_details() node_66c46fb6 43: dynamic_import() node_66c46fb6->node_c5ac95ad node_776f589c 22: sys_path() node_66c46fb6->node_776f589c

loader.pyΒ€

This module contains all the logic for loading API data from sources or compiled modules.

G cluster_860d293f File: loader cluster_c62dc78e Class: GriffeLoader node_4dd14b39 53: __init__() node_17b4a602 632: _create_module() node_5eab3409 715: _expand_wildcard() node_22becdf8 685: _get_or_create_parent_module() node_22becdf8->node_17b4a602 node_cf3c0ff2 660: _inspect_module() node_28b2c257 535: _load_module() node_9771cd50 554: _load_module_path() node_28b2c257->node_9771cd50 node_9771cd50->node_17b4a602 node_9771cd50->node_cf3c0ff2 node_6702594f 577: _load_submodules() node_9771cd50->node_6702594f node_36023c74 640: _visit_module() node_9771cd50->node_36023c74 node_8e1d10a2 519: _load_package() node_8e1d10a2->node_28b2c257 node_5103c993 315: expand_wildcards() node_8e1d10a2->node_5103c993 node_4fabaa18 581: _load_submodule() node_4fabaa18->node_22becdf8 node_4fabaa18->node_28b2c257 node_6702594f->node_4fabaa18 node_5f44dc6a 193: _post_load() node_fecdcb72 276: expand_exports() node_5f44dc6a->node_fecdcb72 node_5f44dc6a->node_5103c993 node_fecdcb72->node_fecdcb72 node_5103c993->node_5eab3409 node_5103c993->node_5103c993 node_08432a62 101: load() node_5103c993->node_08432a62 node_08432a62->node_cf3c0ff2 node_08432a62->node_8e1d10a2 node_08432a62->node_5f44dc6a node_a8e65ba5 220: resolve_aliases() node_a8e65ba5->node_5103c993 node_b1088eda 430: resolve_module_aliases() node_a8e65ba5->node_b1088eda node_b1088eda->node_08432a62 node_b1088eda->node_b1088eda node_0b5987d3 724: load() node_0b5987d3->node_4dd14b39 node_0b5987d3->node_08432a62 node_0b5987d3->node_a8e65ba5 node_0861ab85 829: load_git() node_0861ab85->node_0b5987d3 node_51d66c38 914: load_pypi() node_51d66c38->node_0b5987d3

logger.pyΒ€

This module contains the logger used throughout Griffe. The logger is actually a wrapper around the standard Python logger. We wrap it so that it is easier for other downstream libraries to patch it. For example, mkdocstrings-python patches the logger to relocate it as a child of mkdocs.plugins so that it fits in the MkDocs logging configuration.

We use a single, global logger because our public API is exposed in a single module, griffe. Extensions however should use their own logger, which is why we provide the get_logger function.

G cluster_9735ae09 File: logger cluster_bb61bc4e Class: Logger node_7147bdc2 0: (global)() node_33f232b9 43: _get() node_7147bdc2->node_33f232b9 node_3129ba60 49: _patch_loggers() node_6b8b9840 93: get_logger() node_6b8b9840->node_33f232b9 node_040b915b 105: patch_loggers() node_040b915b->node_3129ba60

merger.pyΒ€

This module contains utilities to merge stubs data and concrete data.

G cluster_949b0a14 File: merger node_6b3ca7d0 35: _merge_attribute_stubs() node_477eb172 40: _merge_stubs_docstring() node_6b3ca7d0->node_477eb172 node_36f6b661 21: _merge_class_stubs() node_36f6b661->node_477eb172 node_699f2f05 53: _merge_stubs_members() node_36f6b661->node_699f2f05 node_b543d58e 45: _merge_stubs_overloads() node_36f6b661->node_b543d58e node_e1353de2 27: _merge_function_stubs() node_e1353de2->node_477eb172 node_9739f762 15: _merge_module_stubs() node_9739f762->node_477eb172 node_9739f762->node_699f2f05 node_9739f762->node_b543d58e node_699f2f05->node_6b3ca7d0 node_699f2f05->node_e1353de2 node_95eb422b 87: merge_stubs() node_95eb422b->node_9739f762

mixins.pyΒ€

This module contains some mixins classes that hold shared methods of the different kinds of objects, and aliases.

G cluster_c01f3d05 File: mixins cluster_a4ec3013 Class: GetMembersMixin cluster_6f43163f Class: DelMembersMixin cluster_d7761754 Class: SetMembersMixin node_35f7d2ac 97: __delitem__() node_b7fe1979 22: _get_parts() node_35f7d2ac->node_b7fe1979 node_d42b2eb3 124: del_member() node_d42b2eb3->node_d42b2eb3 node_d42b2eb3->node_b7fe1979 node_b1e53ee0 42: __getitem__() node_b1e53ee0->node_b7fe1979 node_ae131f67 64: get_member() node_ae131f67->node_ae131f67 node_ae131f67->node_b7fe1979 node_2dbc6ee3 157: __setitem__() node_2dbc6ee3->node_b7fe1979 node_c46e6c81 183: set_member() node_c46e6c81->node_c46e6c81 node_c46e6c81->node_b7fe1979

models.pyΒ€

This module contains our models definitions, to represent Python objects (and other aspects of Python APIs)... in Python.

G cluster_7d82df7a File: models cluster_c0cde8a9 Class: Docstring cluster_69d832f8 Class: Parameter cluster_7f5463bd Class: Parameters cluster_8f836de3 Class: Object cluster_f377d7c1 Class: Alias cluster_532e7e18 Class: Class cluster_ac54bd08 Class: Function node_d07f1370 877: __init__() node_0f3868df 1453: _update_target_aliases() node_d07f1370->node_0f3868df node_2b0b3205 1437: _resolve_target() node_478bc3e2 1408: resolve_target() node_2b0b3205->node_478bc3e2 node_6a013834 1032: as_json() node_6a013834->node_6a013834 node_f6f3b32c 1157: filter_members() node_f6f3b32c->node_f6f3b32c node_a0b8810b 1146: has_labels() node_a0b8810b->node_a0b8810b node_64ad1961 1012: inherited_members() node_64ad1961->node_d07f1370 node_46dd66d0 1112: is_kind() node_46dd66d0->node_46dd66d0 node_2f547173 998: members() node_2f547173->node_d07f1370 node_17a51019 982: parent() node_17a51019->node_0f3868df node_9d578e07 1234: resolve() node_9d578e07->node_9d578e07 node_3f5718c1 1367: target() node_3f5718c1->node_478bc3e2 node_3e73ee96 1662: _mro() node_3e73ee96->node_3e73ee96 node_e0b1283b 1673: mro() node_e0b1283b->node_3e73ee96 node_02d49121 1630: parameters() node_cbb694b7 263: __init__() node_02d49121->node_cbb694b7 node_1ac3710e 128: parse() node_35f95de9 124: parsed() node_35f95de9->node_1ac3710e node_744fe738 1697: __init__() node_744fe738->node_cbb694b7 node_4c6d4ee1 510: inherited_members() node_4c6d4ee1->node_d07f1370 node_34e93753 786: resolve() node_34e93753->node_34e93753 node_98d752f2 231: as_dict() node_98d752f2->node_98d752f2

stats.pyΒ€

This module contains utilities to compute loading statistics, like time spent visiting modules statically or dynamically.

G cluster_0e061020 File: stats cluster_f86e2df4 Class: Stats node_42be047f 20: __init__() node_78e6132a 73: _itercount() node_42be047f->node_78e6132a node_78e6132a->node_78e6132a

tests.pyΒ€

This module contains helpers. They simplify programmatic use of Griffe, for example to load data from strings or to create temporary packages. They are particularly useful for our own tests suite.

G cluster_c9b633d6 File: tests node_15d86184 396: module_vtree() node_dd0cfe39 353: vtree() node_15d86184->node_dd0cfe39 node_b24ae0d0 302: temporary_inspected_module() node_559d53e1 53: temporary_pyfile() node_b24ae0d0->node_559d53e1 node_89686fe9 185: temporary_inspected_package() node_9811741a 71: temporary_pypackage() node_89686fe9->node_9811741a node_90b1e34f 256: temporary_visited_module() node_90b1e34f->node_559d53e1 node_1e44ba63 120: temporary_visited_package() node_1e44ba63->node_9811741a