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
 devdeps.txt # (15)!
 duties.py # (16)!
 logo.svg
 mkdocs.yml # (17)!
 pyproject.toml # (18)!
  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
     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
        
    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
          
        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
         hybrid.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 development dependencies specification. See make setup command.

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

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

  18. The project metadata and production dependencies.

BoilerplateΒ€

This project's skeleton (the file-tree shown above) is actually generated from a Copier called copier-uv. When generating the project, Copier asks a series of questions (configuref 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.

Right now, the griffe package has a lot of public submodules: this is only for backward-compatibility reasons. These submodules will be removed in version 1. Importing or accessing objects from these submodules will emit deprecation warnings, recommending to import things from griffe directly.

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_a9a4cf7e File: inspector cluster_3d68c1c7 Class: Inspector node_9539e30e 99: __init__() node_9539e30e->node_9539e30e node_8e0da349 151: _get_docstring() node_6504d1b7 173: _get_linenos() node_32a719ae 239: generic_inspect() node_32a719ae->node_9539e30e node_afe2cffd 231: inspect() node_32a719ae->node_afe2cffd node_6090b7a8 276: inspect_module() node_32a719ae->node_6090b7a8 node_a70c4bde 183: get_module() node_a70c4bde->node_afe2cffd node_fb37c3e5 476: handle_attribute() node_fb37c3e5->node_8e0da349 node_f9d7734c 410: handle_function() node_f9d7734c->node_8e0da349 node_f9d7734c->node_6504d1b7 node_2ba18b37 549: _convert_object_to_annotation() node_f9d7734c->node_2ba18b37 node_00b525e0 533: _convert_parameter() node_f9d7734c->node_00b525e0 node_8ea5f650 468: inspect_attribute() node_8ea5f650->node_fb37c3e5 node_e3a499d4 378: inspect_builtin_function() node_e3a499d4->node_f9d7734c node_7d9889aa 354: inspect_builtin_method() node_7d9889aa->node_f9d7734c node_4cbe20c4 394: inspect_cached_property() node_4cbe20c4->node_f9d7734c node_5da97910 298: inspect_class() node_5da97910->node_8e0da349 node_5da97910->node_6504d1b7 node_5da97910->node_32a719ae node_fc1ad63d 338: inspect_classmethod() node_fc1ad63d->node_f9d7734c node_44b4fe2c 370: inspect_coroutine() node_44b4fe2c->node_f9d7734c node_d94529d1 386: inspect_function() node_d94529d1->node_f9d7734c node_3111f806 362: inspect_method() node_3111f806->node_f9d7734c node_fec3396e 346: inspect_method_descriptor() node_fec3396e->node_f9d7734c node_6090b7a8->node_8e0da349 node_02737961 402: inspect_property() node_02737961->node_f9d7734c node_50b2632c 330: inspect_staticmethod() node_50b2632c->node_f9d7734c node_00b525e0->node_2ba18b37 node_51a72aa9 31: inspect() node_51a72aa9->node_9539e30e node_51a72aa9->node_a70c4bde
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_7043dd99 File: assignments node_efcbe6f6 40: _get_annassign_names() node_350aa66e 23: get_name() node_efcbe6f6->node_350aa66e node_6feec39c 35: _get_assign_names() node_6feec39c->node_350aa66e node_f684fd0f 9: _get_attribute_name() node_f684fd0f->node_350aa66e node_19871c54 63: get_instance_names() node_b620242c 51: get_names() node_19871c54->node_b620242c
ast.pyΒ€

This module contains utilities for navigating AST nodes.

G cluster_c5bb7a8d File: ast node_be3bc20f 23: ast_children() node_c65b4e96 134: ast_first_child() node_c65b4e96->node_be3bc20f node_36c8fe09 152: ast_last_child() node_36c8fe09->node_be3bc20f node_ecb4ce6d 116: ast_next() node_76e8103d 63: ast_next_siblings() node_ecb4ce6d->node_76e8103d node_76e8103d->node_be3bc20f node_c45feeff 97: ast_previous() node_d181ed22 47: ast_previous_siblings() node_c45feeff->node_d181ed22 node_d181ed22->node_be3bc20f node_ed5f9e14 79: ast_siblings() node_ed5f9e14->node_be3bc20f
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_6902241c File: exports node_c8480ff8 74: _extract() node_5de81451 33: _extract_attribute() node_5de81451->node_c8480ff8 node_3f160ed6 37: _extract_binop() node_3f160ed6->node_c8480ff8 node_762e29eb 51: _extract_sequence() node_762e29eb->node_c8480ff8 node_f4349420 58: _extract_starred() node_f4349420->node_c8480ff8 node_e0de15b1 78: get__all__() node_e0de15b1->node_c8480ff8 node_462f313f 93: safe_get__all__() node_462f313f->node_e0de15b1
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_86a50791 File: runtime cluster_f2981f67 Class: ObjectNode node_2eb5ba61 38: __init__() node_80a6ad04 228: _pick_member() node_98c7d7dc 238: alias_target_path() node_053142f5 21: _same_components() node_98c7d7dc->node_053142f5 node_b89dbd5c 136: children() node_b89dbd5c->node_2eb5ba61 node_b89dbd5c->node_80a6ad04
values.pyΒ€

This module contains utilities for extracting attribute values.

G cluster_fde84fd6 File: values node_36f956d5 21: get_value() node_0705cf4e 35: safe_get_value() node_0705cf4e->node_36f956d5
visitor.pyΒ€

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

G cluster_dbeee0d2 File: visitor cluster_bc26ce4e Class: Visitor node_0ef7c85c 121: __init__() node_0ef7c85c->node_0ef7c85c node_b770628c 181: _get_docstring() node_93c78daa 292: decorators_to_labels() node_2df7839e 215: generic_visit() node_67af3a1f 207: visit() node_2df7839e->node_67af3a1f node_a012755e 310: get_base_property() node_4937dbfb 193: get_module() node_4937dbfb->node_67af3a1f node_76bff49a 508: handle_attribute() node_76bff49a->node_b770628c node_d7757ef5 334: handle_function() node_d7757ef5->node_b770628c node_d7757ef5->node_93c78daa node_d7757ef5->node_2df7839e node_d7757ef5->node_a012755e node_45039e25 619: visit_annassign() node_45039e25->node_76bff49a node_52694bc7 611: visit_assign() node_52694bc7->node_76bff49a node_1a77baa3 445: visit_asyncfunctiondef() node_1a77baa3->node_d7757ef5 node_d61c3cd4 246: visit_classdef() node_d61c3cd4->node_b770628c node_d61c3cd4->node_93c78daa node_d61c3cd4->node_2df7839e node_d42eb854 437: visit_functiondef() node_d42eb854->node_d7757ef5 node_c031e146 648: visit_if() node_c031e146->node_2df7839e node_80bc667b 224: visit_module() node_80bc667b->node_b770628c node_80bc667b->node_2df7839e node_3e4bdf9e 64: visit() node_3e4bdf9e->node_0ef7c85c node_3e4bdf9e->node_4937dbfb

c3linear.pyΒ€

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

G cluster_b7a430be File: c3linear cluster_d51a33f4 Class: _Dependency cluster_40c8201a Class: _DependencyList node_59e2f44a 28: tail() node_78a8563f 59: __len__() node_59e2f44a->node_78a8563f node_dec0570d 47: __init__() node_744add62 63: __repr__() node_744add62->node_744add62 node_e76a9df0 81: remove() node_a0517209 92: c3linear_merge() node_a0517209->node_dec0570d node_a0517209->node_e76a9df0

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_fa121801 File: cli cluster_4cc4acb2 Class: _DebugInfo node_d51475ae 49: __init__() node_d51475ae->node_d51475ae node_4191bc93 67: _load_packages() node_f0c3ba0c 57: _print_data() node_e2d25cd6 329: dump() node_e2d25cd6->node_4191bc93 node_e2d25cd6->node_f0c3ba0c node_5f1f34ab 128: get_parser() node_b9d4bd73 562: main() node_b9d4bd73->node_5f1f34ab

collections.pyΒ€

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

G cluster_f691211e File: collections cluster_db379241 Class: LinesCollection node_314a847e 55: items() node_314a847e->node_314a847e node_1967b76d 39: keys() node_1967b76d->node_1967b76d node_1c9e8f7c 47: values() node_1c9e8f7c->node_1c9e8f7c

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_64ed8112 File: debug node_dfbc8e3c 80: _get_debug_info() node_1b57fe08 65: _get_version() node_dfbc8e3c->node_1b57fe08 node_c80065e0 54: _interpreter_name_version() node_dfbc8e3c->node_c80065e0 node_470901db 99: _print_debug_info() node_470901db->node_dfbc8e3c

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_d51c0481 File: diff cluster_afceca9b Class: Breakage node_15302313 215: _explain_github() node_9be706e9 158: _format_new_value() node_15302313->node_9be706e9 node_9b5430ad 155: _format_old_value() node_15302313->node_9b5430ad node_bf457c1d 149: _format_title() node_15302313->node_bf457c1d node_bc01c9f1 195: _explain_markdown() node_bc01c9f1->node_9be706e9 node_bc01c9f1->node_9b5430ad node_ef83b11f 161: _explain_oneline() node_fb374d43 152: _format_kind() node_ef83b11f->node_fb374d43 node_09f83b22 146: _format_location() node_ef83b11f->node_09f83b22 node_ef83b11f->node_9be706e9 node_ef83b11f->node_9b5430ad node_ef83b11f->node_bf457c1d node_161e8a59 177: _explain_verbose() node_161e8a59->node_fb374d43 node_161e8a59->node_09f83b22 node_161e8a59->node_9be706e9 node_161e8a59->node_9b5430ad node_161e8a59->node_bf457c1d node_601f0716 482: _alias_incompatibilities() node_3c56c645 519: _type_based_yield() node_601f0716->node_3c56c645 node_a32cc03e 471: _attribute_incompatibilities() node_24c042d4 383: _class_incompatibilities() node_14c9a630 498: _member_incompatibilities() node_24c042d4->node_14c9a630 node_175f6b4f 396: _function_incompatibilities() node_13262942 556: _returns_are_compatible() node_175f6b4f->node_13262942 node_14c9a630->node_3c56c645 node_3c56c645->node_a32cc03e node_3c56c645->node_24c042d4 node_3c56c645->node_175f6b4f node_737e8ca6 580: find_breaking_changes() node_737e8ca6->node_14c9a630

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_8c840562 File: google node_b14ef0c8 701: _is_empty_line() node_2aca7d1e 261: _read_attributes_section() node_4ad129f5 84: _read_block_items() node_2aca7d1e->node_4ad129f5 node_a296a0c6 147: _read_block() node_a296a0c6->node_b14ef0c8 node_4ad129f5->node_b14ef0c8 node_1bd8a2d0 332: _read_classes_section() node_1bd8a2d0->node_4ad129f5 node_4e4addca 677: _read_deprecated_section() node_4e4addca->node_a296a0c6 node_798f7fb1 618: _read_examples_section() node_798f7fb1->node_b14ef0c8 node_798f7fb1->node_a296a0c6 node_abb1e552 297: _read_functions_section() node_abb1e552->node_4ad129f5 node_14e93d6d 367: _read_modules_section() node_14e93d6d->node_4ad129f5 node_18b30091 250: _read_other_parameters_section() node_544c623b 178: _read_parameters() node_18b30091->node_544c623b node_544c623b->node_4ad129f5 node_d3e8c2d5 240: _read_parameters_section() node_d3e8c2d5->node_544c623b node_de64126c 392: _read_raises_section() node_de64126c->node_4ad129f5 node_b12de872 571: _read_receives_section() node_b12de872->node_4ad129f5 node_aa08dc2b 445: _read_returns_section() node_aa08dc2b->node_a296a0c6 node_aa08dc2b->node_4ad129f5 node_d9f8e205 420: _read_warns_section() node_d9f8e205->node_4ad129f5 node_a17d3272 520: _read_yields_section() node_a17d3272->node_4ad129f5 node_904aa473 724: parse_google() node_904aa473->node_b14ef0c8 node_904aa473->node_a296a0c6
models.pyΒ€

This module contains the models for storing docstrings structured data.

G cluster_b8471469 File: models cluster_0190aa40 Class: DocstringSection node_03d2f03b 202: as_dict() node_03d2f03b->node_03d2f03b
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_57b84cfa File: numpy node_5a747746 722: _append_section() node_e642fb17 88: _is_dash_line() node_24be3be6 84: _is_empty_line() node_e642fb17->node_24be3be6 node_8a432e3c 533: _read_attributes_section() node_47260570 92: _read_block_items() node_8a432e3c->node_47260570 node_aa295037 152: _read_block() node_aa295037->node_e642fb17 node_aa295037->node_24be3be6 node_47260570->node_e642fb17 node_47260570->node_24be3be6 node_b5f4c8fc 599: _read_classes_section() node_b5f4c8fc->node_47260570 node_ad8df0da 315: _read_deprecated_section() node_ad8df0da->node_47260570 node_50466556 659: _read_examples_section() node_50466556->node_24be3be6 node_50466556->node_aa295037 node_6c283b51 569: _read_functions_section() node_6c283b51->node_47260570 node_50db8735 629: _read_modules_section() node_50db8735->node_47260570 node_380ad55f 299: _read_other_parameters_section() node_02e6b9ac 214: _read_parameters() node_380ad55f->node_02e6b9ac node_02e6b9ac->node_47260570 node_8c16c608 284: _read_parameters_section() node_8c16c608->node_02e6b9ac node_25c65e1e 487: _read_raises_section() node_25c65e1e->node_47260570 node_83433433 443: _read_receives_section() node_83433433->node_47260570 node_ce6db1c5 339: _read_returns_section() node_ce6db1c5->node_47260570 node_bb58f9fc 510: _read_warns_section() node_bb58f9fc->node_47260570 node_15cc232c 395: _read_yields_section() node_15cc232c->node_47260570 node_a8bcdc7d 758: parse_numpy() node_a8bcdc7d->node_5a747746 node_a8bcdc7d->node_e642fb17 node_a8bcdc7d->node_24be3be6
parsers.pyΒ€

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

G cluster_e891b548 File: parsers node_2657620c 106: infer_docstring_style() node_4569a7e4 212: parse() node_f1206910 166: parse_auto() node_f1206910->node_2657620c node_f1206910->node_4569a7e4
sphinx.pyΒ€

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

G cluster_59d72c0d File: sphinx cluster_4aad0cf8 Class: _FieldType node_0bbde65f 49: matches() node_cf6460f4 399: _consolidate_continuation_lines() node_1cedfedb 412: _consolidate_descriptive_type() node_c9bf518a 180: _determine_param_annotation() node_5c078c7b 173: _determine_param_default() node_25e09d19 387: _parse_directive() node_25e09d19->node_cf6460f4 node_8a6fb165 371: _parsed_values_to_sections() node_8480a544 416: _strip_blank_lines() node_8a6fb165->node_8480a544 node_c17047c0 239: _read_attribute() node_c17047c0->node_25e09d19 node_c09fd05c 281: _read_attribute_type() node_c09fd05c->node_1cedfedb node_c09fd05c->node_25e09d19 node_c963dc5c 308: _read_exception() node_c963dc5c->node_25e09d19 node_698e8182 122: _read_parameter() node_698e8182->node_c9bf518a node_698e8182->node_5c078c7b node_698e8182->node_25e09d19 node_ed836aaf 212: _read_parameter_type() node_ed836aaf->node_1cedfedb node_ed836aaf->node_25e09d19 node_6238bc75 327: _read_return() node_6238bc75->node_25e09d19 node_1f570951 352: _read_return_type() node_1f570951->node_1cedfedb node_1f570951->node_25e09d19 node_f7b76c87 86: parse_sphinx() node_f7b76c87->node_0bbde65f node_f7b76c87->node_8a6fb165
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_e8f0904d File: encoders cluster_3bb68995 Class: JSONEncoder node_6fc86667 48: __init__() node_6fc86667->node_6fc86667 node_c3d7382e 125: _attach_parent_to_expr() node_25c95527 135: _attach_parent_to_exprs() node_25c95527->node_c3d7382e node_66d0a7eb 211: _load_attribute() node_f091d3c3 85: _load_docstring() node_66d0a7eb->node_f091d3c3 node_0c7a024b 174: _load_class() node_0c7a024b->node_25c95527 node_43fef188 91: _load_decorators() node_0c7a024b->node_43fef188 node_0c7a024b->node_f091d3c3 node_a6d0db15 95: _load_expression() node_6f7949fb 197: _load_function() node_6f7949fb->node_43fef188 node_6f7949fb->node_f091d3c3 node_e7313963 159: _load_module() node_e7313963->node_25c95527 node_e7313963->node_f091d3c3 node_fdf11773 115: _load_parameter() node_fdf11773->node_f091d3c3 node_6d1bc280 242: json_decoder() node_6d1bc280->node_a6d0db15 node_6d1bc280->node_fdf11773

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 helpersto safely get expressions from AST nodes in different scenarios.

G cluster_b85e2a5e File: expressions cluster_13041ca4 Class: Expr cluster_9eec2b10 Class: ExprAttribute cluster_4e83ec27 Class: ExprBinOp cluster_ad9db910 Class: ExprBoolOp cluster_dc26c66f Class: ExprCall cluster_aff0e3c3 Class: ExprCompare cluster_94ec28c6 Class: ExprComprehension cluster_22c566ca Class: ExprDict cluster_fcee6f46 Class: ExprDictComp cluster_95521ba5 Class: ExprExtSlice cluster_1d67845b Class: ExprFormatted cluster_50ec49a6 Class: ExprGeneratorExp cluster_385c8395 Class: ExprIfExp cluster_6fa02a82 Class: ExprJoinedStr cluster_487c1d9b Class: ExprKeyword cluster_02aa5d88 Class: ExprVarPositional cluster_48ef71b2 Class: ExprVarKeyword cluster_4b09cd49 Class: ExprLambda cluster_b8b3e83b Class: ExprList cluster_f55eb406 Class: ExprListComp cluster_260e1535 Class: ExprNamedExpr cluster_ef953591 Class: ExprSet cluster_6412cfd0 Class: ExprSetComp cluster_04ef311c Class: ExprSlice cluster_2386c656 Class: ExprSubscript cluster_9e9c36c8 Class: ExprTuple cluster_9db30101 Class: ExprUnaryOp cluster_c31484b6 Class: ExprYield cluster_3d22c07f Class: ExprYieldFrom node_56f39ac6 97: __iter__() node_34de3244 101: iterate() node_56f39ac6->node_34de3244 node_cf2864f0 94: __str__() node_cf2864f0->node_34de3244 node_d967c444 130: as_dict() node_fa41cefd 67: _expr_as_dict() node_d967c444->node_fa41cefd node_c2f98f5d 199: append() node_c2f98f5d->node_c2f98f5d node_29dd0529 191: iterate() node_cfb8411f 40: _join() node_29dd0529->node_cfb8411f node_576cd5ce 244: iterate() node_bc06b466 28: _yield() node_576cd5ce->node_bc06b466 node_84f4a1a5 260: iterate() node_84f4a1a5->node_cfb8411f node_3d3c0ce3 279: iterate() node_3d3c0ce3->node_cfb8411f node_3d3c0ce3->node_bc06b466 node_b0b30225 298: iterate() node_b0b30225->node_cfb8411f node_b0b30225->node_bc06b466 node_ea5281ba 318: iterate() node_ea5281ba->node_cfb8411f node_ea5281ba->node_bc06b466 node_e28f6644 352: iterate() node_e28f6644->node_cfb8411f node_84fc100e 374: iterate() node_84fc100e->node_cfb8411f node_84fc100e->node_bc06b466 node_ec1346a3 391: iterate() node_ec1346a3->node_cfb8411f node_a80a115c 403: iterate() node_a80a115c->node_bc06b466 node_14b8c601 419: iterate() node_14b8c601->node_cfb8411f node_14b8c601->node_bc06b466 node_308e2b91 437: iterate() node_308e2b91->node_bc06b466 node_4130995c 453: iterate() node_4130995c->node_cfb8411f node_df1694d8 494: iterate() node_df1694d8->node_bc06b466 node_3b2fe8c9 536: iterate() node_3b2fe8c9->node_bc06b466 node_33ad38a4 577: iterate() node_33ad38a4->node_cfb8411f node_4eb6af16 593: iterate() node_4eb6af16->node_cfb8411f node_4eb6af16->node_bc06b466 node_f503cd23 698: iterate() node_f503cd23->node_bc06b466 node_550c6d0c 729: iterate() node_550c6d0c->node_cfb8411f node_b823e458 745: iterate() node_b823e458->node_cfb8411f node_b823e458->node_bc06b466 node_41748070 765: iterate() node_41748070->node_bc06b466 node_bf1be9b5 793: _to_binop() node_bf1be9b5->node_bf1be9b5 node_dcc6e3dd 786: iterate() node_dcc6e3dd->node_bc06b466 node_48305401 808: modernize() node_48305401->node_bf1be9b5 node_48305401->node_48305401 node_b807fb17 844: iterate() node_b807fb17->node_cfb8411f node_ab533d29 868: iterate() node_ab533d29->node_bc06b466 node_675974d8 521: iterate() node_675974d8->node_bc06b466 node_c87ea1dd 508: iterate() node_c87ea1dd->node_bc06b466 node_87aeac91 881: iterate() node_87aeac91->node_bc06b466 node_cfea4b7b 896: iterate() node_cfea4b7b->node_bc06b466 node_308c7423 1237: _build() node_a71efe1c 943: _build_attribute() node_a71efe1c->node_c2f98f5d node_a71efe1c->node_308c7423 node_dea252b1 955: _build_binop() node_dea252b1->node_308c7423 node_efa4bb84 963: _build_boolop() node_efa4bb84->node_308c7423 node_858301c9 970: _build_call() node_858301c9->node_308c7423 node_9fdaff90 977: _build_compare() node_9fdaff90->node_308c7423 node_363fc848 985: _build_comprehension() node_363fc848->node_308c7423 node_f3374a52 994: _build_constant() node_f3374a52->node_308c7423 node_ffe25c0f 1033: _build_dict() node_ffe25c0f->node_308c7423 node_0158799a 1040: _build_dictcomp() node_0158799a->node_308c7423 node_cc77b4e9 1227: _build_extslice() node_cc77b4e9->node_308c7423 node_798752c8 1048: _build_formatted() node_798752c8->node_308c7423 node_428b5a43 1058: _build_generatorexp() node_428b5a43->node_308c7423 node_ee26515c 1065: _build_ifexp() node_ee26515c->node_308c7423 node_6472ef9d 1230: _build_index() node_6472ef9d->node_308c7423 node_5537ad72 1073: _build_joinedstr() node_5537ad72->node_308c7423 node_77572294 1083: _build_keyword() node_77572294->node_308c7423 node_c71a1148 1089: _build_lambda() node_c71a1148->node_308c7423 node_a657b602 1269: safe_get_expression() node_c71a1148->node_a657b602 node_63383489 1106: _build_list() node_63383489->node_308c7423 node_f03437ba 1110: _build_listcomp() node_f03437ba->node_308c7423 node_846457c6 1118: _build_named_expr() node_846457c6->node_308c7423 node_3bb8413d 1122: _build_set() node_3bb8413d->node_308c7423 node_dfffec13 1126: _build_setcomp() node_dfffec13->node_308c7423 node_c6026278 1130: _build_slice() node_c6026278->node_308c7423 node_165c1877 1138: _build_starred() node_165c1877->node_308c7423 node_b088f827 1142: _build_subscript() node_b088f827->node_308c7423 node_5eeba30e 1171: _build_tuple() node_5eeba30e->node_308c7423 node_3cc023f4 1181: _build_unaryop() node_3cc023f4->node_308c7423 node_dc5ab495 1185: _build_yield() node_dc5ab495->node_308c7423 node_29f21b72 1189: _build_yield_from() node_29f21b72->node_308c7423 node_3fd7de11 56: _field_as_dict() node_fa41cefd->node_3fd7de11 node_3fd7de11->node_3fd7de11 node_cfb8411f->node_bc06b466 node_bc06b466->node_bc06b466 node_b97977cf 1241: get_expression() node_b97977cf->node_308c7423 node_a657b602->node_b97977cf

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_109933df File: base cluster_79d896b3 Class: Extension cluster_3c973f69 Class: Extensions node_6e7faf95 56: generic_inspect() node_2d2b0a98 48: inspect() node_6e7faf95->node_2d2b0a98 node_36d8af2e 39: generic_visit() node_ecd56ba8 31: visit() node_36d8af2e->node_ecd56ba8 node_62aba4aa 287: __init__() node_e41adb43 296: add() node_62aba4aa->node_e41adb43 node_febbcd21 333: _load_extension() node_6400c4d0 322: _load_extension_path() node_febbcd21->node_6400c4d0 node_3825d264 424: load_extensions() node_3825d264->node_62aba4aa node_3825d264->node_e41adb43 node_3825d264->node_febbcd21
dataclasses.pyΒ€

Built-in extension adding support for dataclasses.

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

G cluster_08632655 File: dataclasses cluster_58f6728e Class: DataclassesExtension node_8f35f88c 227: on_package_loaded() node_f0f21fe9 203: _apply_recursively() node_8f35f88c->node_f0f21fe9 node_f0f21fe9->node_f0f21fe9 node_f90b75d6 195: _del_members_annotated_as_initvar() node_f0f21fe9->node_f90b75d6 node_bc3777a3 157: _set_dataclass_init() node_f0f21fe9->node_bc3777a3 node_7fa43d89 49: _dataclass_arguments() node_7094fcd7 25: _dataclass_decorator() node_7fa43d89->node_7094fcd7 node_f5d27060 32: _expr_args() node_7fa43d89->node_f5d27060 node_010434ea 66: _dataclass_parameters() node_010434ea->node_7fa43d89 node_4337f9eb 55: _field_arguments() node_010434ea->node_4337f9eb node_f5d27060->node_f5d27060 node_4337f9eb->node_f5d27060 node_8109640c 139: _reorder_parameters() node_bc3777a3->node_7094fcd7 node_bc3777a3->node_010434ea node_bc3777a3->node_8109640c
hybrid.pyΒ€

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_f993685f File: finder cluster_8560f931 Class: ModuleFinder node_cdc7b608 101: __init__() node_c19a493a 386: _extend_from_pth_files() node_cdc7b608->node_c19a493a node_41d86dbb 118: append_search_path() node_cdc7b608->node_41d86dbb node_8a5170e4 374: _contents() node_c19a493a->node_8a5170e4 node_c19a493a->node_41d86dbb node_7176ce1c 442: _handle_pth_file() node_c19a493a->node_7176ce1c node_bdba6aeb 395: _filter_py_modules() node_64094eb1 359: _module_name_path() node_61a12c02 403: _top_module_name() node_d63f4d1c 131: insert_search_path() node_61a12c02->node_d63f4d1c node_fe8608ea 228: find_package() node_fe8608ea->node_8a5170e4 node_664574ab 427: _is_pkg_style_namespace() node_fe8608ea->node_664574ab node_a8867502 145: find_spec() node_a8867502->node_64094eb1 node_a8867502->node_61a12c02 node_a8867502->node_fe8608ea node_65af2f8e 276: iter_submodules() node_65af2f8e->node_bdba6aeb node_65af2f8e->node_65af2f8e node_8ae551ea 342: submodules() node_8ae551ea->node_65af2f8e node_298c9016 472: _handle_editable_module() node_62656944 50: _match_pattern() node_298c9016->node_62656944 node_7176ce1c->node_298c9016

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_c27d344e File: git node_5049b756 20: assert_git_repo() node_e51306e9 91: tmp_worktree() node_e51306e9->node_5049b756

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_fb145637 File: importer node_9bcfc982 16: _error_details() node_d7749bfe 42: dynamic_import() node_d7749bfe->node_9bcfc982 node_1b5c70a3 21: sys_path() node_d7749bfe->node_1b5c70a3

loader.pyΒ€

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

G cluster_dd3dbdbf File: loader cluster_83bbc958 Class: GriffeLoader node_d8cf5b5e 51: __init__() node_a64be146 628: _create_module() node_b0b5fe65 711: _expand_wildcard() node_34a3572c 681: _get_or_create_parent_module() node_34a3572c->node_a64be146 node_c9d61794 656: _inspect_module() node_47034407 531: _load_module() node_03e0a5cd 550: _load_module_path() node_47034407->node_03e0a5cd node_03e0a5cd->node_a64be146 node_03e0a5cd->node_c9d61794 node_2d1f96f2 573: _load_submodules() node_03e0a5cd->node_2d1f96f2 node_47a49894 636: _visit_module() node_03e0a5cd->node_47a49894 node_92056cff 515: _load_package() node_92056cff->node_47034407 node_ac1e715a 311: expand_wildcards() node_92056cff->node_ac1e715a node_bf92675d 577: _load_submodule() node_bf92675d->node_34a3572c node_bf92675d->node_47034407 node_2d1f96f2->node_bf92675d node_95234922 191: _post_load() node_1e8334ae 272: expand_exports() node_95234922->node_1e8334ae node_95234922->node_ac1e715a node_1e8334ae->node_1e8334ae node_ac1e715a->node_b0b5fe65 node_ac1e715a->node_ac1e715a node_6690b35c 99: load() node_ac1e715a->node_6690b35c node_6690b35c->node_c9d61794 node_6690b35c->node_92056cff node_6690b35c->node_95234922 node_9c8c1405 218: resolve_aliases() node_9c8c1405->node_ac1e715a node_3372921a 426: resolve_module_aliases() node_9c8c1405->node_3372921a node_3372921a->node_6690b35c node_3372921a->node_3372921a node_3f56c1bd 720: load() node_3f56c1bd->node_d8cf5b5e node_3f56c1bd->node_6690b35c node_3f56c1bd->node_9c8c1405 node_abd2774e 825: load_git() node_abd2774e->node_3f56c1bd node_17b7de26 910: load_pypi() node_17b7de26->node_3f56c1bd

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_e8072597 File: logger cluster_5601ef4d Class: Logger node_789da397 0: (global)() node_a97d1d29 40: _get() node_789da397->node_a97d1d29 node_d5e782ca 46: _patch_loggers() node_c17b4157 90: get_logger() node_c17b4157->node_a97d1d29 node_161885da 102: patch_loggers() node_161885da->node_d5e782ca

merger.pyΒ€

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

G cluster_9603e0d8 File: merger node_18936a93 35: _merge_attribute_stubs() node_4c71a615 40: _merge_stubs_docstring() node_18936a93->node_4c71a615 node_5defac10 21: _merge_class_stubs() node_5defac10->node_4c71a615 node_7d29bec4 53: _merge_stubs_members() node_5defac10->node_7d29bec4 node_93a9d873 45: _merge_stubs_overloads() node_5defac10->node_93a9d873 node_cb89f36b 27: _merge_function_stubs() node_cb89f36b->node_4c71a615 node_f27cd93e 15: _merge_module_stubs() node_f27cd93e->node_4c71a615 node_f27cd93e->node_7d29bec4 node_f27cd93e->node_93a9d873 node_7d29bec4->node_18936a93 node_7d29bec4->node_cb89f36b node_363692f5 87: merge_stubs() node_363692f5->node_f27cd93e

mixins.pyΒ€

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

G cluster_5444bc3b File: mixins cluster_ccde43c4 Class: GetMembersMixin cluster_40af1cbb Class: DelMembersMixin cluster_5e7eae3b Class: SetMembersMixin node_d755c36c 95: __delitem__() node_e6c6ea9c 20: _get_parts() node_d755c36c->node_e6c6ea9c node_93cab692 122: del_member() node_93cab692->node_93cab692 node_93cab692->node_e6c6ea9c node_bce36993 40: __getitem__() node_bce36993->node_e6c6ea9c node_11618e49 62: get_member() node_11618e49->node_11618e49 node_11618e49->node_e6c6ea9c node_a1c02089 155: __setitem__() node_a1c02089->node_e6c6ea9c node_0aaeeadf 181: set_member() node_0aaeeadf->node_0aaeeadf node_0aaeeadf->node_e6c6ea9c

models.pyΒ€

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

G cluster_d7ce41a2 File: models cluster_efe0ac70 Class: Docstring cluster_cca8ae8d Class: Parameter cluster_3049597f Class: Parameters cluster_1642f9a7 Class: Object cluster_34782756 Class: Alias cluster_6f685aab Class: Class cluster_b6108f1e Class: Function node_0b75e9dc 852: __init__() node_83cf2525 1428: _update_target_aliases() node_0b75e9dc->node_83cf2525 node_f794a8bd 1412: _resolve_target() node_b07ac566 1383: resolve_target() node_f794a8bd->node_b07ac566 node_0ff79f3b 1007: as_json() node_0ff79f3b->node_0ff79f3b node_ec98c475 1132: filter_members() node_ec98c475->node_ec98c475 node_40a9c4c6 1121: has_labels() node_40a9c4c6->node_40a9c4c6 node_cc5492e8 987: inherited_members() node_cc5492e8->node_0b75e9dc node_341356cb 1087: is_kind() node_341356cb->node_341356cb node_902792e0 973: members() node_902792e0->node_0b75e9dc node_774086b5 957: parent() node_774086b5->node_83cf2525 node_29ba0c6d 1209: resolve() node_29ba0c6d->node_29ba0c6d node_351520a7 1342: target() node_351520a7->node_b07ac566 node_7d3f1a01 1637: _mro() node_7d3f1a01->node_7d3f1a01 node_56f68673 1648: mro() node_56f68673->node_7d3f1a01 node_0fe3e955 1605: parameters() node_9d0be8d9 261: __init__() node_0fe3e955->node_9d0be8d9 node_f174f3cd 126: parse() node_36c1487f 122: parsed() node_36c1487f->node_f174f3cd node_0d1fc166 1672: __init__() node_0d1fc166->node_9d0be8d9 node_679b9895 480: inherited_members() node_679b9895->node_0b75e9dc node_38c80e6a 756: resolve() node_38c80e6a->node_38c80e6a node_3ec6810a 229: as_dict() node_3ec6810a->node_3ec6810a node_cc701281 293: add() node_9d0be8d9->node_cc701281

stats.pyΒ€

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

G cluster_9b31fecc File: stats cluster_fbbfe550 Class: Stats node_5c577bbe 20: __init__() node_c9b5fd6d 73: _itercount() node_5c577bbe->node_c9b5fd6d node_c9b5fd6d->node_c9b5fd6d

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_cc96d64c File: tests node_83028963 394: module_vtree() node_45ed6f8a 351: vtree() node_83028963->node_45ed6f8a node_6bfe8cc8 300: temporary_inspected_module() node_22f59d83 51: temporary_pyfile() node_6bfe8cc8->node_22f59d83 node_a733922b 183: temporary_inspected_package() node_fb56714e 69: temporary_pypackage() node_a733922b->node_fb56714e node_0c617cf4 254: temporary_visited_module() node_0c617cf4->node_22f59d83 node_bcf77abe 118: temporary_visited_package() node_bcf77abe->node_fb56714e