Skip to content

Project architectureΒ€

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

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

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

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

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

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

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

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

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

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

  8. Our different scripts. See Scripts, configuration.

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

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

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

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

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

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

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

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

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

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

  17. The project metadata and production dependencies.

BoilerplateΒ€

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

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

copier update --trust --skip-answered

Scripts, configurationΒ€

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

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

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

SourcesΒ€

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

TestsΒ€

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

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

Program structureΒ€

Griffe is composed of two packages:

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

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

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

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

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

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

CLI entrypointΒ€

griffe.__main__Β€

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

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

Public APIΒ€

griffeΒ€

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

Internal APIΒ€

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

agentsΒ€

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

inspector.pyΒ€

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

G cluster_04404863 File: inspector cluster_5729b776 Class: Inspector node_bd6d25dc 101: __init__() node_bd6d25dc->node_bd6d25dc node_36a60119 153: _get_docstring() node_c0736099 175: _get_linenos() node_76380ae7 241: generic_inspect() node_76380ae7->node_bd6d25dc node_4adf520d 233: inspect() node_76380ae7->node_4adf520d node_96619319 278: inspect_module() node_76380ae7->node_96619319 node_ff9bec53 185: get_module() node_ff9bec53->node_4adf520d node_72bec30e 486: handle_attribute() node_72bec30e->node_36a60119 node_1e6ee8aa 420: handle_function() node_1e6ee8aa->node_36a60119 node_1e6ee8aa->node_c0736099 node_6bec51d3 559: _convert_object_to_annotation() node_1e6ee8aa->node_6bec51d3 node_61566163 543: _convert_parameter() node_1e6ee8aa->node_61566163 node_b71d977f 478: inspect_attribute() node_b71d977f->node_72bec30e node_d7270f35 380: inspect_builtin_function() node_d7270f35->node_1e6ee8aa node_4a044fca 356: inspect_builtin_method() node_4a044fca->node_1e6ee8aa node_97880278 396: inspect_cached_property() node_97880278->node_1e6ee8aa node_99af7aad 300: inspect_class() node_99af7aad->node_36a60119 node_99af7aad->node_c0736099 node_99af7aad->node_76380ae7 node_4de9fb32 340: inspect_classmethod() node_4de9fb32->node_1e6ee8aa node_ebb34edd 372: inspect_coroutine() node_ebb34edd->node_1e6ee8aa node_b47b4749 388: inspect_function() node_b47b4749->node_1e6ee8aa node_afa836b5 412: inspect_getset_descriptor() node_afa836b5->node_1e6ee8aa node_6695b05d 364: inspect_method() node_6695b05d->node_1e6ee8aa node_283f426d 348: inspect_method_descriptor() node_283f426d->node_1e6ee8aa node_96619319->node_36a60119 node_e1cec7fb 404: inspect_property() node_e1cec7fb->node_1e6ee8aa node_1cab9c35 332: inspect_staticmethod() node_1cab9c35->node_1e6ee8aa node_61566163->node_6bec51d3 node_3c5c951e 33: inspect() node_3c5c951e->node_bd6d25dc node_3c5c951e->node_ff9bec53
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_ba43183c File: assignments node_8b613d61 40: _get_annassign_names() node_bb955942 23: get_name() node_8b613d61->node_bb955942 node_aa4faea6 35: _get_assign_names() node_aa4faea6->node_bb955942 node_4f4bd926 9: _get_attribute_name() node_4f4bd926->node_bb955942 node_0792e67a 63: get_instance_names() node_8940b532 51: get_names() node_0792e67a->node_8940b532
ast.pyΒ€

This module contains utilities for navigating AST nodes.

G cluster_05b15724 File: ast node_ec55c347 26: ast_children() node_abf1583d 137: ast_first_child() node_abf1583d->node_ec55c347 node_5d6f289a 155: ast_last_child() node_5d6f289a->node_ec55c347 node_af6db3ef 119: ast_next() node_31abf682 66: ast_next_siblings() node_af6db3ef->node_31abf682 node_31abf682->node_ec55c347 node_6dfb37e8 100: ast_previous() node_9617feab 50: ast_previous_siblings() node_6dfb37e8->node_9617feab node_9617feab->node_ec55c347 node_c482002d 82: ast_siblings() node_c482002d->node_ec55c347
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_bc66963b File: exports node_ef90d69a 74: _extract() node_c31075ef 33: _extract_attribute() node_c31075ef->node_ef90d69a node_c9fb5ab6 37: _extract_binop() node_c9fb5ab6->node_ef90d69a node_3e3ef84c 51: _extract_sequence() node_3e3ef84c->node_ef90d69a node_c97c610e 58: _extract_starred() node_c97c610e->node_ef90d69a node_c31ace2a 78: get__all__() node_c31ace2a->node_ef90d69a node_a5d2fc17 93: safe_get__all__() node_a5d2fc17->node_c31ace2a
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_a045d756 File: runtime cluster_fe68aafb Class: ObjectNode node_2c96746f 41: __init__() node_85ff670f 243: _pick_member() node_b4522b0b 253: alias_target_path() node_d10b5b60 25: _same_components() node_b4522b0b->node_d10b5b60 node_bab4a6be 141: children() node_bab4a6be->node_2c96746f node_bab4a6be->node_85ff670f
values.pyΒ€

This module contains utilities for extracting attribute values.

G cluster_031bab62 File: values node_b8120051 15: get_value() node_f01fe703 29: safe_get_value() node_f01fe703->node_b8120051
visitor.pyΒ€

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

G cluster_20f260cc File: visitor cluster_dd093a19 Class: Visitor node_35ec1b91 122: __init__() node_35ec1b91->node_35ec1b91 node_10a07878 182: _get_docstring() node_d8b9d7e5 293: decorators_to_labels() node_cbf0cb86 216: generic_visit() node_17fc44c1 208: visit() node_cbf0cb86->node_17fc44c1 node_21e3b6c0 311: get_base_property() node_2e40fc58 194: get_module() node_2e40fc58->node_17fc44c1 node_c9027a70 509: handle_attribute() node_c9027a70->node_10a07878 node_142c6efb 335: handle_function() node_142c6efb->node_10a07878 node_142c6efb->node_d8b9d7e5 node_142c6efb->node_cbf0cb86 node_142c6efb->node_21e3b6c0 node_4a48febc 620: visit_annassign() node_4a48febc->node_c9027a70 node_4f6d0c7c 612: visit_assign() node_4f6d0c7c->node_c9027a70 node_7947e79f 446: visit_asyncfunctiondef() node_7947e79f->node_142c6efb node_8fc5d18c 247: visit_classdef() node_8fc5d18c->node_10a07878 node_8fc5d18c->node_d8b9d7e5 node_8fc5d18c->node_cbf0cb86 node_ab15c3ee 438: visit_functiondef() node_ab15c3ee->node_142c6efb node_9b233877 649: visit_if() node_9b233877->node_cbf0cb86 node_fe44a2b8 225: visit_module() node_fe44a2b8->node_10a07878 node_fe44a2b8->node_cbf0cb86 node_0c7d5aa9 65: visit() node_0c7d5aa9->node_35ec1b91 node_0c7d5aa9->node_2e40fc58

c3linear.pyΒ€

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

G cluster_32ec1e2a File: c3linear cluster_47a8d9d5 Class: _Dependency cluster_805927c9 Class: _DependencyList node_04bed1c1 29: tail() node_462d4f2f 60: __len__() node_04bed1c1->node_462d4f2f node_7068e041 48: __init__() node_4062ed99 64: __repr__() node_4062ed99->node_4062ed99 node_085404ef 82: remove() node_9e69236b 93: c3linear_merge() node_9e69236b->node_7068e041 node_9e69236b->node_085404ef

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_6f4787dc File: cli cluster_2c16d329 Class: _DebugInfo node_051cc6e6 51: __init__() node_051cc6e6->node_051cc6e6 node_84e61006 69: _load_packages() node_fad3fee6 59: _print_data() node_ef177f60 331: dump() node_ef177f60->node_84e61006 node_ef177f60->node_fad3fee6 node_ca27cd90 130: get_parser() node_46335535 575: main() node_46335535->node_ca27cd90

collections.pyΒ€

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

G cluster_72dcfc74 File: collections cluster_36963c65 Class: LinesCollection node_d60b8741 56: items() node_d60b8741->node_d60b8741 node_955e4827 40: keys() node_955e4827->node_955e4827 node_9964f769 48: values() node_9964f769->node_9964f769

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_5f309ab5 File: debug node_056628b2 80: _get_debug_info() node_b4a3f355 65: _get_version() node_056628b2->node_b4a3f355 node_85c1336a 54: _interpreter_name_version() node_056628b2->node_85c1336a node_2346ec7b 99: _print_debug_info() node_2346ec7b->node_056628b2

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_01db2d17 File: diff cluster_ad264210 Class: Breakage node_d4116ec9 217: _explain_github() node_b6cf022a 160: _format_new_value() node_d4116ec9->node_b6cf022a node_48733b00 157: _format_old_value() node_d4116ec9->node_48733b00 node_8d5ef304 151: _format_title() node_d4116ec9->node_8d5ef304 node_6da8a684 197: _explain_markdown() node_6da8a684->node_b6cf022a node_6da8a684->node_48733b00 node_91430728 163: _explain_oneline() node_854dea34 154: _format_kind() node_91430728->node_854dea34 node_246b7064 148: _format_location() node_91430728->node_246b7064 node_91430728->node_b6cf022a node_91430728->node_48733b00 node_91430728->node_8d5ef304 node_d1c0bc68 179: _explain_verbose() node_d1c0bc68->node_854dea34 node_d1c0bc68->node_246b7064 node_d1c0bc68->node_b6cf022a node_d1c0bc68->node_48733b00 node_d1c0bc68->node_8d5ef304 node_c6dc2cd6 506: _alias_incompatibilities() node_54a6bff8 543: _type_based_yield() node_c6dc2cd6->node_54a6bff8 node_e64afa95 497: _attribute_incompatibilities() node_1827015d 409: _class_incompatibilities() node_bbd1f61e 522: _member_incompatibilities() node_1827015d->node_bbd1f61e node_54b32cae 422: _function_incompatibilities() node_e48a9558 580: _returns_are_compatible() node_54b32cae->node_e48a9558 node_bbd1f61e->node_54a6bff8 node_54a6bff8->node_e64afa95 node_54a6bff8->node_1827015d node_54a6bff8->node_54b32cae node_0e9d5949 604: find_breaking_changes() node_0e9d5949->node_bbd1f61e

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_db0748f8 File: google node_f3ca8c2b 485: _annotation_from_parent() node_1617244e 456: _get_name_annotation_description() node_8b09f587 695: _is_empty_line() node_67c0cd74 259: _read_attributes_section() node_c9f21fdc 83: _read_block_items() node_67c0cd74->node_c9f21fdc node_7509c227 146: _read_block() node_7509c227->node_8b09f587 node_c9f21fdc->node_8b09f587 node_b574ce9d 443: _read_block_items_maybe() node_b574ce9d->node_7509c227 node_b574ce9d->node_c9f21fdc node_2bfb3cff 330: _read_classes_section() node_2bfb3cff->node_c9f21fdc node_404d3c2a 636: _read_examples_section() node_404d3c2a->node_8b09f587 node_404d3c2a->node_7509c227 node_3e859339 295: _read_functions_section() node_3e859339->node_c9f21fdc node_a4e36c7b 365: _read_modules_section() node_a4e36c7b->node_c9f21fdc node_2aa0091a 248: _read_other_parameters_section() node_1f582ece 177: _read_parameters() node_2aa0091a->node_1f582ece node_1f582ece->node_c9f21fdc node_1f465493 238: _read_parameters_section() node_1f465493->node_1f582ece node_a04ad998 390: _read_raises_section() node_a04ad998->node_c9f21fdc node_86ee98f7 592: _read_receives_section() node_86ee98f7->node_f3ca8c2b node_86ee98f7->node_1617244e node_86ee98f7->node_b574ce9d node_fcff67a2 504: _read_returns_section() node_fcff67a2->node_f3ca8c2b node_fcff67a2->node_1617244e node_fcff67a2->node_b574ce9d node_009ae5a1 418: _read_warns_section() node_009ae5a1->node_c9f21fdc node_7a96cae0 548: _read_yields_section() node_7a96cae0->node_f3ca8c2b node_7a96cae0->node_1617244e node_7a96cae0->node_b574ce9d node_358ab93e 717: parse_google() node_358ab93e->node_8b09f587 node_358ab93e->node_7509c227
models.pyΒ€

This module contains the models for storing docstrings structured data.

G cluster_0548e611 File: models cluster_1ff80b27 Class: DocstringSection node_36aafa47 202: as_dict() node_36aafa47->node_36aafa47
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_1e5f2833 File: numpy node_0502b36b 724: _append_section() node_88c37777 89: _is_dash_line() node_776cbdc7 85: _is_empty_line() node_88c37777->node_776cbdc7 node_8773942a 534: _read_attributes_section() node_c51cb885 93: _read_block_items() node_8773942a->node_c51cb885 node_1beee934 153: _read_block() node_1beee934->node_88c37777 node_1beee934->node_776cbdc7 node_c51cb885->node_88c37777 node_c51cb885->node_776cbdc7 node_52fba807 601: _read_classes_section() node_52fba807->node_c51cb885 node_d0f3b70c 316: _read_deprecated_section() node_d0f3b70c->node_c51cb885 node_8341fc56 661: _read_examples_section() node_8341fc56->node_776cbdc7 node_8341fc56->node_1beee934 node_e8af3820 571: _read_functions_section() node_e8af3820->node_c51cb885 node_ec49e540 631: _read_modules_section() node_ec49e540->node_c51cb885 node_0081e07f 300: _read_other_parameters_section() node_597c8b12 215: _read_parameters() node_0081e07f->node_597c8b12 node_597c8b12->node_c51cb885 node_3d170781 285: _read_parameters_section() node_3d170781->node_597c8b12 node_4adc8fbe 488: _read_raises_section() node_4adc8fbe->node_c51cb885 node_74500417 444: _read_receives_section() node_74500417->node_c51cb885 node_1118c631 340: _read_returns_section() node_1118c631->node_c51cb885 node_009b5298 511: _read_warns_section() node_009b5298->node_c51cb885 node_a76cfdc4 396: _read_yields_section() node_a76cfdc4->node_c51cb885 node_f5ba42b5 760: parse_numpy() node_f5ba42b5->node_0502b36b node_f5ba42b5->node_88c37777 node_f5ba42b5->node_776cbdc7
parsers.pyΒ€

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

G cluster_fa5491a6 File: parsers node_9753e2b8 107: infer_docstring_style() node_f48d9172 239: parse() node_85ac84d6 180: parse_auto() node_85ac84d6->node_9753e2b8 node_85ac84d6->node_f48d9172
sphinx.pyΒ€

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

G cluster_4e0e758d File: sphinx cluster_e2086ed4 Class: _FieldType node_ab23fbbd 49: matches() node_80752427 400: _consolidate_continuation_lines() node_3212fe97 413: _consolidate_descriptive_type() node_48cb3595 180: _determine_param_annotation() node_bd375452 173: _determine_param_default() node_26d2d72e 388: _parse_directive() node_26d2d72e->node_80752427 node_3f3475d8 372: _parsed_values_to_sections() node_206aeaa6 417: _strip_blank_lines() node_3f3475d8->node_206aeaa6 node_7f267288 239: _read_attribute() node_7f267288->node_26d2d72e node_b33cb27c 282: _read_attribute_type() node_b33cb27c->node_3212fe97 node_b33cb27c->node_26d2d72e node_be51057d 309: _read_exception() node_be51057d->node_26d2d72e node_e08de14e 122: _read_parameter() node_e08de14e->node_48cb3595 node_e08de14e->node_bd375452 node_e08de14e->node_26d2d72e node_c25c8300 212: _read_parameter_type() node_c25c8300->node_3212fe97 node_c25c8300->node_26d2d72e node_37b8eb05 328: _read_return() node_37b8eb05->node_26d2d72e node_305c2bc9 353: _read_return_type() node_305c2bc9->node_3212fe97 node_305c2bc9->node_26d2d72e node_7b6c94d2 86: parse_sphinx() node_7b6c94d2->node_ab23fbbd node_7b6c94d2->node_3f3475d8
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_8f6082e5 File: encoders cluster_8310935d Class: JSONEncoder node_9e8f2acb 48: __init__() node_9e8f2acb->node_9e8f2acb node_fbf06406 125: _attach_parent_to_expr() node_aff97212 135: _attach_parent_to_exprs() node_aff97212->node_fbf06406 node_f86154ae 211: _load_attribute() node_dcee1306 85: _load_docstring() node_f86154ae->node_dcee1306 node_c0a2cc98 174: _load_class() node_c0a2cc98->node_aff97212 node_27753cdb 91: _load_decorators() node_c0a2cc98->node_27753cdb node_c0a2cc98->node_dcee1306 node_bec72c7d 95: _load_expression() node_28b97a29 197: _load_function() node_28b97a29->node_27753cdb node_28b97a29->node_dcee1306 node_01e9b304 159: _load_module() node_01e9b304->node_aff97212 node_01e9b304->node_dcee1306 node_0f5380ce 115: _load_parameter() node_0f5380ce->node_dcee1306 node_e921c743 242: json_decoder() node_e921c743->node_bec72c7d node_e921c743->node_0f5380ce

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_1a3ec27e File: expressions cluster_91b34319 Class: Expr cluster_62a61f8c Class: ExprAttribute cluster_37c0beb8 Class: ExprBinOp cluster_0401fa9f Class: ExprBoolOp cluster_c6657c55 Class: ExprCall cluster_436b3e9c Class: ExprCompare cluster_4a90e2c1 Class: ExprComprehension cluster_ea1e0f8e Class: ExprDict cluster_a9113693 Class: ExprDictComp cluster_1191d57b Class: ExprExtSlice cluster_221ece52 Class: ExprFormatted cluster_021a9865 Class: ExprGeneratorExp cluster_e12b001d Class: ExprIfExp cluster_ad9935c3 Class: ExprJoinedStr cluster_e73025a9 Class: ExprKeyword cluster_950e9e59 Class: ExprVarPositional cluster_2d081823 Class: ExprVarKeyword cluster_480a6283 Class: ExprLambda cluster_ffbe208e Class: ExprList cluster_dbe029ce Class: ExprListComp cluster_31b84df7 Class: ExprNamedExpr cluster_7eed432c Class: ExprSet cluster_6379be68 Class: ExprSetComp cluster_c9088b91 Class: ExprSlice cluster_2f468704 Class: ExprSubscript cluster_9810a3af Class: ExprTuple cluster_3b10cd3d Class: ExprUnaryOp cluster_e7612ca2 Class: ExprYield cluster_0857f5ce Class: ExprYieldFrom node_b1568af5 98: __iter__() node_b44aa130 102: iterate() node_b1568af5->node_b44aa130 node_002f47c9 95: __str__() node_002f47c9->node_b44aa130 node_79a82847 131: as_dict() node_6ae8d1ea 68: _expr_as_dict() node_79a82847->node_6ae8d1ea node_186c59e3 201: append() node_186c59e3->node_186c59e3 node_02092a21 193: iterate() node_62d78661 41: _join() node_02092a21->node_62d78661 node_76178482 246: iterate() node_650da01a 29: _yield() node_76178482->node_650da01a node_b0be3d7c 262: iterate() node_b0be3d7c->node_62d78661 node_009492e7 281: iterate() node_009492e7->node_62d78661 node_009492e7->node_650da01a node_0b0a2165 300: iterate() node_0b0a2165->node_62d78661 node_0b0a2165->node_650da01a node_0a9c911e 320: iterate() node_0a9c911e->node_62d78661 node_0a9c911e->node_650da01a node_0fbbcd85 358: iterate() node_0fbbcd85->node_62d78661 node_19874fd8 380: iterate() node_19874fd8->node_62d78661 node_19874fd8->node_650da01a node_631af123 397: iterate() node_631af123->node_62d78661 node_bea5019d 409: iterate() node_bea5019d->node_650da01a node_17e200b6 425: iterate() node_17e200b6->node_62d78661 node_17e200b6->node_650da01a node_3c226bf4 443: iterate() node_3c226bf4->node_650da01a node_a5014935 459: iterate() node_a5014935->node_62d78661 node_7f614d92 500: iterate() node_7f614d92->node_650da01a node_c327efa8 542: iterate() node_c327efa8->node_650da01a node_4a1f5648 583: iterate() node_4a1f5648->node_62d78661 node_3453f25c 599: iterate() node_3453f25c->node_62d78661 node_3453f25c->node_650da01a node_457f3729 704: iterate() node_457f3729->node_650da01a node_bb2509ff 735: iterate() node_bb2509ff->node_62d78661 node_d190ffb4 751: iterate() node_d190ffb4->node_62d78661 node_d190ffb4->node_650da01a node_24a273f1 771: iterate() node_24a273f1->node_650da01a node_fa470f72 799: _to_binop() node_fa470f72->node_fa470f72 node_69b81248 792: iterate() node_69b81248->node_650da01a node_8a273a9b 814: modernize() node_8a273a9b->node_fa470f72 node_8a273a9b->node_8a273a9b node_65a5164f 850: iterate() node_65a5164f->node_62d78661 node_b003fd7b 876: iterate() node_b003fd7b->node_650da01a node_dcb64e27 527: iterate() node_dcb64e27->node_650da01a node_4340b406 514: iterate() node_4340b406->node_650da01a node_6229bcdc 889: iterate() node_6229bcdc->node_650da01a node_592e9f8c 904: iterate() node_592e9f8c->node_650da01a node_3483e5ca 1233: _build() node_4d4e65c0 951: _build_attribute() node_4d4e65c0->node_186c59e3 node_4d4e65c0->node_3483e5ca node_24580151 963: _build_binop() node_24580151->node_3483e5ca node_69181415 971: _build_boolop() node_69181415->node_3483e5ca node_49a8725e 978: _build_call() node_49a8725e->node_3483e5ca node_78876f11 985: _build_compare() node_78876f11->node_3483e5ca node_d2f4edcf 993: _build_comprehension() node_d2f4edcf->node_3483e5ca node_42471ee5 1002: _build_constant() node_42471ee5->node_3483e5ca node_e1b32a90 1041: _build_dict() node_e1b32a90->node_3483e5ca node_24ad50ed 1048: _build_dictcomp() node_24ad50ed->node_3483e5ca node_987ff9be 1056: _build_formatted() node_987ff9be->node_3483e5ca node_f7940591 1066: _build_generatorexp() node_f7940591->node_3483e5ca node_93e30063 1073: _build_ifexp() node_93e30063->node_3483e5ca node_cd438b28 1081: _build_joinedstr() node_cd438b28->node_3483e5ca node_61260ce1 1091: _build_keyword() node_61260ce1->node_3483e5ca node_e61be32d 1097: _build_lambda() node_e61be32d->node_3483e5ca node_7ddbc669 1265: safe_get_expression() node_e61be32d->node_7ddbc669 node_85704b70 1114: _build_list() node_85704b70->node_3483e5ca node_78a27b78 1118: _build_listcomp() node_78a27b78->node_3483e5ca node_a71f7fa8 1126: _build_named_expr() node_a71f7fa8->node_3483e5ca node_b95f2688 1130: _build_set() node_b95f2688->node_3483e5ca node_34fb3666 1134: _build_setcomp() node_34fb3666->node_3483e5ca node_37e7615f 1138: _build_slice() node_37e7615f->node_3483e5ca node_6a683752 1146: _build_starred() node_6a683752->node_3483e5ca node_59134f8c 1150: _build_subscript() node_59134f8c->node_3483e5ca node_52c74e53 1179: _build_tuple() node_52c74e53->node_3483e5ca node_2a7b792a 1189: _build_unaryop() node_2a7b792a->node_3483e5ca node_6dbb6429 1193: _build_yield() node_6dbb6429->node_3483e5ca node_dadc1ff6 1197: _build_yield_from() node_dadc1ff6->node_3483e5ca node_82da569d 57: _field_as_dict() node_6ae8d1ea->node_82da569d node_82da569d->node_82da569d node_62d78661->node_650da01a node_650da01a->node_650da01a node_460e5cac 1237: get_expression() node_460e5cac->node_3483e5ca node_7ddbc669->node_460e5cac

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_79f4ec1e File: base cluster_de2549b2 Class: Extension cluster_96eb1d59 Class: Extensions node_9f7872ce 56: generic_inspect() node_fec53b60 48: inspect() node_9f7872ce->node_fec53b60 node_eb533db2 39: generic_visit() node_c7d4d15c 31: visit() node_eb533db2->node_c7d4d15c node_87c38d64 287: __init__() node_b2f69a85 296: add() node_87c38d64->node_b2f69a85 node_7dd5ebb6 333: _load_extension() node_4b0e506b 322: _load_extension_path() node_7dd5ebb6->node_4b0e506b node_dc758eec 424: load_extensions() node_dc758eec->node_87c38d64 node_dc758eec->node_b2f69a85 node_dc758eec->node_7dd5ebb6
dataclasses.pyΒ€

Built-in extension adding support for dataclasses.

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

G cluster_018bd995 File: dataclasses cluster_6d65ee5b Class: DataclassesExtension node_a1185b8a 227: on_package_loaded() node_c04eb610 203: _apply_recursively() node_a1185b8a->node_c04eb610 node_c04eb610->node_c04eb610 node_5a636b78 195: _del_members_annotated_as_initvar() node_c04eb610->node_5a636b78 node_c3c44b6c 157: _set_dataclass_init() node_c04eb610->node_c3c44b6c node_21791b46 49: _dataclass_arguments() node_1b657842 25: _dataclass_decorator() node_21791b46->node_1b657842 node_ef684ec2 32: _expr_args() node_21791b46->node_ef684ec2 node_0c31998e 66: _dataclass_parameters() node_0c31998e->node_21791b46 node_0277f6b6 55: _field_arguments() node_0c31998e->node_0277f6b6 node_ef684ec2->node_ef684ec2 node_0277f6b6->node_ef684ec2 node_644fd2f2 139: _reorder_parameters() node_c3c44b6c->node_1b657842 node_c3c44b6c->node_0c31998e node_c3c44b6c->node_644fd2f2

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_289fb188 File: finder cluster_bc6a975f Class: ModuleFinder node_b40ff626 102: __init__() node_a195041a 386: _extend_from_pth_files() node_b40ff626->node_a195041a node_6f576328 119: append_search_path() node_b40ff626->node_6f576328 node_57ae241b 374: _contents() node_a195041a->node_57ae241b node_a195041a->node_6f576328 node_c29a038d 442: _handle_pth_file() node_a195041a->node_c29a038d node_2ff5db55 395: _filter_py_modules() node_a025a48a 359: _module_name_path() node_b1f0b0b3 403: _top_module_name() node_0c02dfe4 132: insert_search_path() node_b1f0b0b3->node_0c02dfe4 node_98858dd5 229: find_package() node_98858dd5->node_57ae241b node_ef857c62 427: _is_pkg_style_namespace() node_98858dd5->node_ef857c62 node_c57b265b 146: find_spec() node_c57b265b->node_a025a48a node_c57b265b->node_b1f0b0b3 node_c57b265b->node_98858dd5 node_c1cd5bc3 276: iter_submodules() node_c1cd5bc3->node_2ff5db55 node_c1cd5bc3->node_c1cd5bc3 node_ca96b8ff 342: submodules() node_ca96b8ff->node_c1cd5bc3 node_d7c0efb3 472: _handle_editable_module() node_8a24d76a 51: _match_pattern() node_d7c0efb3->node_8a24d76a node_c29a038d->node_d7c0efb3

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_6b24accc File: git node_188ab1b1 25: _normalize() node_8436aaed 31: assert_git_repo() node_0120254f 102: tmp_worktree() node_0120254f->node_188ab1b1 node_0120254f->node_8436aaed

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_18259c99 File: importer node_61c31a28 17: _error_details() node_1768a524 43: dynamic_import() node_1768a524->node_61c31a28 node_f79c3efa 22: sys_path() node_1768a524->node_f79c3efa

loader.pyΒ€

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

G cluster_918f79b6 File: loader cluster_6bc4c52e Class: GriffeLoader node_37bb9998 52: __init__() node_0cdc8f02 627: _create_module() node_d2fb79ae 710: _expand_wildcard() node_a8d799cf 680: _get_or_create_parent_module() node_a8d799cf->node_0cdc8f02 node_1460d430 655: _inspect_module() node_538df499 528: _load_module() node_04cab8e5 547: _load_module_path() node_538df499->node_04cab8e5 node_04cab8e5->node_0cdc8f02 node_04cab8e5->node_1460d430 node_d8552efd 572: _load_submodules() node_04cab8e5->node_d8552efd node_07a5d9c1 635: _visit_module() node_04cab8e5->node_07a5d9c1 node_d8443058 513: _load_package() node_d8443058->node_538df499 node_d28c98c7 305: expand_wildcards() node_d8443058->node_d28c98c7 node_1d008920 576: _load_submodule() node_1d008920->node_a8d799cf node_1d008920->node_538df499 node_d8552efd->node_1d008920 node_a1138633 192: _post_load() node_aa1119e4 264: expand_exports() node_a1138633->node_aa1119e4 node_a1138633->node_d28c98c7 node_aa1119e4->node_aa1119e4 node_d28c98c7->node_d2fb79ae node_d28c98c7->node_d28c98c7 node_fb7063b7 100: load() node_d28c98c7->node_fb7063b7 node_fb7063b7->node_1460d430 node_fb7063b7->node_d8443058 node_fb7063b7->node_a1138633 node_afece07f 208: resolve_aliases() node_afece07f->node_d28c98c7 node_d6f98345 424: resolve_module_aliases() node_afece07f->node_d6f98345 node_d6f98345->node_fb7063b7 node_d6f98345->node_d6f98345 node_516ce0b1 719: load() node_516ce0b1->node_37bb9998 node_516ce0b1->node_fb7063b7 node_516ce0b1->node_afece07f node_17d112f3 824: load_git() node_17d112f3->node_516ce0b1 node_4cfca40f 909: load_pypi() node_4cfca40f->node_516ce0b1

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_6e8fd96b File: logger cluster_33f76ff7 Class: Logger node_ed9ce498 0: (global)() node_4cb19966 43: _get() node_ed9ce498->node_4cb19966 node_52eb8240 49: _patch_loggers() node_9132e5b4 93: get_logger() node_9132e5b4->node_4cb19966 node_899269c7 105: patch_loggers() node_899269c7->node_52eb8240

merger.pyΒ€

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

G cluster_3649438c File: merger node_7d68629b 35: _merge_attribute_stubs() node_380d8251 40: _merge_stubs_docstring() node_7d68629b->node_380d8251 node_b0afe9c8 21: _merge_class_stubs() node_b0afe9c8->node_380d8251 node_7fdecdd9 53: _merge_stubs_members() node_b0afe9c8->node_7fdecdd9 node_4d667687 45: _merge_stubs_overloads() node_b0afe9c8->node_4d667687 node_532155ce 27: _merge_function_stubs() node_532155ce->node_380d8251 node_5920bffa 15: _merge_module_stubs() node_5920bffa->node_380d8251 node_5920bffa->node_7fdecdd9 node_5920bffa->node_4d667687 node_7fdecdd9->node_7d68629b node_7fdecdd9->node_532155ce node_492afd1b 90: merge_stubs() node_492afd1b->node_5920bffa

mixins.pyΒ€

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

G cluster_0706623b File: mixins cluster_a747f2d4 Class: GetMembersMixin cluster_ccf5f4a1 Class: DelMembersMixin cluster_e84d4455 Class: SetMembersMixin node_660ea992 97: __delitem__() node_76282834 22: _get_parts() node_660ea992->node_76282834 node_83d7188c 124: del_member() node_83d7188c->node_83d7188c node_83d7188c->node_76282834 node_052b5179 42: __getitem__() node_052b5179->node_76282834 node_ac9ae093 64: get_member() node_ac9ae093->node_ac9ae093 node_ac9ae093->node_76282834 node_f1522471 157: __setitem__() node_f1522471->node_76282834 node_b693b4b6 183: set_member() node_b693b4b6->node_b693b4b6 node_b693b4b6->node_76282834

models.pyΒ€

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

G cluster_1e5b6b72 File: models cluster_4e895900 Class: Docstring cluster_4645f4fb Class: Parameter cluster_bc293f3b Class: Parameters cluster_82745f5b Class: Object cluster_8ce04e3c Class: Alias cluster_812d3690 Class: Class cluster_b32ec8dd Class: Function node_e45958af 1026: __init__() node_1945ae14 1748: _update_target_aliases() node_e45958af->node_1945ae14 node_8eb9e85a 1732: _resolve_target() node_4f7a38b1 1699: resolve_target() node_8eb9e85a->node_4f7a38b1 node_f506bd38 1203: as_json() node_f506bd38->node_f506bd38 node_ca7c1340 1384: filter_members() node_ca7c1340->node_ca7c1340 node_58d6a1b6 1371: has_labels() node_58d6a1b6->node_58d6a1b6 node_10da5954 1181: inherited_members() node_10da5954->node_e45958af node_a4829ca4 1302: is_kind() node_a4829ca4->node_a4829ca4 node_b81e3919 1161: members() node_b81e3919->node_e45958af node_c881399c 1142: parent() node_c881399c->node_1945ae14 node_5adc38f9 1493: resolve() node_5adc38f9->node_5adc38f9 node_c8f5b2e7 1650: target() node_c8f5b2e7->node_4f7a38b1 node_e4f4d271 1990: _mro() node_e4f4d271->node_e4f4d271 node_2b8f99a1 2001: mro() node_2b8f99a1->node_e4f4d271 node_88906079 1955: parameters() node_758338c1 297: __init__() node_88906079->node_758338c1 node_1bfbe5c8 154: parse() node_441e5314 150: parsed() node_441e5314->node_1bfbe5c8 node_3bdc22de 2031: __init__() node_3bdc22de->node_758338c1 node_4a6f87c0 577: inherited_members() node_4a6f87c0->node_e45958af node_18039529 931: resolve() node_18039529->node_18039529 node_152638ce 263: as_dict() node_152638ce->node_152638ce

stats.pyΒ€

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

G cluster_f96c9832 File: stats cluster_75ebdf50 Class: Stats node_0201ef92 20: __init__() node_afb41167 73: _itercount() node_0201ef92->node_afb41167 node_afb41167->node_afb41167

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_7dc025eb File: tests node_370cea64 397: module_vtree() node_748fcb1e 354: vtree() node_370cea64->node_748fcb1e node_4835dd37 303: temporary_inspected_module() node_456d6ab5 54: temporary_pyfile() node_4835dd37->node_456d6ab5 node_33720c07 186: temporary_inspected_package() node_ca67fe3d 72: temporary_pypackage() node_33720c07->node_ca67fe3d node_ab0501d8 257: temporary_visited_module() node_ab0501d8->node_456d6ab5 node_075e4281 121: temporary_visited_package() node_075e4281->node_ca67fe3d