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_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_89a370b1 File: inspector cluster_8932d0c4 Class: Inspector node_2e217774 100: __init__() node_2e217774->node_2e217774 node_16173a18 152: _get_docstring() node_6d6d05ce 174: _get_linenos() node_16669357 240: generic_inspect() node_16669357->node_2e217774 node_795fa2ac 232: inspect() node_16669357->node_795fa2ac node_467ba5cf 277: inspect_module() node_16669357->node_467ba5cf node_40e97838 184: get_module() node_40e97838->node_795fa2ac node_a7dd2c55 477: handle_attribute() node_a7dd2c55->node_16173a18 node_8805292a 411: handle_function() node_8805292a->node_16173a18 node_8805292a->node_6d6d05ce node_4d2396c8 550: _convert_object_to_annotation() node_8805292a->node_4d2396c8 node_f575f522 534: _convert_parameter() node_8805292a->node_f575f522 node_a440c2d6 469: inspect_attribute() node_a440c2d6->node_a7dd2c55 node_f1dc3355 379: inspect_builtin_function() node_f1dc3355->node_8805292a node_b4dfba99 355: inspect_builtin_method() node_b4dfba99->node_8805292a node_d2baec5f 395: inspect_cached_property() node_d2baec5f->node_8805292a node_aab3b868 299: inspect_class() node_aab3b868->node_16173a18 node_aab3b868->node_6d6d05ce node_aab3b868->node_16669357 node_95a9f6e6 339: inspect_classmethod() node_95a9f6e6->node_8805292a node_9ea8d6fd 371: inspect_coroutine() node_9ea8d6fd->node_8805292a node_640977e3 387: inspect_function() node_640977e3->node_8805292a node_a62565dd 363: inspect_method() node_a62565dd->node_8805292a node_78482c09 347: inspect_method_descriptor() node_78482c09->node_8805292a node_467ba5cf->node_16173a18 node_1d3bd1de 403: inspect_property() node_1d3bd1de->node_8805292a node_e378076b 331: inspect_staticmethod() node_e378076b->node_8805292a node_f575f522->node_4d2396c8 node_7c954208 32: inspect() node_7c954208->node_2e217774 node_7c954208->node_40e97838
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_bf54f440 File: assignments node_ba65c1ae 40: _get_annassign_names() node_0342ce27 23: get_name() node_ba65c1ae->node_0342ce27 node_3bcb2f11 35: _get_assign_names() node_3bcb2f11->node_0342ce27 node_ad586cc8 9: _get_attribute_name() node_ad586cc8->node_0342ce27 node_85326446 63: get_instance_names() node_1cdd5ef7 51: get_names() node_85326446->node_1cdd5ef7
ast.pyΒ€

This module contains utilities for navigating AST nodes.

G cluster_b2f4dc50 File: ast node_ed41b1bf 26: ast_children() node_6f445acd 137: ast_first_child() node_6f445acd->node_ed41b1bf node_59cc166e 155: ast_last_child() node_59cc166e->node_ed41b1bf node_9633f9e0 119: ast_next() node_76c539d7 66: ast_next_siblings() node_9633f9e0->node_76c539d7 node_76c539d7->node_ed41b1bf node_690c0949 100: ast_previous() node_1b214c2b 50: ast_previous_siblings() node_690c0949->node_1b214c2b node_1b214c2b->node_ed41b1bf node_96aa1bf8 82: ast_siblings() node_96aa1bf8->node_ed41b1bf
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_db39aa93 File: exports node_83a1c055 74: _extract() node_1733803e 33: _extract_attribute() node_1733803e->node_83a1c055 node_c2539ad9 37: _extract_binop() node_c2539ad9->node_83a1c055 node_4e07e26c 51: _extract_sequence() node_4e07e26c->node_83a1c055 node_3cfb0fb0 58: _extract_starred() node_3cfb0fb0->node_83a1c055 node_61a28620 78: get__all__() node_61a28620->node_83a1c055 node_2e7d1f1c 93: safe_get__all__() node_2e7d1f1c->node_61a28620
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_12bb20c5 File: runtime cluster_602946e1 Class: ObjectNode node_1b18ac78 40: __init__() node_5f438e22 230: _pick_member() node_7b0c0126 240: alias_target_path() node_36993a51 24: _same_components() node_7b0c0126->node_36993a51 node_1be0f106 138: children() node_1be0f106->node_1b18ac78 node_1be0f106->node_5f438e22
values.pyΒ€

This module contains utilities for extracting attribute values.

G cluster_4a2c3319 File: values node_249e30c9 15: get_value() node_4e9065e9 29: safe_get_value() node_4e9065e9->node_249e30c9
visitor.pyΒ€

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

G cluster_d7e2ae42 File: visitor cluster_c1b622cf Class: Visitor node_b0ff11f3 121: __init__() node_b0ff11f3->node_b0ff11f3 node_5b0c7d30 181: _get_docstring() node_c577ece1 292: decorators_to_labels() node_0e2b5782 215: generic_visit() node_ab6b44ff 207: visit() node_0e2b5782->node_ab6b44ff node_51da81aa 310: get_base_property() node_36de9bb1 193: get_module() node_36de9bb1->node_ab6b44ff node_9a55b74d 508: handle_attribute() node_9a55b74d->node_5b0c7d30 node_6d06ddcf 334: handle_function() node_6d06ddcf->node_5b0c7d30 node_6d06ddcf->node_c577ece1 node_6d06ddcf->node_0e2b5782 node_6d06ddcf->node_51da81aa node_1ad88f54 619: visit_annassign() node_1ad88f54->node_9a55b74d node_a4e48939 611: visit_assign() node_a4e48939->node_9a55b74d node_4a1d2700 445: visit_asyncfunctiondef() node_4a1d2700->node_6d06ddcf node_57c85624 246: visit_classdef() node_57c85624->node_5b0c7d30 node_57c85624->node_c577ece1 node_57c85624->node_0e2b5782 node_66f492c4 437: visit_functiondef() node_66f492c4->node_6d06ddcf node_4873263a 648: visit_if() node_4873263a->node_0e2b5782 node_a6a857e0 224: visit_module() node_a6a857e0->node_5b0c7d30 node_a6a857e0->node_0e2b5782 node_8efccd24 64: visit() node_8efccd24->node_b0ff11f3 node_8efccd24->node_36de9bb1

c3linear.pyΒ€

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

G cluster_b8261161 File: c3linear cluster_76dc8287 Class: _Dependency cluster_23024c2b Class: _DependencyList node_bf79a0bc 29: tail() node_7df7d3b4 60: __len__() node_bf79a0bc->node_7df7d3b4 node_9f6a082b 48: __init__() node_43a22215 64: __repr__() node_43a22215->node_43a22215 node_1b2c1363 82: remove() node_f4cf03a5 93: c3linear_merge() node_f4cf03a5->node_9f6a082b node_f4cf03a5->node_1b2c1363

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_83dd9585 File: cli cluster_d0337560 Class: _DebugInfo node_1cd9d431 51: __init__() node_1cd9d431->node_1cd9d431 node_80274102 69: _load_packages() node_1ffb0ed6 59: _print_data() node_2cf70f2d 331: dump() node_2cf70f2d->node_80274102 node_2cf70f2d->node_1ffb0ed6 node_6b92ab6a 130: get_parser() node_7bd176ba 575: main() node_7bd176ba->node_6b92ab6a

collections.pyΒ€

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

G cluster_7e4a34f2 File: collections cluster_2eefa668 Class: LinesCollection node_a405c329 56: items() node_a405c329->node_a405c329 node_42db0d5d 40: keys() node_42db0d5d->node_42db0d5d node_ed205e81 48: values() node_ed205e81->node_ed205e81

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_ee958231 File: debug node_3eba6996 80: _get_debug_info() node_3bc119d7 65: _get_version() node_3eba6996->node_3bc119d7 node_22114fea 54: _interpreter_name_version() node_3eba6996->node_22114fea node_0668d8c2 99: _print_debug_info() node_0668d8c2->node_3eba6996

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_56e5fff1 File: diff cluster_bb598136 Class: Breakage node_37f10906 217: _explain_github() node_691b09d4 160: _format_new_value() node_37f10906->node_691b09d4 node_7bd93891 157: _format_old_value() node_37f10906->node_7bd93891 node_5191632c 151: _format_title() node_37f10906->node_5191632c node_94c8840f 197: _explain_markdown() node_94c8840f->node_691b09d4 node_94c8840f->node_7bd93891 node_0bf72c1c 163: _explain_oneline() node_6e966345 154: _format_kind() node_0bf72c1c->node_6e966345 node_d42d3c0a 148: _format_location() node_0bf72c1c->node_d42d3c0a node_0bf72c1c->node_691b09d4 node_0bf72c1c->node_7bd93891 node_0bf72c1c->node_5191632c node_17cf59e1 179: _explain_verbose() node_17cf59e1->node_6e966345 node_17cf59e1->node_d42d3c0a node_17cf59e1->node_691b09d4 node_17cf59e1->node_7bd93891 node_17cf59e1->node_5191632c node_77798745 508: _alias_incompatibilities() node_e850097e 545: _type_based_yield() node_77798745->node_e850097e node_beb0016f 497: _attribute_incompatibilities() node_888d71f7 409: _class_incompatibilities() node_3c1fb83d 524: _member_incompatibilities() node_888d71f7->node_3c1fb83d node_78e81827 422: _function_incompatibilities() node_8be8a131 582: _returns_are_compatible() node_78e81827->node_8be8a131 node_3c1fb83d->node_e850097e node_e850097e->node_beb0016f node_e850097e->node_888d71f7 node_e850097e->node_78e81827 node_d160816f 606: find_breaking_changes() node_d160816f->node_3c1fb83d

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_6ceec863 File: google node_af8a7c17 485: _annotation_from_parent() node_6429c835 456: _get_name_annotation_description() node_c52cb809 695: _is_empty_line() node_cc3f393f 259: _read_attributes_section() node_a324aacd 83: _read_block_items() node_cc3f393f->node_a324aacd node_0bfcf7bf 146: _read_block() node_0bfcf7bf->node_c52cb809 node_a324aacd->node_c52cb809 node_3a77eb15 443: _read_block_items_maybe() node_3a77eb15->node_0bfcf7bf node_3a77eb15->node_a324aacd node_c08ef4ff 330: _read_classes_section() node_c08ef4ff->node_a324aacd node_ea23fedc 636: _read_examples_section() node_ea23fedc->node_c52cb809 node_ea23fedc->node_0bfcf7bf node_c66a78fa 295: _read_functions_section() node_c66a78fa->node_a324aacd node_d12bf88e 365: _read_modules_section() node_d12bf88e->node_a324aacd node_95f3a0a8 248: _read_other_parameters_section() node_ee61eb1e 177: _read_parameters() node_95f3a0a8->node_ee61eb1e node_ee61eb1e->node_a324aacd node_0aefb76c 238: _read_parameters_section() node_0aefb76c->node_ee61eb1e node_9789c58d 390: _read_raises_section() node_9789c58d->node_a324aacd node_94ef7c28 592: _read_receives_section() node_94ef7c28->node_af8a7c17 node_94ef7c28->node_6429c835 node_94ef7c28->node_3a77eb15 node_2fa364de 504: _read_returns_section() node_2fa364de->node_af8a7c17 node_2fa364de->node_6429c835 node_2fa364de->node_3a77eb15 node_6194600f 418: _read_warns_section() node_6194600f->node_a324aacd node_42275f73 548: _read_yields_section() node_42275f73->node_af8a7c17 node_42275f73->node_6429c835 node_42275f73->node_3a77eb15 node_42ed1427 717: parse_google() node_42ed1427->node_c52cb809 node_42ed1427->node_0bfcf7bf
models.pyΒ€

This module contains the models for storing docstrings structured data.

G cluster_5df70972 File: models cluster_047b2dd0 Class: DocstringSection node_ac773ae4 202: as_dict() node_ac773ae4->node_ac773ae4
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_31b0d33d File: numpy node_237b26f0 724: _append_section() node_418b7167 89: _is_dash_line() node_2834f68d 85: _is_empty_line() node_418b7167->node_2834f68d node_3387fab2 534: _read_attributes_section() node_a9988904 93: _read_block_items() node_3387fab2->node_a9988904 node_18b8ffa4 153: _read_block() node_18b8ffa4->node_418b7167 node_18b8ffa4->node_2834f68d node_a9988904->node_418b7167 node_a9988904->node_2834f68d node_7c142fbf 601: _read_classes_section() node_7c142fbf->node_a9988904 node_fe3f0d1e 316: _read_deprecated_section() node_fe3f0d1e->node_a9988904 node_2bd49b48 661: _read_examples_section() node_2bd49b48->node_2834f68d node_2bd49b48->node_18b8ffa4 node_ec1a0024 571: _read_functions_section() node_ec1a0024->node_a9988904 node_815c9544 631: _read_modules_section() node_815c9544->node_a9988904 node_7aeebd22 300: _read_other_parameters_section() node_e3bab736 215: _read_parameters() node_7aeebd22->node_e3bab736 node_e3bab736->node_a9988904 node_fe982886 285: _read_parameters_section() node_fe982886->node_e3bab736 node_08d102f0 488: _read_raises_section() node_08d102f0->node_a9988904 node_c2147b68 444: _read_receives_section() node_c2147b68->node_a9988904 node_735423c0 340: _read_returns_section() node_735423c0->node_a9988904 node_3e5b675f 511: _read_warns_section() node_3e5b675f->node_a9988904 node_ee7839b5 396: _read_yields_section() node_ee7839b5->node_a9988904 node_9b0d79ce 760: parse_numpy() node_9b0d79ce->node_237b26f0 node_9b0d79ce->node_418b7167 node_9b0d79ce->node_2834f68d
parsers.pyΒ€

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

G cluster_56b0725a File: parsers node_525f0270 107: infer_docstring_style() node_41de3d74 239: parse() node_db7c5336 180: parse_auto() node_db7c5336->node_525f0270 node_db7c5336->node_41de3d74
sphinx.pyΒ€

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

G cluster_2eb5efec File: sphinx cluster_730dfe70 Class: _FieldType node_d37e154c 49: matches() node_765895cf 400: _consolidate_continuation_lines() node_80797949 413: _consolidate_descriptive_type() node_3c9da37c 180: _determine_param_annotation() node_a107bced 173: _determine_param_default() node_5debb9a5 388: _parse_directive() node_5debb9a5->node_765895cf node_a1c150b1 372: _parsed_values_to_sections() node_1a81f0e6 417: _strip_blank_lines() node_a1c150b1->node_1a81f0e6 node_8482474a 239: _read_attribute() node_8482474a->node_5debb9a5 node_d7d6b671 282: _read_attribute_type() node_d7d6b671->node_80797949 node_d7d6b671->node_5debb9a5 node_0cda8b55 309: _read_exception() node_0cda8b55->node_5debb9a5 node_5df4484f 122: _read_parameter() node_5df4484f->node_3c9da37c node_5df4484f->node_a107bced node_5df4484f->node_5debb9a5 node_cc802753 212: _read_parameter_type() node_cc802753->node_80797949 node_cc802753->node_5debb9a5 node_1d5c0281 328: _read_return() node_1d5c0281->node_5debb9a5 node_80c0f00c 353: _read_return_type() node_80c0f00c->node_80797949 node_80c0f00c->node_5debb9a5 node_8eb3b3ab 86: parse_sphinx() node_8eb3b3ab->node_d37e154c node_8eb3b3ab->node_a1c150b1
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_3e661285 File: encoders cluster_3916faa7 Class: JSONEncoder node_54e0c5b3 48: __init__() node_54e0c5b3->node_54e0c5b3 node_d544b153 125: _attach_parent_to_expr() node_0370116f 135: _attach_parent_to_exprs() node_0370116f->node_d544b153 node_6e2f7606 211: _load_attribute() node_780325dd 85: _load_docstring() node_6e2f7606->node_780325dd node_75a04c42 174: _load_class() node_75a04c42->node_0370116f node_2645e088 91: _load_decorators() node_75a04c42->node_2645e088 node_75a04c42->node_780325dd node_400aa4c2 95: _load_expression() node_373125ec 197: _load_function() node_373125ec->node_2645e088 node_373125ec->node_780325dd node_6070a092 159: _load_module() node_6070a092->node_0370116f node_6070a092->node_780325dd node_f19e2aa8 115: _load_parameter() node_f19e2aa8->node_780325dd node_f2d635e3 242: json_decoder() node_f2d635e3->node_400aa4c2 node_f2d635e3->node_f19e2aa8

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_81ffd8fc File: expressions cluster_001540d0 Class: Expr cluster_e9c69de4 Class: ExprAttribute cluster_578b5e75 Class: ExprBinOp cluster_6882f230 Class: ExprBoolOp cluster_7b1ca021 Class: ExprCall cluster_e5590f1a Class: ExprCompare cluster_9badd6d8 Class: ExprComprehension cluster_e18dec48 Class: ExprDict cluster_aba56cf9 Class: ExprDictComp cluster_e2d079b5 Class: ExprExtSlice cluster_da9b702d Class: ExprFormatted cluster_19c7c9aa Class: ExprGeneratorExp cluster_0958d8df Class: ExprIfExp cluster_62dadc9a Class: ExprJoinedStr cluster_2062b9c1 Class: ExprKeyword cluster_b8685955 Class: ExprVarPositional cluster_e5a7cbe2 Class: ExprVarKeyword cluster_8288ee4f Class: ExprLambda cluster_97f9b4d1 Class: ExprList cluster_18c4bfad Class: ExprListComp cluster_c6d2b613 Class: ExprNamedExpr cluster_cec55514 Class: ExprSet cluster_aad6b2d4 Class: ExprSetComp cluster_0ad04c40 Class: ExprSlice cluster_084e66fe Class: ExprSubscript cluster_0545dee6 Class: ExprTuple cluster_b0fa8d4e Class: ExprUnaryOp cluster_eff09d59 Class: ExprYield cluster_16fbda2b Class: ExprYieldFrom node_e4a41972 98: __iter__() node_cd1f5199 102: iterate() node_e4a41972->node_cd1f5199 node_add7bb96 95: __str__() node_add7bb96->node_cd1f5199 node_61b28e1e 131: as_dict() node_a4c53f90 68: _expr_as_dict() node_61b28e1e->node_a4c53f90 node_dc475501 200: append() node_dc475501->node_dc475501 node_02060e8a 192: iterate() node_a14c6788 41: _join() node_02060e8a->node_a14c6788 node_5415212f 245: iterate() node_453de4b9 29: _yield() node_5415212f->node_453de4b9 node_7caf9c0f 261: iterate() node_7caf9c0f->node_a14c6788 node_a80a8d91 280: iterate() node_a80a8d91->node_a14c6788 node_a80a8d91->node_453de4b9 node_2774e54f 299: iterate() node_2774e54f->node_a14c6788 node_2774e54f->node_453de4b9 node_3c040cfd 319: iterate() node_3c040cfd->node_a14c6788 node_3c040cfd->node_453de4b9 node_76b059be 353: iterate() node_76b059be->node_a14c6788 node_26d97df8 375: iterate() node_26d97df8->node_a14c6788 node_26d97df8->node_453de4b9 node_9ea7eced 392: iterate() node_9ea7eced->node_a14c6788 node_6102344d 404: iterate() node_6102344d->node_453de4b9 node_f170a3df 420: iterate() node_f170a3df->node_a14c6788 node_f170a3df->node_453de4b9 node_9e2429e4 438: iterate() node_9e2429e4->node_453de4b9 node_2d1b29f3 454: iterate() node_2d1b29f3->node_a14c6788 node_76269457 495: iterate() node_76269457->node_453de4b9 node_bf194f79 537: iterate() node_bf194f79->node_453de4b9 node_b308f844 578: iterate() node_b308f844->node_a14c6788 node_20dc5fcb 594: iterate() node_20dc5fcb->node_a14c6788 node_20dc5fcb->node_453de4b9 node_f4d5a1d2 699: iterate() node_f4d5a1d2->node_453de4b9 node_e1be7c79 730: iterate() node_e1be7c79->node_a14c6788 node_239bb962 746: iterate() node_239bb962->node_a14c6788 node_239bb962->node_453de4b9 node_853ff304 766: iterate() node_853ff304->node_453de4b9 node_d1d71613 794: _to_binop() node_d1d71613->node_d1d71613 node_6f09eb63 787: iterate() node_6f09eb63->node_453de4b9 node_69185a67 809: modernize() node_69185a67->node_d1d71613 node_69185a67->node_69185a67 node_569bba24 845: iterate() node_569bba24->node_a14c6788 node_637d5811 871: iterate() node_637d5811->node_453de4b9 node_fe84c8c2 522: iterate() node_fe84c8c2->node_453de4b9 node_dd224e91 509: iterate() node_dd224e91->node_453de4b9 node_ac5efd72 884: iterate() node_ac5efd72->node_453de4b9 node_1f01d2b2 899: iterate() node_1f01d2b2->node_453de4b9 node_1569de8f 1228: _build() node_68bcbd3c 946: _build_attribute() node_68bcbd3c->node_dc475501 node_68bcbd3c->node_1569de8f node_d66d737e 958: _build_binop() node_d66d737e->node_1569de8f node_e7997b73 966: _build_boolop() node_e7997b73->node_1569de8f node_e3ed2bf3 973: _build_call() node_e3ed2bf3->node_1569de8f node_31d93f8a 980: _build_compare() node_31d93f8a->node_1569de8f node_f7434b58 988: _build_comprehension() node_f7434b58->node_1569de8f node_8e7c19bf 997: _build_constant() node_8e7c19bf->node_1569de8f node_9212c7d5 1036: _build_dict() node_9212c7d5->node_1569de8f node_ab8fa6d6 1043: _build_dictcomp() node_ab8fa6d6->node_1569de8f node_3b4e8922 1051: _build_formatted() node_3b4e8922->node_1569de8f node_70aef9cf 1061: _build_generatorexp() node_70aef9cf->node_1569de8f node_aa7b69d4 1068: _build_ifexp() node_aa7b69d4->node_1569de8f node_2bbcca38 1076: _build_joinedstr() node_2bbcca38->node_1569de8f node_dd0d2c57 1086: _build_keyword() node_dd0d2c57->node_1569de8f node_e77bf66c 1092: _build_lambda() node_e77bf66c->node_1569de8f node_5860cd52 1260: safe_get_expression() node_e77bf66c->node_5860cd52 node_6ddd96cd 1109: _build_list() node_6ddd96cd->node_1569de8f node_056d06d5 1113: _build_listcomp() node_056d06d5->node_1569de8f node_c46e95b0 1121: _build_named_expr() node_c46e95b0->node_1569de8f node_35a1417e 1125: _build_set() node_35a1417e->node_1569de8f node_6e748ed1 1129: _build_setcomp() node_6e748ed1->node_1569de8f node_33d981f9 1133: _build_slice() node_33d981f9->node_1569de8f node_300dedc2 1141: _build_starred() node_300dedc2->node_1569de8f node_bbd628ab 1145: _build_subscript() node_bbd628ab->node_1569de8f node_26f6af09 1174: _build_tuple() node_26f6af09->node_1569de8f node_d9053045 1184: _build_unaryop() node_d9053045->node_1569de8f node_e1762cbb 1188: _build_yield() node_e1762cbb->node_1569de8f node_1f1aa21e 1192: _build_yield_from() node_1f1aa21e->node_1569de8f node_5396122a 57: _field_as_dict() node_a4c53f90->node_5396122a node_5396122a->node_5396122a node_a14c6788->node_453de4b9 node_453de4b9->node_453de4b9 node_24020eaf 1232: get_expression() node_24020eaf->node_1569de8f node_5860cd52->node_24020eaf

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_5a7fd9b3 File: base cluster_e53c34d5 Class: Extension cluster_1d614508 Class: Extensions node_b2d56ce8 56: generic_inspect() node_5658c787 48: inspect() node_b2d56ce8->node_5658c787 node_24021047 39: generic_visit() node_f8bc9116 31: visit() node_24021047->node_f8bc9116 node_5328f1dc 287: __init__() node_ca9ede05 296: add() node_5328f1dc->node_ca9ede05 node_111cb4a6 333: _load_extension() node_cb1e0c03 322: _load_extension_path() node_111cb4a6->node_cb1e0c03 node_5b1a68c0 424: load_extensions() node_5b1a68c0->node_5328f1dc node_5b1a68c0->node_ca9ede05 node_5b1a68c0->node_111cb4a6
dataclasses.pyΒ€

Built-in extension adding support for dataclasses.

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

G cluster_ea428380 File: dataclasses cluster_71b220bb Class: DataclassesExtension node_152217c2 227: on_package_loaded() node_b5b57bae 203: _apply_recursively() node_152217c2->node_b5b57bae node_b5b57bae->node_b5b57bae node_d85b1e97 195: _del_members_annotated_as_initvar() node_b5b57bae->node_d85b1e97 node_b933ea98 157: _set_dataclass_init() node_b5b57bae->node_b933ea98 node_475b078b 49: _dataclass_arguments() node_0c41524e 25: _dataclass_decorator() node_475b078b->node_0c41524e node_d07360e6 32: _expr_args() node_475b078b->node_d07360e6 node_312cee45 66: _dataclass_parameters() node_312cee45->node_475b078b node_552ea71d 55: _field_arguments() node_312cee45->node_552ea71d node_d07360e6->node_d07360e6 node_552ea71d->node_d07360e6 node_ed5ea7f3 139: _reorder_parameters() node_b933ea98->node_0c41524e node_b933ea98->node_312cee45 node_b933ea98->node_ed5ea7f3

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_0d9df275 File: finder cluster_e7cc3c3a Class: ModuleFinder node_fc74cf6e 102: __init__() node_f57d5179 386: _extend_from_pth_files() node_fc74cf6e->node_f57d5179 node_b09aaad7 119: append_search_path() node_fc74cf6e->node_b09aaad7 node_27a67280 374: _contents() node_f57d5179->node_27a67280 node_f57d5179->node_b09aaad7 node_e1076e40 442: _handle_pth_file() node_f57d5179->node_e1076e40 node_d8651bad 395: _filter_py_modules() node_8c7c41b0 359: _module_name_path() node_5ddf60ad 403: _top_module_name() node_c4f88990 132: insert_search_path() node_5ddf60ad->node_c4f88990 node_ef0847ac 229: find_package() node_ef0847ac->node_27a67280 node_3dfb8aea 427: _is_pkg_style_namespace() node_ef0847ac->node_3dfb8aea node_29b21e54 146: find_spec() node_29b21e54->node_8c7c41b0 node_29b21e54->node_5ddf60ad node_29b21e54->node_ef0847ac node_dfda9d36 276: iter_submodules() node_dfda9d36->node_d8651bad node_dfda9d36->node_dfda9d36 node_d99cc6e4 342: submodules() node_d99cc6e4->node_dfda9d36 node_a5ead7c9 472: _handle_editable_module() node_ba4fbdca 51: _match_pattern() node_a5ead7c9->node_ba4fbdca node_e1076e40->node_a5ead7c9

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_061b2161 File: git node_337b58c6 25: _normalize() node_87fadb8a 31: assert_git_repo() node_df46c3e1 102: tmp_worktree() node_df46c3e1->node_337b58c6 node_df46c3e1->node_87fadb8a

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_37fbe53a File: importer node_7ddece5e 17: _error_details() node_39349b6d 43: dynamic_import() node_39349b6d->node_7ddece5e node_fc6e6317 22: sys_path() node_39349b6d->node_fc6e6317

loader.pyΒ€

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

G cluster_357f4091 File: loader cluster_4b7959cf Class: GriffeLoader node_854a1a19 53: __init__() node_63c00907 625: _create_module() node_e4d0deee 708: _expand_wildcard() node_8c34e367 678: _get_or_create_parent_module() node_8c34e367->node_63c00907 node_ecff5fd1 653: _inspect_module() node_51b6606b 528: _load_module() node_477f7a6a 547: _load_module_path() node_51b6606b->node_477f7a6a node_477f7a6a->node_63c00907 node_477f7a6a->node_ecff5fd1 node_5fb3ab97 570: _load_submodules() node_477f7a6a->node_5fb3ab97 node_7d09cb73 633: _visit_module() node_477f7a6a->node_7d09cb73 node_f73d30c3 512: _load_package() node_f73d30c3->node_51b6606b node_deb13fc2 306: expand_wildcards() node_f73d30c3->node_deb13fc2 node_2d1587fe 574: _load_submodule() node_2d1587fe->node_8c34e367 node_2d1587fe->node_51b6606b node_5fb3ab97->node_2d1587fe node_b1172aef 193: _post_load() node_96dae77b 265: expand_exports() node_b1172aef->node_96dae77b node_b1172aef->node_deb13fc2 node_96dae77b->node_96dae77b node_deb13fc2->node_e4d0deee node_deb13fc2->node_deb13fc2 node_8807d770 101: load() node_deb13fc2->node_8807d770 node_8807d770->node_ecff5fd1 node_8807d770->node_f73d30c3 node_8807d770->node_b1172aef node_6ace6c45 209: resolve_aliases() node_6ace6c45->node_deb13fc2 node_830b5e0d 423: resolve_module_aliases() node_6ace6c45->node_830b5e0d node_830b5e0d->node_8807d770 node_830b5e0d->node_830b5e0d node_4822c488 717: load() node_4822c488->node_854a1a19 node_4822c488->node_8807d770 node_4822c488->node_6ace6c45 node_4baa195b 822: load_git() node_4baa195b->node_4822c488 node_a473d6a5 907: load_pypi() node_a473d6a5->node_4822c488

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_988b8169 File: logger cluster_0c19b76a Class: Logger node_4cf08611 0: (global)() node_0734c7b9 43: _get() node_4cf08611->node_0734c7b9 node_21ab9f0b 49: _patch_loggers() node_3ecf81ab 93: get_logger() node_3ecf81ab->node_0734c7b9 node_cace6970 105: patch_loggers() node_cace6970->node_21ab9f0b

merger.pyΒ€

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

G cluster_da325a04 File: merger node_89d3d21c 35: _merge_attribute_stubs() node_2b9b6cb2 40: _merge_stubs_docstring() node_89d3d21c->node_2b9b6cb2 node_e63d8d04 21: _merge_class_stubs() node_e63d8d04->node_2b9b6cb2 node_ec1c930e 53: _merge_stubs_members() node_e63d8d04->node_ec1c930e node_f0d41b64 45: _merge_stubs_overloads() node_e63d8d04->node_f0d41b64 node_bb6b56f7 27: _merge_function_stubs() node_bb6b56f7->node_2b9b6cb2 node_fbebc8c3 15: _merge_module_stubs() node_fbebc8c3->node_2b9b6cb2 node_fbebc8c3->node_ec1c930e node_fbebc8c3->node_f0d41b64 node_ec1c930e->node_89d3d21c node_ec1c930e->node_bb6b56f7 node_443a357a 87: merge_stubs() node_443a357a->node_fbebc8c3

mixins.pyΒ€

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

G cluster_062ac1db File: mixins cluster_63e0e850 Class: GetMembersMixin cluster_4443c14a Class: DelMembersMixin cluster_dae88fc3 Class: SetMembersMixin node_f1c1d745 97: __delitem__() node_41f90d15 22: _get_parts() node_f1c1d745->node_41f90d15 node_9166d65d 124: del_member() node_9166d65d->node_9166d65d node_9166d65d->node_41f90d15 node_5d6e4bbf 42: __getitem__() node_5d6e4bbf->node_41f90d15 node_a31b4af6 64: get_member() node_a31b4af6->node_a31b4af6 node_a31b4af6->node_41f90d15 node_69991625 157: __setitem__() node_69991625->node_41f90d15 node_395ce25b 183: set_member() node_395ce25b->node_395ce25b node_395ce25b->node_41f90d15

models.pyΒ€

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

G cluster_03c53aaf File: models cluster_c4f2050a Class: Docstring cluster_6c79e82e Class: Parameter cluster_6d71b4b1 Class: Parameters cluster_98245a2b Class: Object cluster_6f1b45b9 Class: Alias cluster_97272738 Class: Class cluster_9f1a774e Class: Function node_adeb2f7e 1027: __init__() node_7bcae6b5 1749: _update_target_aliases() node_adeb2f7e->node_7bcae6b5 node_d226b2db 1733: _resolve_target() node_63ce24dc 1700: resolve_target() node_d226b2db->node_63ce24dc node_883585af 1204: as_json() node_883585af->node_883585af node_384bab81 1385: filter_members() node_384bab81->node_384bab81 node_b210bc29 1372: has_labels() node_b210bc29->node_b210bc29 node_2b005d65 1182: inherited_members() node_2b005d65->node_adeb2f7e node_7a373957 1303: is_kind() node_7a373957->node_7a373957 node_28e5301a 1162: members() node_28e5301a->node_adeb2f7e node_3a9282e9 1143: parent() node_3a9282e9->node_7bcae6b5 node_497cff93 1494: resolve() node_497cff93->node_497cff93 node_7cb0b0f2 1651: target() node_7cb0b0f2->node_63ce24dc node_32799131 1990: _mro() node_32799131->node_32799131 node_cf74fd87 2001: mro() node_cf74fd87->node_32799131 node_e8bedb57 1955: parameters() node_dc70c6c2 297: __init__() node_e8bedb57->node_dc70c6c2 node_3e3f1de7 154: parse() node_02aa0e08 150: parsed() node_02aa0e08->node_3e3f1de7 node_9ebb7b79 2031: __init__() node_9ebb7b79->node_dc70c6c2 node_51027427 577: inherited_members() node_51027427->node_adeb2f7e node_8c89062e 931: resolve() node_8c89062e->node_8c89062e node_e1b12fde 263: as_dict() node_e1b12fde->node_e1b12fde

stats.pyΒ€

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

G cluster_c9442be9 File: stats cluster_6f89841b Class: Stats node_0077ae3f 20: __init__() node_e681bb0e 73: _itercount() node_0077ae3f->node_e681bb0e node_e681bb0e->node_e681bb0e

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_fed0d5d3 File: tests node_aa21a6e1 396: module_vtree() node_02741489 353: vtree() node_aa21a6e1->node_02741489 node_5a179d9b 302: temporary_inspected_module() node_58d2610d 53: temporary_pyfile() node_5a179d9b->node_58d2610d node_05b52dd1 185: temporary_inspected_package() node_3acec8ae 71: temporary_pypackage() node_05b52dd1->node_3acec8ae node_0e0f346e 256: temporary_visited_module() node_0e0f346e->node_58d2610d node_08cf6721 120: temporary_visited_package() node_08cf6721->node_3acec8ae