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
           set-docstring-styles.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
     get_version.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_api.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_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_docstrings_griffe.docstrings_griffe_agents_inspector->_griffe_docstrings_griffe_docstrings_parsers_griffe.docstrings.parsers_griffe_agents_inspector->_griffe_docstrings_parsers_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_docstrings_griffe_agents_visitor->_griffe_docstrings_parsers_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_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_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_docstrings_griffe_loader->_griffe_docstrings_parsers_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_docstrings_griffe_tests->_griffe_docstrings_parsers_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_9931f21e File: inspector cluster_5bff6afd Class: Inspector node_ca70e895 101: __init__() node_ca70e895->node_ca70e895 node_970b68c6 153: _get_docstring() node_726b8ea2 175: _get_linenos() node_72ce5727 241: generic_inspect() node_72ce5727->node_ca70e895 node_9369763c 233: inspect() node_72ce5727->node_9369763c node_f3fcd488 278: inspect_module() node_72ce5727->node_f3fcd488 node_a617742b 185: get_module() node_a617742b->node_9369763c node_0eff2ff0 486: handle_attribute() node_0eff2ff0->node_970b68c6 node_1b9efdaf 420: handle_function() node_1b9efdaf->node_970b68c6 node_1b9efdaf->node_726b8ea2 node_29989eea 559: _convert_object_to_annotation() node_1b9efdaf->node_29989eea node_67fedb8b 543: _convert_parameter() node_1b9efdaf->node_67fedb8b node_8ab9a4c1 478: inspect_attribute() node_8ab9a4c1->node_0eff2ff0 node_e794ea59 380: inspect_builtin_function() node_e794ea59->node_1b9efdaf node_6368d1d0 356: inspect_builtin_method() node_6368d1d0->node_1b9efdaf node_2a469e96 396: inspect_cached_property() node_2a469e96->node_1b9efdaf node_45cccacc 300: inspect_class() node_45cccacc->node_970b68c6 node_45cccacc->node_726b8ea2 node_45cccacc->node_72ce5727 node_801c6df7 340: inspect_classmethod() node_801c6df7->node_1b9efdaf node_36c8550c 372: inspect_coroutine() node_36c8550c->node_1b9efdaf node_c587e9f3 388: inspect_function() node_c587e9f3->node_1b9efdaf node_39870259 412: inspect_getset_descriptor() node_39870259->node_1b9efdaf node_6c981d9e 364: inspect_method() node_6c981d9e->node_1b9efdaf node_c68fa979 348: inspect_method_descriptor() node_c68fa979->node_1b9efdaf node_f3fcd488->node_970b68c6 node_e634279d 404: inspect_property() node_e634279d->node_1b9efdaf node_42ec77dd 332: inspect_staticmethod() node_42ec77dd->node_1b9efdaf node_67fedb8b->node_29989eea node_055810e1 33: inspect() node_055810e1->node_ca70e895 node_055810e1->node_a617742b
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_be90a198 File: assignments node_2864adb4 40: _get_annassign_names() node_78f5828e 23: get_name() node_2864adb4->node_78f5828e node_54bd1a14 35: _get_assign_names() node_54bd1a14->node_78f5828e node_ce0c0ff0 9: _get_attribute_name() node_ce0c0ff0->node_78f5828e node_41d6e41b 63: get_instance_names() node_0fce0fb6 51: get_names() node_41d6e41b->node_0fce0fb6
ast.pyΒ€

This module contains utilities for navigating AST nodes.

G cluster_9e05b3bb File: ast node_06418864 26: ast_children() node_4aff163d 137: ast_first_child() node_4aff163d->node_06418864 node_6b8145f3 155: ast_last_child() node_6b8145f3->node_06418864 node_2fb9be74 119: ast_next() node_48b54537 66: ast_next_siblings() node_2fb9be74->node_48b54537 node_48b54537->node_06418864 node_bbc003c0 100: ast_previous() node_4070e966 50: ast_previous_siblings() node_bbc003c0->node_4070e966 node_4070e966->node_06418864 node_14a08268 82: ast_siblings() node_14a08268->node_06418864
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_049f74e8 File: exports node_e885f31b 74: _extract() node_49c5f32b 33: _extract_attribute() node_49c5f32b->node_e885f31b node_ea7cd073 37: _extract_binop() node_ea7cd073->node_e885f31b node_61f7c8f6 51: _extract_sequence() node_61f7c8f6->node_e885f31b node_1410c202 58: _extract_starred() node_1410c202->node_e885f31b node_2f224647 78: get__all__() node_2f224647->node_e885f31b node_12ca76e1 93: safe_get__all__() node_12ca76e1->node_2f224647
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_e01d6097 File: runtime cluster_29785cc3 Class: ObjectNode node_39ef0ed6 41: __init__() node_8444c075 243: _pick_member() node_12df728a 253: alias_target_path() node_f2b2a4ff 25: _same_components() node_12df728a->node_f2b2a4ff node_97740f2c 141: children() node_97740f2c->node_39ef0ed6 node_97740f2c->node_8444c075
values.pyΒ€

This module contains utilities for extracting attribute values.

G cluster_8ce107ca File: values node_691f1c04 15: get_value() node_ed587006 29: safe_get_value() node_ed587006->node_691f1c04
visitor.pyΒ€

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

G cluster_d9cd19a3 File: visitor cluster_67d513a5 Class: Visitor node_5af33585 122: __init__() node_5af33585->node_5af33585 node_39b46878 182: _get_docstring() node_390e7a5c 293: decorators_to_labels() node_ea8bf127 216: generic_visit() node_ffcb5d88 208: visit() node_ea8bf127->node_ffcb5d88 node_f3d2f53b 311: get_base_property() node_55f047c3 194: get_module() node_55f047c3->node_ffcb5d88 node_0a2cb7c1 509: handle_attribute() node_0a2cb7c1->node_39b46878 node_46c1528c 335: handle_function() node_46c1528c->node_39b46878 node_46c1528c->node_390e7a5c node_46c1528c->node_ea8bf127 node_46c1528c->node_f3d2f53b node_564728f3 620: visit_annassign() node_564728f3->node_0a2cb7c1 node_f2a5ce26 612: visit_assign() node_f2a5ce26->node_0a2cb7c1 node_7750446a 446: visit_asyncfunctiondef() node_7750446a->node_46c1528c node_3a8193fa 247: visit_classdef() node_3a8193fa->node_39b46878 node_3a8193fa->node_390e7a5c node_3a8193fa->node_ea8bf127 node_d5a62dec 438: visit_functiondef() node_d5a62dec->node_46c1528c node_13db459c 649: visit_if() node_13db459c->node_ea8bf127 node_7a1279f6 225: visit_module() node_7a1279f6->node_39b46878 node_7a1279f6->node_ea8bf127 node_100cecf3 65: visit() node_100cecf3->node_5af33585 node_100cecf3->node_55f047c3

c3linear.pyΒ€

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

G cluster_a93bdd8e File: c3linear cluster_103e3407 Class: _Dependency cluster_bda73350 Class: _DependencyList node_6e095f9e 29: tail() node_d435e711 60: __len__() node_6e095f9e->node_d435e711 node_adee38a0 48: __init__() node_01fb8930 64: __repr__() node_01fb8930->node_01fb8930 node_4c56be0b 82: remove() node_c6d55ed3 93: c3linear_merge() node_c6d55ed3->node_adee38a0 node_c6d55ed3->node_4c56be0b

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_2d7301a5 File: cli cluster_5359f047 Class: _DebugInfo node_13a36933 51: __init__() node_13a36933->node_13a36933 node_94197e98 69: _load_packages() node_1a4d098b 59: _print_data() node_de68b432 331: dump() node_de68b432->node_94197e98 node_de68b432->node_1a4d098b node_29e7c7de 130: get_parser() node_4a134451 575: main() node_4a134451->node_29e7c7de

collections.pyΒ€

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

G cluster_5676a6e8 File: collections cluster_76007d6f Class: LinesCollection node_32aa562c 56: items() node_32aa562c->node_32aa562c node_32f10da3 40: keys() node_32f10da3->node_32f10da3 node_c9fbe3f3 48: values() node_c9fbe3f3->node_c9fbe3f3

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_2c1dff7f File: debug node_e0928f17 80: _get_debug_info() node_8ca4682a 65: _get_version() node_e0928f17->node_8ca4682a node_fd68c209 54: _interpreter_name_version() node_e0928f17->node_fd68c209 node_d706ed27 99: _print_debug_info() node_d706ed27->node_e0928f17

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_5d861320 File: diff cluster_728f86fe Class: Breakage node_92f914cd 217: _explain_github() node_a09b41ce 160: _format_new_value() node_92f914cd->node_a09b41ce node_de9a666b 157: _format_old_value() node_92f914cd->node_de9a666b node_c2f47058 151: _format_title() node_92f914cd->node_c2f47058 node_84ba5311 197: _explain_markdown() node_84ba5311->node_a09b41ce node_84ba5311->node_de9a666b node_3ae6dfc8 163: _explain_oneline() node_a6e5a180 154: _format_kind() node_3ae6dfc8->node_a6e5a180 node_bb2c2d2e 148: _format_location() node_3ae6dfc8->node_bb2c2d2e node_3ae6dfc8->node_a09b41ce node_3ae6dfc8->node_de9a666b node_3ae6dfc8->node_c2f47058 node_314308c1 179: _explain_verbose() node_314308c1->node_a6e5a180 node_314308c1->node_bb2c2d2e node_314308c1->node_a09b41ce node_314308c1->node_de9a666b node_314308c1->node_c2f47058 node_c41d180f 506: _alias_incompatibilities() node_a2c8dde4 543: _type_based_yield() node_c41d180f->node_a2c8dde4 node_c53f452f 497: _attribute_incompatibilities() node_a2b11c54 409: _class_incompatibilities() node_7e5bdcbf 522: _member_incompatibilities() node_a2b11c54->node_7e5bdcbf node_c2334c48 422: _function_incompatibilities() node_e6a15e6e 580: _returns_are_compatible() node_c2334c48->node_e6a15e6e node_7e5bdcbf->node_a2c8dde4 node_a2c8dde4->node_c53f452f node_a2c8dde4->node_a2b11c54 node_a2c8dde4->node_c2334c48 node_ce0fdbf6 604: find_breaking_changes() node_ce0fdbf6->node_7e5bdcbf

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_d1518ddd File: google node_86506b96 513: _annotation_from_parent() node_a149c405 482: _get_name_annotation_description() node_b64ab9eb 726: _is_empty_line() node_ef715535 266: _read_attributes_section() node_bf89310e 83: _read_block_items() node_ef715535->node_bf89310e node_aa869722 147: _read_block() node_aa869722->node_b64ab9eb node_bf89310e->node_b64ab9eb node_0bdbc952 469: _read_block_items_maybe() node_0bdbc952->node_aa869722 node_0bdbc952->node_bf89310e node_850c6b2c 345: _read_classes_section() node_850c6b2c->node_bf89310e node_99247b8e 667: _read_examples_section() node_99247b8e->node_b64ab9eb node_99247b8e->node_aa869722 node_086c95f5 308: _read_functions_section() node_086c95f5->node_bf89310e node_9dc06c42 382: _read_modules_section() node_9dc06c42->node_bf89310e node_b7ea2b20 255: _read_other_parameters_section() node_397a8e31 178: _read_parameters() node_b7ea2b20->node_397a8e31 node_397a8e31->node_bf89310e node_a19e990f 245: _read_parameters_section() node_a19e990f->node_397a8e31 node_f5081fd2 410: _read_raises_section() node_f5081fd2->node_bf89310e node_2f2afb5b 622: _read_receives_section() node_2f2afb5b->node_86506b96 node_2f2afb5b->node_a149c405 node_2f2afb5b->node_0bdbc952 node_33072a59 532: _read_returns_section() node_33072a59->node_86506b96 node_33072a59->node_a149c405 node_33072a59->node_0bdbc952 node_3a061e66 441: _read_warns_section() node_3a061e66->node_bf89310e node_80c5e39e 577: _read_yields_section() node_80c5e39e->node_86506b96 node_80c5e39e->node_a149c405 node_80c5e39e->node_0bdbc952 node_9fed25ea 748: parse_google() node_9fed25ea->node_b64ab9eb node_9fed25ea->node_aa869722
models.pyΒ€

This module contains the models for storing docstrings structured data.

G cluster_0a4ff9b6 File: models cluster_100d9dd0 Class: DocstringSection node_b1c62c9a 202: as_dict() node_b1c62c9a->node_b1c62c9a
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_17c7ac05 File: numpy node_9d28513d 760: _append_section() node_ec308e71 89: _is_dash_line() node_23eb889b 85: _is_empty_line() node_ec308e71->node_23eb889b node_777ef673 560: _read_attributes_section() node_3c31a234 93: _read_block_items() node_777ef673->node_3c31a234 node_2a429c1b 155: _read_block() node_2a429c1b->node_ec308e71 node_2a429c1b->node_23eb889b node_3c31a234->node_ec308e71 node_3c31a234->node_23eb889b node_3e763f42 631: _read_classes_section() node_3e763f42->node_3c31a234 node_0867eafa 327: _read_deprecated_section() node_0867eafa->node_3c31a234 node_28eacf0b 695: _read_examples_section() node_28eacf0b->node_23eb889b node_28eacf0b->node_2a429c1b node_9864abea 599: _read_functions_section() node_9864abea->node_3c31a234 node_ab3b68c4 663: _read_modules_section() node_ab3b68c4->node_3c31a234 node_0f4f0d51 305: _read_other_parameters_section() node_5c5a3606 217: _read_parameters() node_0f4f0d51->node_5c5a3606 node_5c5a3606->node_3c31a234 node_4c34c388 290: _read_parameters_section() node_4c34c388->node_5c5a3606 node_05b19321 510: _read_raises_section() node_05b19321->node_3c31a234 node_8b18cb8a 463: _read_receives_section() node_8b18cb8a->node_3c31a234 node_1895a40b 353: _read_returns_section() node_1895a40b->node_3c31a234 node_dc3db715 535: _read_warns_section() node_dc3db715->node_3c31a234 node_d6211755 412: _read_yields_section() node_d6211755->node_3c31a234 node_b86c251a 796: parse_numpy() node_b86c251a->node_9d28513d node_b86c251a->node_ec308e71 node_b86c251a->node_23eb889b
parsers.pyΒ€

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

G cluster_cbffd6bb File: parsers node_370490e1 107: infer_docstring_style() node_aebd7155 239: parse() node_9976de2e 180: parse_auto() node_9976de2e->node_370490e1 node_9976de2e->node_aebd7155
sphinx.pyΒ€

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

G cluster_db0db30f File: sphinx cluster_3ab25869 Class: _FieldType node_1a5e7c59 49: matches() node_2df5506e 437: _consolidate_continuation_lines() node_3f4e4278 450: _consolidate_descriptive_type() node_7e4c1730 191: _determine_param_annotation() node_9d16e64e 184: _determine_param_default() node_6b01437e 424: _parse_directive() node_6b01437e->node_2df5506e node_17e932ad 408: _parsed_values_to_sections() node_42226511 454: _strip_blank_lines() node_17e932ad->node_42226511 node_f7dc73c8 256: _read_attribute() node_f7dc73c8->node_6b01437e node_121600d3 303: _read_attribute_type() node_121600d3->node_3f4e4278 node_121600d3->node_6b01437e node_87694642 333: _read_exception() node_87694642->node_6b01437e node_d30307e0 130: _read_parameter() node_d30307e0->node_7e4c1730 node_d30307e0->node_9d16e64e node_d30307e0->node_6b01437e node_6f819673 226: _read_parameter_type() node_6f819673->node_3f4e4278 node_6f819673->node_6b01437e node_e2268031 354: _read_return() node_e2268031->node_6b01437e node_722fb55c 387: _read_return_type() node_722fb55c->node_3f4e4278 node_722fb55c->node_6b01437e node_0629ddaf 86: parse_sphinx() node_0629ddaf->node_1a5e7c59 node_0629ddaf->node_17e932ad
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_19919c45 File: encoders cluster_7d23ad62 Class: JSONEncoder node_a024cf82 48: __init__() node_a024cf82->node_a024cf82 node_0f292651 125: _attach_parent_to_expr() node_4cf260e6 135: _attach_parent_to_exprs() node_4cf260e6->node_0f292651 node_c1fe879a 211: _load_attribute() node_98c06140 85: _load_docstring() node_c1fe879a->node_98c06140 node_8d9dab28 174: _load_class() node_8d9dab28->node_4cf260e6 node_dd34b194 91: _load_decorators() node_8d9dab28->node_dd34b194 node_8d9dab28->node_98c06140 node_6d71ab62 95: _load_expression() node_cc7442c0 197: _load_function() node_cc7442c0->node_dd34b194 node_cc7442c0->node_98c06140 node_51673fc6 159: _load_module() node_51673fc6->node_4cf260e6 node_51673fc6->node_98c06140 node_dd521d9c 115: _load_parameter() node_dd521d9c->node_98c06140 node_e6df8b51 242: json_decoder() node_e6df8b51->node_6d71ab62 node_e6df8b51->node_dd521d9c

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_49149614 File: expressions cluster_c8ccc6bf Class: Expr cluster_e037bb9d Class: ExprAttribute cluster_fa0a6897 Class: ExprBinOp cluster_1c7bc660 Class: ExprBoolOp cluster_5504ad26 Class: ExprCall cluster_c12ef86c Class: ExprCompare cluster_020d8595 Class: ExprComprehension cluster_2b1ada88 Class: ExprDict cluster_9d74e344 Class: ExprDictComp cluster_f025b81b Class: ExprExtSlice cluster_a06f75ea Class: ExprFormatted cluster_cbdfde6c Class: ExprGeneratorExp cluster_71f4b77d Class: ExprIfExp cluster_db661e85 Class: ExprJoinedStr cluster_051dd7a9 Class: ExprKeyword cluster_b8f08f55 Class: ExprVarPositional cluster_f30aa017 Class: ExprVarKeyword cluster_df2082d2 Class: ExprLambda cluster_b82b980c Class: ExprList cluster_8abc9b1b Class: ExprListComp cluster_10cf12f6 Class: ExprNamedExpr cluster_68b569d3 Class: ExprSet cluster_2aa6b489 Class: ExprSetComp cluster_4dc794ed Class: ExprSlice cluster_4fb66e88 Class: ExprSubscript cluster_74d37392 Class: ExprTuple cluster_7842a3a2 Class: ExprUnaryOp cluster_8457bf99 Class: ExprYield cluster_38411bfa Class: ExprYieldFrom node_38cf13bc 98: __iter__() node_0f4b0640 102: iterate() node_38cf13bc->node_0f4b0640 node_5502b44f 95: __str__() node_5502b44f->node_0f4b0640 node_a60497d6 131: as_dict() node_31a0e047 68: _expr_as_dict() node_a60497d6->node_31a0e047 node_09b51403 201: append() node_09b51403->node_09b51403 node_fae84dff 193: iterate() node_f7250949 41: _join() node_fae84dff->node_f7250949 node_0709fe78 246: iterate() node_25106169 29: _yield() node_0709fe78->node_25106169 node_52dfd928 262: iterate() node_52dfd928->node_f7250949 node_bf9030c3 281: iterate() node_bf9030c3->node_f7250949 node_bf9030c3->node_25106169 node_59b41feb 300: iterate() node_59b41feb->node_f7250949 node_59b41feb->node_25106169 node_54436fb3 320: iterate() node_54436fb3->node_f7250949 node_54436fb3->node_25106169 node_e8460b92 358: iterate() node_e8460b92->node_f7250949 node_793880fe 380: iterate() node_793880fe->node_f7250949 node_793880fe->node_25106169 node_ac477468 397: iterate() node_ac477468->node_f7250949 node_fa558cde 409: iterate() node_fa558cde->node_25106169 node_a74e066d 425: iterate() node_a74e066d->node_f7250949 node_a74e066d->node_25106169 node_80446894 443: iterate() node_80446894->node_25106169 node_8f5f5e18 459: iterate() node_8f5f5e18->node_f7250949 node_d8995f50 500: iterate() node_d8995f50->node_25106169 node_f02b02c9 542: iterate() node_f02b02c9->node_25106169 node_70a656b5 583: iterate() node_70a656b5->node_f7250949 node_8c4b010a 599: iterate() node_8c4b010a->node_f7250949 node_8c4b010a->node_25106169 node_d35c3a2e 704: iterate() node_d35c3a2e->node_25106169 node_bd0db376 735: iterate() node_bd0db376->node_f7250949 node_7cd48748 751: iterate() node_7cd48748->node_f7250949 node_7cd48748->node_25106169 node_1fb61894 771: iterate() node_1fb61894->node_25106169 node_4ea3c4e9 799: _to_binop() node_4ea3c4e9->node_4ea3c4e9 node_af830f88 792: iterate() node_af830f88->node_25106169 node_fdaab6b0 814: modernize() node_fdaab6b0->node_4ea3c4e9 node_fdaab6b0->node_fdaab6b0 node_b8e68cc3 850: iterate() node_b8e68cc3->node_f7250949 node_26178ece 876: iterate() node_26178ece->node_25106169 node_34af0891 527: iterate() node_34af0891->node_25106169 node_a7673325 514: iterate() node_a7673325->node_25106169 node_549ba21a 889: iterate() node_549ba21a->node_25106169 node_4ade710a 904: iterate() node_4ade710a->node_25106169 node_04a41cdf 1233: _build() node_3a4f8cc2 951: _build_attribute() node_3a4f8cc2->node_09b51403 node_3a4f8cc2->node_04a41cdf node_aedc0d28 963: _build_binop() node_aedc0d28->node_04a41cdf node_eb76c45d 971: _build_boolop() node_eb76c45d->node_04a41cdf node_fe6979c0 978: _build_call() node_fe6979c0->node_04a41cdf node_5f5f110a 985: _build_compare() node_5f5f110a->node_04a41cdf node_39b85e0c 993: _build_comprehension() node_39b85e0c->node_04a41cdf node_0d1aba81 1002: _build_constant() node_0d1aba81->node_04a41cdf node_e939478c 1041: _build_dict() node_e939478c->node_04a41cdf node_bb7213a9 1048: _build_dictcomp() node_bb7213a9->node_04a41cdf node_07ed6860 1056: _build_formatted() node_07ed6860->node_04a41cdf node_da493b7c 1066: _build_generatorexp() node_da493b7c->node_04a41cdf node_763bd858 1073: _build_ifexp() node_763bd858->node_04a41cdf node_b22482f1 1081: _build_joinedstr() node_b22482f1->node_04a41cdf node_e24b2ba2 1091: _build_keyword() node_e24b2ba2->node_04a41cdf node_a4df303b 1097: _build_lambda() node_a4df303b->node_04a41cdf node_6cc7c50d 1265: safe_get_expression() node_a4df303b->node_6cc7c50d node_99535fa0 1114: _build_list() node_99535fa0->node_04a41cdf node_b577ad12 1118: _build_listcomp() node_b577ad12->node_04a41cdf node_aa5583f7 1126: _build_named_expr() node_aa5583f7->node_04a41cdf node_2711c283 1130: _build_set() node_2711c283->node_04a41cdf node_4c8c73d8 1134: _build_setcomp() node_4c8c73d8->node_04a41cdf node_5e2a823f 1138: _build_slice() node_5e2a823f->node_04a41cdf node_a429d9f8 1146: _build_starred() node_a429d9f8->node_04a41cdf node_f32af1ef 1150: _build_subscript() node_f32af1ef->node_04a41cdf node_7419f7be 1179: _build_tuple() node_7419f7be->node_04a41cdf node_f1ca9294 1189: _build_unaryop() node_f1ca9294->node_04a41cdf node_d6c121ae 1193: _build_yield() node_d6c121ae->node_04a41cdf node_9754bcb3 1197: _build_yield_from() node_9754bcb3->node_04a41cdf node_0d794d84 57: _field_as_dict() node_31a0e047->node_0d794d84 node_0d794d84->node_0d794d84 node_f7250949->node_25106169 node_25106169->node_25106169 node_e4d8a21e 1237: get_expression() node_e4d8a21e->node_04a41cdf node_6cc7c50d->node_e4d8a21e

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_981a4e61 File: base cluster_0e1ce6c5 Class: Extension cluster_828975fe Class: Extensions node_ff010b0a 56: generic_inspect() node_d58fafba 48: inspect() node_ff010b0a->node_d58fafba node_49ed6b35 39: generic_visit() node_f3f6f0e6 31: visit() node_49ed6b35->node_f3f6f0e6 node_dd4ff86d 287: __init__() node_8176b90b 296: add() node_dd4ff86d->node_8176b90b node_91b400ae 333: _load_extension() node_56909a8f 322: _load_extension_path() node_91b400ae->node_56909a8f node_23e631d5 424: load_extensions() node_23e631d5->node_dd4ff86d node_23e631d5->node_8176b90b node_23e631d5->node_91b400ae
dataclasses.pyΒ€

Built-in extension adding support for dataclasses.

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

G cluster_27fc0cb6 File: dataclasses cluster_76fc739e Class: DataclassesExtension node_0da9d855 227: on_package_loaded() node_1b86076c 203: _apply_recursively() node_0da9d855->node_1b86076c node_1b86076c->node_1b86076c node_b14f83c4 195: _del_members_annotated_as_initvar() node_1b86076c->node_b14f83c4 node_391a4061 157: _set_dataclass_init() node_1b86076c->node_391a4061 node_e94e6da4 49: _dataclass_arguments() node_e754094c 25: _dataclass_decorator() node_e94e6da4->node_e754094c node_ef7b09d6 32: _expr_args() node_e94e6da4->node_ef7b09d6 node_be369e76 66: _dataclass_parameters() node_be369e76->node_e94e6da4 node_f5fa4bc4 55: _field_arguments() node_be369e76->node_f5fa4bc4 node_ef7b09d6->node_ef7b09d6 node_f5fa4bc4->node_ef7b09d6 node_4fa3c4df 139: _reorder_parameters() node_391a4061->node_e754094c node_391a4061->node_be369e76 node_391a4061->node_4fa3c4df

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_545a6ff9 File: finder cluster_4ac6dcaf Class: ModuleFinder node_2d3c6433 102: __init__() node_ec251789 386: _extend_from_pth_files() node_2d3c6433->node_ec251789 node_eedb622a 119: append_search_path() node_2d3c6433->node_eedb622a node_ba739e72 374: _contents() node_ec251789->node_ba739e72 node_ec251789->node_eedb622a node_6447a929 442: _handle_pth_file() node_ec251789->node_6447a929 node_4cf4b1c8 395: _filter_py_modules() node_4d26ca5d 359: _module_name_path() node_f83d2cb3 403: _top_module_name() node_642a5105 132: insert_search_path() node_f83d2cb3->node_642a5105 node_90c673f2 229: find_package() node_90c673f2->node_ba739e72 node_d3af8df3 427: _is_pkg_style_namespace() node_90c673f2->node_d3af8df3 node_94ae288a 146: find_spec() node_94ae288a->node_4d26ca5d node_94ae288a->node_f83d2cb3 node_94ae288a->node_90c673f2 node_459e5939 276: iter_submodules() node_459e5939->node_4cf4b1c8 node_459e5939->node_459e5939 node_a4968a60 342: submodules() node_a4968a60->node_459e5939 node_90a720dc 472: _handle_editable_module() node_d0e6101e 51: _match_pattern() node_90a720dc->node_d0e6101e node_6447a929->node_90a720dc

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_fb907b5f File: git node_56d8b13d 25: _normalize() node_321267e3 31: assert_git_repo() node_1d4425f4 102: tmp_worktree() node_1d4425f4->node_56d8b13d node_1d4425f4->node_321267e3

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_f469f38c File: importer node_376d9f30 17: _error_details() node_5ea231a3 43: dynamic_import() node_5ea231a3->node_376d9f30 node_e6aeadb6 22: sys_path() node_5ea231a3->node_e6aeadb6

loader.pyΒ€

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

G cluster_3151e4c9 File: loader cluster_5fdf2f95 Class: GriffeLoader node_b5dfa7b7 52: __init__() node_ef10d5da 627: _create_module() node_18126627 710: _expand_wildcard() node_5e62da96 680: _get_or_create_parent_module() node_5e62da96->node_ef10d5da node_18346e7c 655: _inspect_module() node_a463ed03 528: _load_module() node_bdcc56a9 547: _load_module_path() node_a463ed03->node_bdcc56a9 node_bdcc56a9->node_ef10d5da node_bdcc56a9->node_18346e7c node_8f0857b1 572: _load_submodules() node_bdcc56a9->node_8f0857b1 node_dad280f7 635: _visit_module() node_bdcc56a9->node_dad280f7 node_aa5ac7de 513: _load_package() node_aa5ac7de->node_a463ed03 node_8af97cd9 305: expand_wildcards() node_aa5ac7de->node_8af97cd9 node_fa0f0d80 576: _load_submodule() node_fa0f0d80->node_5e62da96 node_fa0f0d80->node_a463ed03 node_8f0857b1->node_fa0f0d80 node_2bcf2e04 192: _post_load() node_b295ec1a 264: expand_exports() node_2bcf2e04->node_b295ec1a node_2bcf2e04->node_8af97cd9 node_b295ec1a->node_b295ec1a node_8af97cd9->node_18126627 node_8af97cd9->node_8af97cd9 node_669c22f0 100: load() node_8af97cd9->node_669c22f0 node_669c22f0->node_18346e7c node_669c22f0->node_aa5ac7de node_669c22f0->node_2bcf2e04 node_363d8c81 208: resolve_aliases() node_363d8c81->node_8af97cd9 node_af20c287 424: resolve_module_aliases() node_363d8c81->node_af20c287 node_af20c287->node_669c22f0 node_af20c287->node_af20c287 node_6d7ad4e1 719: load() node_6d7ad4e1->node_b5dfa7b7 node_6d7ad4e1->node_669c22f0 node_6d7ad4e1->node_363d8c81 node_b3872af5 824: load_git() node_b3872af5->node_6d7ad4e1 node_48fb0d43 909: load_pypi() node_48fb0d43->node_6d7ad4e1

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_eff50b79 File: logger cluster_53399d28 Class: Logger node_d4e3fc2f 0: (global)() node_11a2112d 43: _get() node_d4e3fc2f->node_11a2112d node_5ee8f88f 49: _patch_loggers() node_70a62f30 93: get_logger() node_70a62f30->node_11a2112d node_f90ac37e 105: patch_loggers() node_f90ac37e->node_5ee8f88f

merger.pyΒ€

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

G cluster_ed5ea172 File: merger node_7cfd703b 35: _merge_attribute_stubs() node_ccdb4f4c 42: _merge_stubs_docstring() node_7cfd703b->node_ccdb4f4c node_3a031bae 21: _merge_class_stubs() node_3a031bae->node_ccdb4f4c node_38b807fe 55: _merge_stubs_members() node_3a031bae->node_38b807fe node_68fcf59b 47: _merge_stubs_overloads() node_3a031bae->node_68fcf59b node_d7278cfa 27: _merge_function_stubs() node_d7278cfa->node_ccdb4f4c node_5fa128c4 15: _merge_module_stubs() node_5fa128c4->node_ccdb4f4c node_5fa128c4->node_38b807fe node_5fa128c4->node_68fcf59b node_38b807fe->node_7cfd703b node_38b807fe->node_d7278cfa node_4dd7cf3d 96: merge_stubs() node_4dd7cf3d->node_5fa128c4

mixins.pyΒ€

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

G cluster_6318b904 File: mixins cluster_810e3287 Class: GetMembersMixin cluster_f926e340 Class: DelMembersMixin cluster_65d7488d Class: SetMembersMixin node_59ddea6a 97: __delitem__() node_75ca09e8 22: _get_parts() node_59ddea6a->node_75ca09e8 node_f7a527ec 124: del_member() node_f7a527ec->node_f7a527ec node_f7a527ec->node_75ca09e8 node_f726a2f8 42: __getitem__() node_f726a2f8->node_75ca09e8 node_7c515d50 64: get_member() node_7c515d50->node_7c515d50 node_7c515d50->node_75ca09e8 node_afc5ebe0 157: __setitem__() node_afc5ebe0->node_75ca09e8 node_9040dc96 183: set_member() node_9040dc96->node_9040dc96 node_9040dc96->node_75ca09e8

models.pyΒ€

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

G cluster_50992ddb File: models cluster_79fe22b8 Class: Docstring cluster_a43869e5 Class: Parameter cluster_60f98f5b Class: Parameters cluster_0bfdfdb0 Class: Object cluster_ffd3e66c Class: Alias cluster_ac5a92bf Class: Class cluster_a8935755 Class: Function node_bab47a30 1026: __init__() node_e297269f 1760: _update_target_aliases() node_bab47a30->node_e297269f node_407d13c3 1744: _resolve_target() node_783fcc01 1711: resolve_target() node_407d13c3->node_783fcc01 node_b551279b 1203: as_json() node_b551279b->node_b551279b node_c3041dfd 1392: filter_members() node_c3041dfd->node_c3041dfd node_fea2f326 1379: has_labels() node_fea2f326->node_fea2f326 node_d529d263 1181: inherited_members() node_d529d263->node_bab47a30 node_f69c3d08 1310: is_kind() node_f69c3d08->node_f69c3d08 node_94007058 1161: members() node_94007058->node_bab47a30 node_2f8bab23 1142: parent() node_2f8bab23->node_e297269f node_7d1df350 1501: resolve() node_7d1df350->node_7d1df350 node_7564f184 1662: target() node_7564f184->node_783fcc01 node_1120feae 2002: _mro() node_1120feae->node_1120feae node_fe09ceaa 2013: mro() node_fe09ceaa->node_1120feae node_68674f1c 1967: parameters() node_9bce2f48 297: __init__() node_68674f1c->node_9bce2f48 node_f6bd0ed4 154: parse() node_2e359d8a 150: parsed() node_2e359d8a->node_f6bd0ed4 node_bfd68d61 2043: __init__() node_bfd68d61->node_9bce2f48 node_aebe3d2e 577: inherited_members() node_aebe3d2e->node_bab47a30 node_362adefa 931: resolve() node_362adefa->node_362adefa node_e50ba5b3 263: as_dict() node_e50ba5b3->node_e50ba5b3

stats.pyΒ€

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

G cluster_212fc5b4 File: stats cluster_42233192 Class: Stats node_ee3cf8ce 20: __init__() node_f0c3b374 73: _itercount() node_ee3cf8ce->node_f0c3b374 node_f0c3b374->node_f0c3b374

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_18bd7744 File: tests node_2a399b35 397: module_vtree() node_93d0d2ae 354: vtree() node_2a399b35->node_93d0d2ae node_cfdb25cc 303: temporary_inspected_module() node_b16a2c2b 54: temporary_pyfile() node_cfdb25cc->node_b16a2c2b node_da203c38 186: temporary_inspected_package() node_cf3ba82c 72: temporary_pypackage() node_da203c38->node_cf3ba82c node_dc7a382a 257: temporary_visited_module() node_dc7a382a->node_b16a2c2b node_c09195cb 121: temporary_visited_package() node_c09195cb->node_cf3ba82c