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.  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_794993f2 File: inspector cluster_ad3f21db Class: Inspector node_9d545ac1 100: __init__() node_9d545ac1->node_9d545ac1 node_156cdd28 152: _get_docstring() node_67bd896f 174: _get_linenos() node_2fc7246b 240: generic_inspect() node_2fc7246b->node_9d545ac1 node_05415c74 232: inspect() node_2fc7246b->node_05415c74 node_f16a6019 277: inspect_module() node_2fc7246b->node_f16a6019 node_a6e8273f 184: get_module() node_a6e8273f->node_05415c74 node_4a438fb5 477: handle_attribute() node_4a438fb5->node_156cdd28 node_3fb3e869 411: handle_function() node_3fb3e869->node_156cdd28 node_3fb3e869->node_67bd896f node_8423bf13 550: _convert_object_to_annotation() node_3fb3e869->node_8423bf13 node_15ef0e48 534: _convert_parameter() node_3fb3e869->node_15ef0e48 node_96403d9d 469: inspect_attribute() node_96403d9d->node_4a438fb5 node_8aa17dfd 379: inspect_builtin_function() node_8aa17dfd->node_3fb3e869 node_55237ddd 355: inspect_builtin_method() node_55237ddd->node_3fb3e869 node_ffbb8737 395: inspect_cached_property() node_ffbb8737->node_3fb3e869 node_e650fa56 299: inspect_class() node_e650fa56->node_156cdd28 node_e650fa56->node_67bd896f node_e650fa56->node_2fc7246b node_82bc3896 339: inspect_classmethod() node_82bc3896->node_3fb3e869 node_746d5898 371: inspect_coroutine() node_746d5898->node_3fb3e869 node_022d2dfa 387: inspect_function() node_022d2dfa->node_3fb3e869 node_d805aad5 363: inspect_method() node_d805aad5->node_3fb3e869 node_36533407 347: inspect_method_descriptor() node_36533407->node_3fb3e869 node_f16a6019->node_156cdd28 node_6375bc95 403: inspect_property() node_6375bc95->node_3fb3e869 node_be63a329 331: inspect_staticmethod() node_be63a329->node_3fb3e869 node_15ef0e48->node_8423bf13 node_9aefc59b 32: inspect() node_9aefc59b->node_9d545ac1 node_9aefc59b->node_a6e8273f
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_7ccfb021 File: assignments node_6bacf564 40: _get_annassign_names() node_16f1c2ba 23: get_name() node_6bacf564->node_16f1c2ba node_85c4e1dd 35: _get_assign_names() node_85c4e1dd->node_16f1c2ba node_b1388a2d 9: _get_attribute_name() node_b1388a2d->node_16f1c2ba node_786eb3f0 63: get_instance_names() node_b22ec4b7 51: get_names() node_786eb3f0->node_b22ec4b7
ast.pyΒ€

This module contains utilities for navigating AST nodes.

G cluster_7ca838ed File: ast node_cb61f460 26: ast_children() node_d85a5703 137: ast_first_child() node_d85a5703->node_cb61f460 node_38d01142 155: ast_last_child() node_38d01142->node_cb61f460 node_4dffdee2 119: ast_next() node_11610e84 66: ast_next_siblings() node_4dffdee2->node_11610e84 node_11610e84->node_cb61f460 node_3b59fe10 100: ast_previous() node_27884835 50: ast_previous_siblings() node_3b59fe10->node_27884835 node_27884835->node_cb61f460 node_de0608bd 82: ast_siblings() node_de0608bd->node_cb61f460
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_81824f44 File: exports node_11ebcc05 74: _extract() node_3c3f0491 33: _extract_attribute() node_3c3f0491->node_11ebcc05 node_c640b929 37: _extract_binop() node_c640b929->node_11ebcc05 node_d352b3ef 51: _extract_sequence() node_d352b3ef->node_11ebcc05 node_e24c7a32 58: _extract_starred() node_e24c7a32->node_11ebcc05 node_0fc4d2e0 78: get__all__() node_0fc4d2e0->node_11ebcc05 node_7b45f64d 93: safe_get__all__() node_7b45f64d->node_0fc4d2e0
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_c68ef888 File: runtime cluster_a2548ee8 Class: ObjectNode node_da32b202 40: __init__() node_f885161d 230: _pick_member() node_a825c51b 240: alias_target_path() node_323d1c49 24: _same_components() node_a825c51b->node_323d1c49 node_dc4c0f66 138: children() node_dc4c0f66->node_da32b202 node_dc4c0f66->node_f885161d
values.pyΒ€

This module contains utilities for extracting attribute values.

G cluster_e249f458 File: values node_4ac34543 15: get_value() node_8f22cbda 29: safe_get_value() node_8f22cbda->node_4ac34543
visitor.pyΒ€

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

G cluster_1d3b01ab File: visitor cluster_ac4b3618 Class: Visitor node_1985c5ef 121: __init__() node_1985c5ef->node_1985c5ef node_e7a00cae 181: _get_docstring() node_deef5751 292: decorators_to_labels() node_6ba41087 215: generic_visit() node_366313b0 207: visit() node_6ba41087->node_366313b0 node_9a55a50f 310: get_base_property() node_da63aa45 193: get_module() node_da63aa45->node_366313b0 node_e2fb6569 508: handle_attribute() node_e2fb6569->node_e7a00cae node_fb1460fd 334: handle_function() node_fb1460fd->node_e7a00cae node_fb1460fd->node_deef5751 node_fb1460fd->node_6ba41087 node_fb1460fd->node_9a55a50f node_90c340a0 619: visit_annassign() node_90c340a0->node_e2fb6569 node_788fbe9f 611: visit_assign() node_788fbe9f->node_e2fb6569 node_75bc4131 445: visit_asyncfunctiondef() node_75bc4131->node_fb1460fd node_eada731a 246: visit_classdef() node_eada731a->node_e7a00cae node_eada731a->node_deef5751 node_eada731a->node_6ba41087 node_ed0fbf53 437: visit_functiondef() node_ed0fbf53->node_fb1460fd node_8be9736a 648: visit_if() node_8be9736a->node_6ba41087 node_f937b493 224: visit_module() node_f937b493->node_e7a00cae node_f937b493->node_6ba41087 node_5765046c 64: visit() node_5765046c->node_1985c5ef node_5765046c->node_da63aa45

c3linear.pyΒ€

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

G cluster_abd7f82c File: c3linear cluster_d12579f0 Class: _Dependency cluster_eb4db225 Class: _DependencyList node_d1606af5 29: tail() node_55322da8 60: __len__() node_d1606af5->node_55322da8 node_9bd350d4 48: __init__() node_3bd78a38 64: __repr__() node_3bd78a38->node_3bd78a38 node_0776747b 82: remove() node_b31b015c 93: c3linear_merge() node_b31b015c->node_9bd350d4 node_b31b015c->node_0776747b

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_e589f768 File: cli cluster_35567f39 Class: _DebugInfo node_50e73662 51: __init__() node_50e73662->node_50e73662 node_9ec2e7a4 69: _load_packages() node_1195aaf4 59: _print_data() node_8447b921 331: dump() node_8447b921->node_9ec2e7a4 node_8447b921->node_1195aaf4 node_9b98a51d 130: get_parser() node_041a5ec7 564: main() node_041a5ec7->node_9b98a51d

collections.pyΒ€

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

G cluster_66889639 File: collections cluster_966dc3a2 Class: LinesCollection node_72de81bd 56: items() node_72de81bd->node_72de81bd node_c9018307 40: keys() node_c9018307->node_c9018307 node_fe2e7b45 48: values() node_fe2e7b45->node_fe2e7b45

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_9b5bd4d3 File: debug node_9215c92a 80: _get_debug_info() node_b90abd7a 65: _get_version() node_9215c92a->node_b90abd7a node_c2bca9b0 54: _interpreter_name_version() node_9215c92a->node_c2bca9b0 node_d5429407 99: _print_debug_info() node_d5429407->node_9215c92a

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_0a64df69 File: diff cluster_7cf7e3d7 Class: Breakage node_6acf81c4 217: _explain_github() node_856a7f95 160: _format_new_value() node_6acf81c4->node_856a7f95 node_baf0387e 157: _format_old_value() node_6acf81c4->node_baf0387e node_c4e775b5 151: _format_title() node_6acf81c4->node_c4e775b5 node_16d6cf3c 197: _explain_markdown() node_16d6cf3c->node_856a7f95 node_16d6cf3c->node_baf0387e node_848a6b77 163: _explain_oneline() node_457cca32 154: _format_kind() node_848a6b77->node_457cca32 node_6087cab1 148: _format_location() node_848a6b77->node_6087cab1 node_848a6b77->node_856a7f95 node_848a6b77->node_baf0387e node_848a6b77->node_c4e775b5 node_134b1b62 179: _explain_verbose() node_134b1b62->node_457cca32 node_134b1b62->node_6087cab1 node_134b1b62->node_856a7f95 node_134b1b62->node_baf0387e node_134b1b62->node_c4e775b5 node_1bf22b0f 484: _alias_incompatibilities() node_433f6bf6 521: _type_based_yield() node_1bf22b0f->node_433f6bf6 node_91e2672f 473: _attribute_incompatibilities() node_40f4fd26 385: _class_incompatibilities() node_1749016c 500: _member_incompatibilities() node_40f4fd26->node_1749016c node_d306977a 398: _function_incompatibilities() node_f74562b3 558: _returns_are_compatible() node_d306977a->node_f74562b3 node_1749016c->node_433f6bf6 node_433f6bf6->node_91e2672f node_433f6bf6->node_40f4fd26 node_433f6bf6->node_d306977a node_b0c94882 582: find_breaking_changes() node_b0c94882->node_1749016c

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_989f46af File: google node_1efd3f48 487: _annotation_from_parent() node_1da92b86 458: _get_name_annotation_description() node_b8ad76f8 721: _is_empty_line() node_5d16023c 261: _read_attributes_section() node_f30b8393 84: _read_block_items() node_5d16023c->node_f30b8393 node_d959faaf 147: _read_block() node_d959faaf->node_b8ad76f8 node_f30b8393->node_b8ad76f8 node_859fd2f3 445: _read_block_items_maybe() node_859fd2f3->node_d959faaf node_859fd2f3->node_f30b8393 node_6a6e0ae3 332: _read_classes_section() node_6a6e0ae3->node_f30b8393 node_f50bd48f 697: _read_deprecated_section() node_f50bd48f->node_d959faaf node_acd745d1 638: _read_examples_section() node_acd745d1->node_b8ad76f8 node_acd745d1->node_d959faaf node_c00638ca 297: _read_functions_section() node_c00638ca->node_f30b8393 node_987e2830 367: _read_modules_section() node_987e2830->node_f30b8393 node_8be66334 250: _read_other_parameters_section() node_d80092f3 178: _read_parameters() node_8be66334->node_d80092f3 node_d80092f3->node_f30b8393 node_ee14cace 240: _read_parameters_section() node_ee14cace->node_d80092f3 node_7b039856 392: _read_raises_section() node_7b039856->node_f30b8393 node_3c0e7cb8 594: _read_receives_section() node_3c0e7cb8->node_1efd3f48 node_3c0e7cb8->node_1da92b86 node_3c0e7cb8->node_859fd2f3 node_119a7b56 506: _read_returns_section() node_119a7b56->node_1efd3f48 node_119a7b56->node_1da92b86 node_119a7b56->node_859fd2f3 node_bfaa90c6 420: _read_warns_section() node_bfaa90c6->node_f30b8393 node_b47e9ed9 550: _read_yields_section() node_b47e9ed9->node_1efd3f48 node_b47e9ed9->node_1da92b86 node_b47e9ed9->node_859fd2f3 node_729cd272 744: parse_google() node_729cd272->node_b8ad76f8 node_729cd272->node_d959faaf
models.pyΒ€

This module contains the models for storing docstrings structured data.

G cluster_84a5aa29 File: models cluster_967ce2a7 Class: DocstringSection node_8760570a 202: as_dict() node_8760570a->node_8760570a
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_da9f0880 File: numpy node_b080c7e6 723: _append_section() node_811f2948 89: _is_dash_line() node_537289ae 85: _is_empty_line() node_811f2948->node_537289ae node_2fc2b8e5 534: _read_attributes_section() node_201600b1 93: _read_block_items() node_2fc2b8e5->node_201600b1 node_38826ccc 153: _read_block() node_38826ccc->node_811f2948 node_38826ccc->node_537289ae node_201600b1->node_811f2948 node_201600b1->node_537289ae node_ae1c6754 600: _read_classes_section() node_ae1c6754->node_201600b1 node_0ae3e179 316: _read_deprecated_section() node_0ae3e179->node_201600b1 node_e27f5914 660: _read_examples_section() node_e27f5914->node_537289ae node_e27f5914->node_38826ccc node_02b6862d 570: _read_functions_section() node_02b6862d->node_201600b1 node_f42625be 630: _read_modules_section() node_f42625be->node_201600b1 node_c067c30c 300: _read_other_parameters_section() node_390ac78c 215: _read_parameters() node_c067c30c->node_390ac78c node_390ac78c->node_201600b1 node_edc6c8ab 285: _read_parameters_section() node_edc6c8ab->node_390ac78c node_8e60d8bd 488: _read_raises_section() node_8e60d8bd->node_201600b1 node_950ffd24 444: _read_receives_section() node_950ffd24->node_201600b1 node_4dab029d 340: _read_returns_section() node_4dab029d->node_201600b1 node_327f7e4d 511: _read_warns_section() node_327f7e4d->node_201600b1 node_ed1bdab0 396: _read_yields_section() node_ed1bdab0->node_201600b1 node_e94e8c0c 759: parse_numpy() node_e94e8c0c->node_b080c7e6 node_e94e8c0c->node_811f2948 node_e94e8c0c->node_537289ae
parsers.pyΒ€

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

G cluster_4d6638eb File: parsers node_e927a3b1 106: infer_docstring_style() node_bbf9d3b7 214: parse() node_02751bc8 168: parse_auto() node_02751bc8->node_e927a3b1 node_02751bc8->node_bbf9d3b7
sphinx.pyΒ€

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

G cluster_330410a5 File: sphinx cluster_17fa783e Class: _FieldType node_3afc5ee1 49: matches() node_0cfb0fa5 399: _consolidate_continuation_lines() node_d37472b0 412: _consolidate_descriptive_type() node_5eeda422 180: _determine_param_annotation() node_6df5f4d3 173: _determine_param_default() node_51fbd4ed 387: _parse_directive() node_51fbd4ed->node_0cfb0fa5 node_a8a54a58 371: _parsed_values_to_sections() node_d89eb640 416: _strip_blank_lines() node_a8a54a58->node_d89eb640 node_8930f12b 239: _read_attribute() node_8930f12b->node_51fbd4ed node_b560d5bc 281: _read_attribute_type() node_b560d5bc->node_d37472b0 node_b560d5bc->node_51fbd4ed node_fad0b1b7 308: _read_exception() node_fad0b1b7->node_51fbd4ed node_2e34d9f6 122: _read_parameter() node_2e34d9f6->node_5eeda422 node_2e34d9f6->node_6df5f4d3 node_2e34d9f6->node_51fbd4ed node_c2f0d314 212: _read_parameter_type() node_c2f0d314->node_d37472b0 node_c2f0d314->node_51fbd4ed node_43ba62b6 327: _read_return() node_43ba62b6->node_51fbd4ed node_e4862e94 352: _read_return_type() node_e4862e94->node_d37472b0 node_e4862e94->node_51fbd4ed node_263b7524 86: parse_sphinx() node_263b7524->node_3afc5ee1 node_263b7524->node_a8a54a58
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_cb34017e File: encoders cluster_5710cf70 Class: JSONEncoder node_ee9857ab 48: __init__() node_ee9857ab->node_ee9857ab node_c6a07d5b 125: _attach_parent_to_expr() node_14402e7d 135: _attach_parent_to_exprs() node_14402e7d->node_c6a07d5b node_81498e59 211: _load_attribute() node_110a7e09 85: _load_docstring() node_81498e59->node_110a7e09 node_6e3cf828 174: _load_class() node_6e3cf828->node_14402e7d node_cda0cb0d 91: _load_decorators() node_6e3cf828->node_cda0cb0d node_6e3cf828->node_110a7e09 node_47e239dd 95: _load_expression() node_74a4f748 197: _load_function() node_74a4f748->node_cda0cb0d node_74a4f748->node_110a7e09 node_e3303bd0 159: _load_module() node_e3303bd0->node_14402e7d node_e3303bd0->node_110a7e09 node_1ebffb98 115: _load_parameter() node_1ebffb98->node_110a7e09 node_e497c12e 242: json_decoder() node_e497c12e->node_47e239dd node_e497c12e->node_1ebffb98

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_57e3eb8b File: expressions cluster_37095476 Class: Expr cluster_fc46303c Class: ExprAttribute cluster_f1ac82fc Class: ExprBinOp cluster_871da41e Class: ExprBoolOp cluster_c4cd8e8a Class: ExprCall cluster_f9d427f0 Class: ExprCompare cluster_a27e53c5 Class: ExprComprehension cluster_a07ee08b Class: ExprDict cluster_42398df2 Class: ExprDictComp cluster_dcea65a5 Class: ExprExtSlice cluster_14387021 Class: ExprFormatted cluster_7737de98 Class: ExprGeneratorExp cluster_e46cf633 Class: ExprIfExp cluster_22bfd0c5 Class: ExprJoinedStr cluster_0f58ebca Class: ExprKeyword cluster_dc726c33 Class: ExprVarPositional cluster_c3964e5b Class: ExprVarKeyword cluster_a84a2a12 Class: ExprLambda cluster_52113e67 Class: ExprList cluster_c887313a Class: ExprListComp cluster_2d2ce250 Class: ExprNamedExpr cluster_00ab210d Class: ExprSet cluster_bb92ef6c Class: ExprSetComp cluster_02a60cd9 Class: ExprSlice cluster_d55bbca9 Class: ExprSubscript cluster_76da5a5f Class: ExprTuple cluster_eb227eff Class: ExprUnaryOp cluster_946aea53 Class: ExprYield cluster_3b30269d Class: ExprYieldFrom node_64022c0f 98: __iter__() node_ef005ea6 102: iterate() node_64022c0f->node_ef005ea6 node_1eb8217a 95: __str__() node_1eb8217a->node_ef005ea6 node_129bce0d 131: as_dict() node_eec09082 68: _expr_as_dict() node_129bce0d->node_eec09082 node_79614c96 200: append() node_79614c96->node_79614c96 node_51ddaa0d 192: iterate() node_95998dc9 41: _join() node_51ddaa0d->node_95998dc9 node_87a1fd24 245: iterate() node_50283a26 29: _yield() node_87a1fd24->node_50283a26 node_db6d4b36 261: iterate() node_db6d4b36->node_95998dc9 node_965e7542 280: iterate() node_965e7542->node_95998dc9 node_965e7542->node_50283a26 node_2f1b9b26 299: iterate() node_2f1b9b26->node_95998dc9 node_2f1b9b26->node_50283a26 node_c538a162 319: iterate() node_c538a162->node_95998dc9 node_c538a162->node_50283a26 node_3de73f63 353: iterate() node_3de73f63->node_95998dc9 node_f8f4842c 375: iterate() node_f8f4842c->node_95998dc9 node_f8f4842c->node_50283a26 node_a9b9700b 392: iterate() node_a9b9700b->node_95998dc9 node_094e5e7a 404: iterate() node_094e5e7a->node_50283a26 node_1d7de88e 420: iterate() node_1d7de88e->node_95998dc9 node_1d7de88e->node_50283a26 node_4bfef0b0 438: iterate() node_4bfef0b0->node_50283a26 node_0ca15270 454: iterate() node_0ca15270->node_95998dc9 node_181ba546 495: iterate() node_181ba546->node_50283a26 node_01d72c48 537: iterate() node_01d72c48->node_50283a26 node_ff210955 578: iterate() node_ff210955->node_95998dc9 node_50c348c5 594: iterate() node_50c348c5->node_95998dc9 node_50c348c5->node_50283a26 node_809e1482 699: iterate() node_809e1482->node_50283a26 node_33d0e4a5 730: iterate() node_33d0e4a5->node_95998dc9 node_6821cb93 746: iterate() node_6821cb93->node_95998dc9 node_6821cb93->node_50283a26 node_172075e4 766: iterate() node_172075e4->node_50283a26 node_814a0d9d 794: _to_binop() node_814a0d9d->node_814a0d9d node_95a817b9 787: iterate() node_95a817b9->node_50283a26 node_fd738562 809: modernize() node_fd738562->node_814a0d9d node_fd738562->node_fd738562 node_4fe07a5a 845: iterate() node_4fe07a5a->node_95998dc9 node_5bc282b9 869: iterate() node_5bc282b9->node_50283a26 node_3a0b78e0 522: iterate() node_3a0b78e0->node_50283a26 node_05c0f0df 509: iterate() node_05c0f0df->node_50283a26 node_bd25e4da 882: iterate() node_bd25e4da->node_50283a26 node_389bfe66 897: iterate() node_389bfe66->node_50283a26 node_ce2739b1 1226: _build() node_7d89f019 944: _build_attribute() node_7d89f019->node_79614c96 node_7d89f019->node_ce2739b1 node_8d86015e 956: _build_binop() node_8d86015e->node_ce2739b1 node_192b8b97 964: _build_boolop() node_192b8b97->node_ce2739b1 node_7c596cf7 971: _build_call() node_7c596cf7->node_ce2739b1 node_3feb94f6 978: _build_compare() node_3feb94f6->node_ce2739b1 node_86d7a385 986: _build_comprehension() node_86d7a385->node_ce2739b1 node_8e7f5d7d 995: _build_constant() node_8e7f5d7d->node_ce2739b1 node_50a0a6ec 1034: _build_dict() node_50a0a6ec->node_ce2739b1 node_9255c399 1041: _build_dictcomp() node_9255c399->node_ce2739b1 node_9f1d067e 1049: _build_formatted() node_9f1d067e->node_ce2739b1 node_29f2c44a 1059: _build_generatorexp() node_29f2c44a->node_ce2739b1 node_74c6bbbe 1066: _build_ifexp() node_74c6bbbe->node_ce2739b1 node_29633ed6 1074: _build_joinedstr() node_29633ed6->node_ce2739b1 node_2c5cb55c 1084: _build_keyword() node_2c5cb55c->node_ce2739b1 node_f56e5a57 1090: _build_lambda() node_f56e5a57->node_ce2739b1 node_55c14106 1258: safe_get_expression() node_f56e5a57->node_55c14106 node_75f407b1 1107: _build_list() node_75f407b1->node_ce2739b1 node_0b61e9d6 1111: _build_listcomp() node_0b61e9d6->node_ce2739b1 node_512ff263 1119: _build_named_expr() node_512ff263->node_ce2739b1 node_6cc09905 1123: _build_set() node_6cc09905->node_ce2739b1 node_f123a717 1127: _build_setcomp() node_f123a717->node_ce2739b1 node_ee630fa4 1131: _build_slice() node_ee630fa4->node_ce2739b1 node_753e7f78 1139: _build_starred() node_753e7f78->node_ce2739b1 node_cdf998d4 1143: _build_subscript() node_cdf998d4->node_ce2739b1 node_5281b2a3 1172: _build_tuple() node_5281b2a3->node_ce2739b1 node_b424c842 1182: _build_unaryop() node_b424c842->node_ce2739b1 node_7bad827f 1186: _build_yield() node_7bad827f->node_ce2739b1 node_f20288a6 1190: _build_yield_from() node_f20288a6->node_ce2739b1 node_96bdedcf 57: _field_as_dict() node_eec09082->node_96bdedcf node_96bdedcf->node_96bdedcf node_95998dc9->node_50283a26 node_50283a26->node_50283a26 node_8c7e2d63 1230: get_expression() node_8c7e2d63->node_ce2739b1 node_55c14106->node_8c7e2d63

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_62c3a79c File: base cluster_275e17df Class: Extension cluster_b4372ba8 Class: Extensions node_558be70c 56: generic_inspect() node_7fe58859 48: inspect() node_558be70c->node_7fe58859 node_673d40ce 39: generic_visit() node_b15207dc 31: visit() node_673d40ce->node_b15207dc node_4fef1a2d 287: __init__() node_d4a8f85f 296: add() node_4fef1a2d->node_d4a8f85f node_a692513e 333: _load_extension() node_78c4d93e 322: _load_extension_path() node_a692513e->node_78c4d93e node_721af017 424: load_extensions() node_721af017->node_4fef1a2d node_721af017->node_d4a8f85f node_721af017->node_a692513e
dataclasses.pyΒ€

Built-in extension adding support for dataclasses.

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

G cluster_3869b60a File: dataclasses cluster_c8a57f0b Class: DataclassesExtension node_ebe3868c 227: on_package_loaded() node_b0bfa27e 203: _apply_recursively() node_ebe3868c->node_b0bfa27e node_b0bfa27e->node_b0bfa27e node_7bc9321d 195: _del_members_annotated_as_initvar() node_b0bfa27e->node_7bc9321d node_a143ea3a 157: _set_dataclass_init() node_b0bfa27e->node_a143ea3a node_42718e69 49: _dataclass_arguments() node_de33f951 25: _dataclass_decorator() node_42718e69->node_de33f951 node_87b869ac 32: _expr_args() node_42718e69->node_87b869ac node_0b9170c0 66: _dataclass_parameters() node_0b9170c0->node_42718e69 node_ac610d2b 55: _field_arguments() node_0b9170c0->node_ac610d2b node_87b869ac->node_87b869ac node_ac610d2b->node_87b869ac node_5e5ba371 139: _reorder_parameters() node_a143ea3a->node_de33f951 node_a143ea3a->node_0b9170c0 node_a143ea3a->node_5e5ba371

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_69e7dbc3 File: finder cluster_cd967178 Class: ModuleFinder node_adc1f726 102: __init__() node_09a9d6a2 387: _extend_from_pth_files() node_adc1f726->node_09a9d6a2 node_7d97c0c9 119: append_search_path() node_adc1f726->node_7d97c0c9 node_23dc5df1 375: _contents() node_09a9d6a2->node_23dc5df1 node_09a9d6a2->node_7d97c0c9 node_c600fe00 443: _handle_pth_file() node_09a9d6a2->node_c600fe00 node_b5a43c93 396: _filter_py_modules() node_0c8f84d7 360: _module_name_path() node_0faa3ec2 404: _top_module_name() node_ddaea5a1 132: insert_search_path() node_0faa3ec2->node_ddaea5a1 node_1b7c8d09 229: find_package() node_1b7c8d09->node_23dc5df1 node_d3e7676c 428: _is_pkg_style_namespace() node_1b7c8d09->node_d3e7676c node_9430c0b6 146: find_spec() node_9430c0b6->node_0c8f84d7 node_9430c0b6->node_0faa3ec2 node_9430c0b6->node_1b7c8d09 node_d13491ee 277: iter_submodules() node_d13491ee->node_b5a43c93 node_d13491ee->node_d13491ee node_5e74f2fb 343: submodules() node_5e74f2fb->node_d13491ee node_ff954c0c 473: _handle_editable_module() node_19c6f7db 51: _match_pattern() node_ff954c0c->node_19c6f7db node_c600fe00->node_ff954c0c

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_5fe5e750 File: git node_cb9e0e56 25: _normalize() node_fa7980ab 31: assert_git_repo() node_61fc2180 102: tmp_worktree() node_61fc2180->node_cb9e0e56 node_61fc2180->node_fa7980ab

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_facce80c File: importer node_b4a2822f 17: _error_details() node_f2f93c5e 43: dynamic_import() node_f2f93c5e->node_b4a2822f node_d8ad4f88 22: sys_path() node_f2f93c5e->node_d8ad4f88

loader.pyΒ€

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

G cluster_89bf4d28 File: loader cluster_e5eb4d49 Class: GriffeLoader node_ffa7fa04 53: __init__() node_3f2d0001 630: _create_module() node_e53fe847 713: _expand_wildcard() node_3285b26d 683: _get_or_create_parent_module() node_3285b26d->node_3f2d0001 node_28989363 658: _inspect_module() node_a27f0f24 533: _load_module() node_9b2677ef 552: _load_module_path() node_a27f0f24->node_9b2677ef node_9b2677ef->node_3f2d0001 node_9b2677ef->node_28989363 node_98dd8d43 575: _load_submodules() node_9b2677ef->node_98dd8d43 node_a24aba25 638: _visit_module() node_9b2677ef->node_a24aba25 node_eb9cab49 517: _load_package() node_eb9cab49->node_a27f0f24 node_03a9f3d7 313: expand_wildcards() node_eb9cab49->node_03a9f3d7 node_70effd9c 579: _load_submodule() node_70effd9c->node_3285b26d node_70effd9c->node_a27f0f24 node_98dd8d43->node_70effd9c node_5804bba8 193: _post_load() node_01efacc7 274: expand_exports() node_5804bba8->node_01efacc7 node_5804bba8->node_03a9f3d7 node_01efacc7->node_01efacc7 node_03a9f3d7->node_e53fe847 node_03a9f3d7->node_03a9f3d7 node_dbba8898 101: load() node_03a9f3d7->node_dbba8898 node_dbba8898->node_28989363 node_dbba8898->node_eb9cab49 node_dbba8898->node_5804bba8 node_5f193660 220: resolve_aliases() node_5f193660->node_03a9f3d7 node_9cd5dbb8 428: resolve_module_aliases() node_5f193660->node_9cd5dbb8 node_9cd5dbb8->node_dbba8898 node_9cd5dbb8->node_9cd5dbb8 node_bf52bbf9 722: load() node_bf52bbf9->node_ffa7fa04 node_bf52bbf9->node_dbba8898 node_bf52bbf9->node_5f193660 node_dea50423 827: load_git() node_dea50423->node_bf52bbf9 node_4c2d61c2 912: load_pypi() node_4c2d61c2->node_bf52bbf9

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_20ab4b4e File: logger cluster_ed2fdb6b Class: Logger node_041bfabd 0: (global)() node_220cff02 43: _get() node_041bfabd->node_220cff02 node_f80b89be 49: _patch_loggers() node_da9c9409 93: get_logger() node_da9c9409->node_220cff02 node_597f1221 105: patch_loggers() node_597f1221->node_f80b89be

merger.pyΒ€

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

G cluster_efe6c9fd File: merger node_3478e475 35: _merge_attribute_stubs() node_4106faa4 40: _merge_stubs_docstring() node_3478e475->node_4106faa4 node_039ee781 21: _merge_class_stubs() node_039ee781->node_4106faa4 node_803a88ac 53: _merge_stubs_members() node_039ee781->node_803a88ac node_f6aa81b8 45: _merge_stubs_overloads() node_039ee781->node_f6aa81b8 node_f08dcb3c 27: _merge_function_stubs() node_f08dcb3c->node_4106faa4 node_5f163bc9 15: _merge_module_stubs() node_5f163bc9->node_4106faa4 node_5f163bc9->node_803a88ac node_5f163bc9->node_f6aa81b8 node_803a88ac->node_3478e475 node_803a88ac->node_f08dcb3c node_18ab9dbc 87: merge_stubs() node_18ab9dbc->node_5f163bc9

mixins.pyΒ€

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

G cluster_e91460a8 File: mixins cluster_a1679f06 Class: GetMembersMixin cluster_26367754 Class: DelMembersMixin cluster_1e6e86e6 Class: SetMembersMixin node_70af442a 97: __delitem__() node_90514409 22: _get_parts() node_70af442a->node_90514409 node_dd97cf5d 124: del_member() node_dd97cf5d->node_dd97cf5d node_dd97cf5d->node_90514409 node_dbf1e952 42: __getitem__() node_dbf1e952->node_90514409 node_59279929 64: get_member() node_59279929->node_59279929 node_59279929->node_90514409 node_1cebd37e 157: __setitem__() node_1cebd37e->node_90514409 node_4b15cb8c 183: set_member() node_4b15cb8c->node_4b15cb8c node_4b15cb8c->node_90514409

models.pyΒ€

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

G cluster_8b9e91d8 File: models cluster_24779757 Class: Docstring cluster_b1ec6bb1 Class: Parameter cluster_fa5f400b Class: Parameters cluster_03534131 Class: Object cluster_fb97eb75 Class: Alias cluster_e043c24e Class: Class cluster_725ef51f Class: Function node_0c0819af 877: __init__() node_80013c97 1453: _update_target_aliases() node_0c0819af->node_80013c97 node_d839ece2 1437: _resolve_target() node_608d5888 1408: resolve_target() node_d839ece2->node_608d5888 node_2320013a 1032: as_json() node_2320013a->node_2320013a node_53e3b66a 1157: filter_members() node_53e3b66a->node_53e3b66a node_ea28bc1b 1146: has_labels() node_ea28bc1b->node_ea28bc1b node_64ec6ff8 1012: inherited_members() node_64ec6ff8->node_0c0819af node_4227c090 1112: is_kind() node_4227c090->node_4227c090 node_2026aa59 998: members() node_2026aa59->node_0c0819af node_0e5cb9cf 982: parent() node_0e5cb9cf->node_80013c97 node_7d3bedad 1234: resolve() node_7d3bedad->node_7d3bedad node_01bfd4f8 1367: target() node_01bfd4f8->node_608d5888 node_0fd30496 1662: _mro() node_0fd30496->node_0fd30496 node_93aba81a 1673: mro() node_93aba81a->node_0fd30496 node_af4f7239 1630: parameters() node_e438a2fb 263: __init__() node_af4f7239->node_e438a2fb node_046b874d 128: parse() node_1f42777b 124: parsed() node_1f42777b->node_046b874d node_19a449a1 1697: __init__() node_19a449a1->node_e438a2fb node_2170a51d 510: inherited_members() node_2170a51d->node_0c0819af node_a3596b32 786: resolve() node_a3596b32->node_a3596b32 node_9a549c72 231: as_dict() node_9a549c72->node_9a549c72

stats.pyΒ€

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

G cluster_e45a4431 File: stats cluster_0fc2c1fb Class: Stats node_c5b9d763 20: __init__() node_5050e6d4 73: _itercount() node_c5b9d763->node_5050e6d4 node_5050e6d4->node_5050e6d4

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_c9a65241 File: tests node_977d6841 396: module_vtree() node_4d937215 353: vtree() node_977d6841->node_4d937215 node_9ec35b30 302: temporary_inspected_module() node_e5517308 53: temporary_pyfile() node_9ec35b30->node_e5517308 node_b195165c 185: temporary_inspected_package() node_a8884ac1 71: temporary_pypackage() node_b195165c->node_a8884ac1 node_fad0180d 256: temporary_visited_module() node_fad0180d->node_e5517308 node_57b1b15e 120: temporary_visited_package() node_57b1b15e->node_a8884ac1