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
GitHub workflows, issue templates and other configuration.
π ISSUE_TEMPLATE/ # (1)!
π workflows/ # (2)!
FUNDING.yml
1 -bug.md
2 -feature.md
3 -docs.md
4 -change.md
config.yml
The default virtual environment (git-ignored). See make setup
command.
The virtual environments for all supported Python versions (git-ignored). See make setup
command.
The configuration for VSCode (git-ignored). See make vscode
command.
launch.json
settings.json
tasks.json
Contains our tooling configuration. See Scripts, configuration .
π vscode/ # (1)!
coverage.ini
git-changelog.toml
mypy.ini
pytest.ini
ruff.toml
launch.json
settings.json
tasks.json
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
Customization of Material for MkDocs ' templates.
π partials/ # (1)!
main.html
comments.html
path-item.html
custom.css
insiders.css
material.css
mkdocstrings.css
π built-in/ # (1)!
π official/ # (2)!
π third-party/ # (3)!
built-in.md
official.md
third-party.md
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
docstring-inheritance.md
fieldz.md
generics.md
inherited-method-crossrefs.md
modernized-annotations.md
π contributors/ # (1)!
π users/ # (2)!
contributors.md
users.md
architecture.md
commands.md
setup.md
workflow.md
π how-to/ # (1)!
π recommendations/ # (2)!
checking.md
extending.md
loading.md
navigating.md
serializing.md
parse-docstrings.md
selectively-inspect.md
set-docstring-styles.md
support-decorators.md
docstrings.md
public-apis.md
python-code.md
favicon.ico
gha_annotations_1.png
gha_annotations_2.png
changelog.md
goals.yml
index.md
installation.md
π api/ # (1)!
api.md
cli.md
docstrings.md
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
alias.md
attribute.md
class.md
function .md
module.md
HTML report for Python code coverage (git-ignored), integrated in the Coverage report page. See make coverage
task.
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
Documentation site, built with make run mkdocs build
(git-ignored).
The source of our Python package(s). See Sources and Program structure .
π _griffe/ # (1)!
π griffe/ # (2)!
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
π nodes/ # (1)!
__init__.py
inspector.py
visitor.py
__init__.py
assignments.py
ast.py
docstrings.py
exports.py
imports.py
parameters.py
runtime.py
values.py
__init__.py
google.py
models.py
numpy.py
parsers.py
sphinx.py
utils.py
__init__.py
base.py
dataclasses.py
Our public API, exposed to users. See Program structure .
__init__.py
__main__.py
py.typed
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
__init__.py
conftest.py
helpers.py
test_google.py
test_numpy.py
test_sphinx.py
test_warnings.py
The answers file generated by Copier . See Boilerplate .
The environment configuration, automatically sourced by direnv . See commands .
A dummy makefile, only there for auto-completion. See commands .
Our project tasks, written with duty . See Tasks .
The build configuration for our docs. See make docs
task.
The project metadata and production dependencies.
Boilerplate This project's skeleton (the file-tree shown above) is actually generated from a Copier template called copier-uv . When generating the project, Copier asks a series of questions (configured by the template itself), and the answers are used to render the file and directory names, as well as the file contents. Copier also records answers in the .copier-answers.yml
file, allowing to update the project with latest changes from the template while reusing previous answers.
To update the project (in order to apply latest changes from the template), we use the following command:
copier update --trust --skip-answered
Scripts, configuration We have a few scripts that let us manage the various maintenance aspects for this project. The entry-point is the make
script located in the scripts
folder. It doesn't need any dependency to be installed to run. See Management commands for more information.
The make
script can also invoke what we call "tasks ". Tasks need our development dependencies to be installed to run. These tasks are written in the duties.py
file, and the development dependencies are listed in devdeps.txt
.
The tools used in tasks have their configuration files stored in the config
folder, to unclutter the root of the repository. The tasks take care of calling the tools with the right options to locate their respective configuration files.
Sources Sources are located in the src
folder, following the src-layout . We use PDM-Backend to build source and wheel distributions, and configure it in pyproject.toml
to search for packages in the src
folder.
Tests Our test suite is located in the tests
folder. It is located outside of the sources as to not pollute distributions (it would be very wrong to publish a tests
package as part of our distributions, since this name is extremely common), or worse, the public API. The tests
folder is however included in our source distributions (.tar.gz
), alongside most of our metadata and configuration files. Check out pyproject.toml
to get the full list of files included in our source distributions.
The test suite is based on pytest . Test modules reflect our internal API structure, and except for a few test modules that test specific aspects of our API, each test module tests the logic from the corresponding module in the internal API. For example, test_finder.py
tests code of the _griffe.finder
internal module, while test_functions
tests our ability to extract correct information from function signatures, statically. The general rule of thumb when writing new tests is to mirror the internal API. If a test touches to many aspects of the loading process, it can be added to the test_loader
test module.
Program structure Griffe is composed of two packages:
_griffe
, which is our internal API, hidden from users griffe
, which is our public API, exposed to users When installing the griffe
distribution from PyPI.org (or any other index where it is published), both the _griffe
and griffe
packages are installed. Users then import griffe
directly, or import objects from it. The top-level griffe/__init__.py
module exposes all the public API, by importing the internal objects from various submodules of _griffe
.
We'll be honest: our code organization is not the most elegant, but it works Have a look at the following module dependency graph, which will basically tell you nothing except that we have a lot of inter-module dependencies. Arrows read as "imports from". The code base is generally pleasant to work with though.
G _griffe _griffe _griffe_agents _griffe.agents _griffe_agents_inspector _griffe. agents. inspector _griffe_agents_nodes _griffe. agents. nodes _griffe_agents_inspector->_griffe_agents_nodes _griffe_agents_nodes_runtime _griffe. agents. nodes. runtime _griffe_agents_inspector->_griffe_agents_nodes_runtime _griffe_collections _griffe. collections _griffe_agents_inspector->_griffe_collections _griffe_enumerations _griffe. enumerations _griffe_agents_inspector->_griffe_enumerations _griffe_expressions _griffe. expressions _griffe_agents_inspector->_griffe_expressions _griffe_extensions _griffe. extensions _griffe_agents_inspector->_griffe_extensions _griffe_extensions_base _griffe. extensions. base _griffe_agents_inspector->_griffe_extensions_base _griffe_importer _griffe. importer _griffe_agents_inspector->_griffe_importer _griffe_logger _griffe.logger _griffe_agents_inspector->_griffe_logger _griffe_models _griffe.models _griffe_agents_inspector->_griffe_models _griffe_agents_nodes_assignments _griffe. agents. nodes. assignments _griffe_agents_nodes_ast _griffe. agents. nodes. ast _griffe_exceptions _griffe. exceptions _griffe_agents_nodes_ast->_griffe_exceptions _griffe_agents_nodes_docstrings _griffe. agents. nodes. docstrings _griffe_agents_nodes_exports _griffe. agents. nodes. exports _griffe_agents_nodes_values _griffe. agents. nodes. values _griffe_agents_nodes_exports->_griffe_agents_nodes_values _griffe_agents_nodes_exports->_griffe_enumerations _griffe_agents_nodes_exports->_griffe_expressions _griffe_agents_nodes_exports->_griffe_logger _griffe_agents_nodes_exports->_griffe_models _griffe_agents_nodes_imports _griffe. agents. nodes. imports _griffe_agents_nodes_imports->_griffe_models _griffe_agents_nodes_parameters _griffe. agents. nodes. parameters _griffe_agents_nodes_parameters->_griffe_enumerations _griffe_agents_nodes_runtime->_griffe_enumerations _griffe_agents_nodes_runtime->_griffe_logger _griffe_agents_nodes_values->_griffe_logger _griffe_agents_visitor _griffe. agents. visitor _griffe_agents_visitor->_griffe_agents_nodes _griffe_agents_visitor->_griffe_agents_nodes_assignments _griffe_agents_visitor->_griffe_agents_nodes_ast _griffe_agents_visitor->_griffe_agents_nodes_docstrings _griffe_agents_visitor->_griffe_agents_nodes_exports _griffe_agents_visitor->_griffe_agents_nodes_imports _griffe_agents_visitor->_griffe_agents_nodes_parameters _griffe_agents_visitor->_griffe_collections _griffe_agents_visitor->_griffe_enumerations _griffe_agents_visitor->_griffe_exceptions _griffe_agents_visitor->_griffe_expressions _griffe_agents_visitor->_griffe_extensions _griffe_agents_visitor->_griffe_models _griffe_c3linear _griffe. c3linear _griffe_cli _griffe.cli _griffe_diff _griffe.diff _griffe_cli->_griffe_diff _griffe_encoders _griffe. encoders _griffe_cli->_griffe_encoders _griffe_cli->_griffe_enumerations _griffe_cli->_griffe_exceptions _griffe_cli->_griffe_extensions _griffe_cli->_griffe_extensions_base _griffe_git _griffe.git _griffe_cli->_griffe_git _griffe_loader _griffe.loader _griffe_cli->_griffe_loader _griffe_cli->_griffe_logger _griffe_mixins _griffe.mixins _griffe_collections->_griffe_mixins _griffe_collections->_griffe_models _griffe_diff->_griffe_enumerations _griffe_diff->_griffe_exceptions _griffe_diff->_griffe_git _griffe_diff->_griffe_logger _griffe_diff->_griffe_models _griffe_docstrings _griffe. docstrings _griffe_docstrings_google _griffe. docstrings. google _griffe_docstrings_models _griffe. docstrings. models _griffe_docstrings_google->_griffe_docstrings_models _griffe_docstrings_utils _griffe. docstrings. utils _griffe_docstrings_google->_griffe_docstrings_utils _griffe_docstrings_google->_griffe_enumerations _griffe_docstrings_google->_griffe_expressions _griffe_docstrings_google->_griffe_models _griffe_docstrings_models->_griffe_enumerations _griffe_docstrings_models->_griffe_expressions _griffe_docstrings_numpy _griffe. docstrings. numpy _griffe_docstrings_numpy->_griffe_docstrings_models _griffe_docstrings_numpy->_griffe_docstrings_utils _griffe_docstrings_numpy->_griffe_enumerations _griffe_docstrings_numpy->_griffe_expressions _griffe_docstrings_numpy->_griffe_models _griffe_docstrings_parsers _griffe. docstrings. parsers _griffe_docstrings_parsers->_griffe_docstrings_google _griffe_docstrings_parsers->_griffe_docstrings_models _griffe_docstrings_parsers->_griffe_docstrings_numpy _griffe_docstrings_sphinx _griffe. docstrings. sphinx _griffe_docstrings_parsers->_griffe_docstrings_sphinx _griffe_docstrings_parsers->_griffe_enumerations _griffe_docstrings_sphinx->_griffe_docstrings_models _griffe_docstrings_sphinx->_griffe_docstrings_utils _griffe_docstrings_sphinx->_griffe_expressions _griffe_docstrings_sphinx->_griffe_models _griffe_docstrings_utils->_griffe_enumerations _griffe_docstrings_utils->_griffe_exceptions _griffe_docstrings_utils->_griffe_expressions _griffe_docstrings_utils->_griffe_logger _griffe_docstrings_utils->_griffe_models _griffe_encoders->_griffe_enumerations _griffe_encoders->_griffe_expressions _griffe_encoders->_griffe_models _griffe_exceptions->_griffe_models _griffe_expressions->_griffe_agents _griffe_expressions->_griffe_agents_nodes _griffe_expressions->_griffe_agents_nodes_parameters _griffe_expressions->_griffe_enumerations _griffe_expressions->_griffe_exceptions _griffe_expressions->_griffe_logger _griffe_expressions->_griffe_models _griffe_extensions_base->_griffe_agents _griffe_extensions_base->_griffe_agents_nodes _griffe_extensions_base->_griffe_agents_nodes_ast _griffe_extensions_base->_griffe_agents_nodes_runtime _griffe_extensions_base->_griffe_agents_visitor _griffe_extensions_base->_griffe_exceptions _griffe_extensions_dataclasses _griffe. extensions. dataclasses _griffe_extensions_base->_griffe_extensions_dataclasses _griffe_extensions_base->_griffe_importer _griffe_extensions_base->_griffe_loader _griffe_extensions_base->_griffe_models _griffe_extensions_dataclasses->_griffe_enumerations _griffe_extensions_dataclasses->_griffe_expressions _griffe_extensions_dataclasses->_griffe_logger _griffe_extensions_dataclasses->_griffe_models _griffe_finder _griffe.finder _griffe_finder->_griffe_exceptions _griffe_finder->_griffe_logger _griffe_finder->_griffe_models _griffe_git->_griffe_exceptions _griffe_loader->_griffe_agents _griffe_loader->_griffe_agents_inspector _griffe_loader->_griffe_agents_visitor _griffe_loader->_griffe_collections _griffe_loader->_griffe_enumerations _griffe_loader->_griffe_exceptions _griffe_loader->_griffe_expressions _griffe_loader->_griffe_extensions _griffe_loader->_griffe_finder _griffe_loader->_griffe_git _griffe_loader->_griffe_importer _griffe_loader->_griffe_logger _griffe_merger _griffe.merger _griffe_loader->_griffe_merger _griffe_loader->_griffe_models _griffe_stats _griffe.stats _griffe_loader->_griffe_stats _griffe_merger->_griffe_exceptions _griffe_merger->_griffe_logger _griffe_merger->_griffe_models _griffe_mixins->_griffe_encoders _griffe_mixins->_griffe_enumerations _griffe_mixins->_griffe_exceptions _griffe_mixins->_griffe_merger _griffe_mixins->_griffe_models _griffe_models->_griffe_c3linear _griffe_models->_griffe_docstrings _griffe_models->_griffe_docstrings_models _griffe_models->_griffe_docstrings_parsers _griffe_models->_griffe_enumerations _griffe_models->_griffe_logger _griffe_stats->_griffe_enumerations _griffe_stats->_griffe_models _griffe_tests _griffe.tests _griffe_tests->_griffe_agents _griffe_tests->_griffe_agents_inspector _griffe_tests->_griffe_agents_visitor _griffe_tests->_griffe_collections _griffe_tests->_griffe_enumerations _griffe_tests->_griffe_extensions _griffe_tests->_griffe_extensions_base _griffe_tests->_griffe_loader _griffe_tests->_griffe_models griffe griffe griffe->_griffe griffe->_griffe_agents griffe->_griffe_agents_inspector griffe->_griffe_agents_nodes griffe->_griffe_agents_nodes_assignments griffe->_griffe_agents_nodes_ast griffe->_griffe_agents_nodes_docstrings griffe->_griffe_agents_nodes_exports griffe->_griffe_agents_nodes_imports griffe->_griffe_agents_nodes_parameters griffe->_griffe_agents_nodes_runtime griffe->_griffe_agents_nodes_values griffe->_griffe_agents_visitor griffe->_griffe_c3linear griffe->_griffe_cli griffe->_griffe_collections griffe->_griffe_diff griffe->_griffe_docstrings griffe->_griffe_docstrings_google griffe->_griffe_docstrings_models griffe->_griffe_docstrings_numpy griffe->_griffe_docstrings_parsers griffe->_griffe_docstrings_sphinx griffe->_griffe_docstrings_utils griffe->_griffe_encoders griffe->_griffe_enumerations griffe->_griffe_exceptions griffe->_griffe_expressions griffe->_griffe_extensions griffe->_griffe_extensions_base griffe->_griffe_extensions_dataclasses griffe->_griffe_finder griffe->_griffe_git griffe->_griffe_importer griffe->_griffe_loader griffe->_griffe_logger griffe->_griffe_merger griffe->_griffe_mixins griffe->_griffe_models griffe->_griffe_stats griffe->_griffe_tests griffe___main__ griffe. __main__ griffe___main__->_griffe griffe___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_4b36c742 File: inspector cluster_87063ee5 Class: Inspector node_d442e9e6 100: __init__() node_d442e9e6->node_d442e9e6 node_76e707d5 152: _get_docstring() node_f0a57226 174: _get_linenos() node_6d5c7a89 240: generic_inspect() node_6d5c7a89->node_d442e9e6 node_47eda27d 232: inspect() node_6d5c7a89->node_47eda27d node_fcfe34e4 277: inspect_module() node_6d5c7a89->node_fcfe34e4 node_620bc34f 184: get_module() node_620bc34f->node_47eda27d node_60d0294a 485: handle_attribute() node_60d0294a->node_76e707d5 node_f24cc981 419: handle_function() node_f24cc981->node_76e707d5 node_f24cc981->node_f0a57226 node_27b5bd9e 558: _convert_object_to_annotation() node_f24cc981->node_27b5bd9e node_9748aeb9 542: _convert_parameter() node_f24cc981->node_9748aeb9 node_4b745af3 477: inspect_attribute() node_4b745af3->node_60d0294a node_b8a8aa86 379: inspect_builtin_function() node_b8a8aa86->node_f24cc981 node_6e5f21bc 355: inspect_builtin_method() node_6e5f21bc->node_f24cc981 node_f9d395f9 395: inspect_cached_property() node_f9d395f9->node_f24cc981 node_e2481e24 299: inspect_class() node_e2481e24->node_76e707d5 node_e2481e24->node_f0a57226 node_e2481e24->node_6d5c7a89 node_4667e582 339: inspect_classmethod() node_4667e582->node_f24cc981 node_93fa49c3 371: inspect_coroutine() node_93fa49c3->node_f24cc981 node_20d0f412 387: inspect_function() node_20d0f412->node_f24cc981 node_938c1e17 411: inspect_getset_descriptor() node_938c1e17->node_f24cc981 node_082f5f79 363: inspect_method() node_082f5f79->node_f24cc981 node_a3d52f80 347: inspect_method_descriptor() node_a3d52f80->node_f24cc981 node_fcfe34e4->node_76e707d5 node_cc93f99e 403: inspect_property() node_cc93f99e->node_f24cc981 node_652f4abb 331: inspect_staticmethod() node_652f4abb->node_f24cc981 node_9748aeb9->node_27b5bd9e node_6e0e5501 32: inspect() node_6e0e5501->node_d442e9e6 node_6e0e5501->node_620bc34f 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_2b8e64ea File: assignments node_4c452ca8 40: _get_annassign_names() node_98289570 23: get_name() node_4c452ca8->node_98289570 node_1b9cc433 35: _get_assign_names() node_1b9cc433->node_98289570 node_646bb3de 9: _get_attribute_name() node_646bb3de->node_98289570 node_65c442f3 63: get_instance_names() node_c4e23e8a 51: get_names() node_65c442f3->node_c4e23e8a ast.py
This module contains utilities for navigating AST nodes.
G cluster_e7be3896 File: ast node_15e0a87b 26: ast_children() node_d9054672 137: ast_first_child() node_d9054672->node_15e0a87b node_13c3f594 155: ast_last_child() node_13c3f594->node_15e0a87b node_319398f7 119: ast_next() node_fee1fe0c 66: ast_next_siblings() node_319398f7->node_fee1fe0c node_fee1fe0c->node_15e0a87b node_76737f96 100: ast_previous() node_928e6ebf 50: ast_previous_siblings() node_76737f96->node_928e6ebf node_928e6ebf->node_15e0a87b node_78847da9 82: ast_siblings() node_78847da9->node_15e0a87b 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_69a95f6e File: exports node_fe137764 74: _extract() node_c20c2da4 33: _extract_attribute() node_c20c2da4->node_fe137764 node_7515cd6c 37: _extract_binop() node_7515cd6c->node_fe137764 node_831cdb4d 51: _extract_sequence() node_831cdb4d->node_fe137764 node_57c8f0bd 58: _extract_starred() node_57c8f0bd->node_fe137764 node_61a10407 78: get__all__() node_61a10407->node_fe137764 node_8c7d9864 93: safe_get__all__() node_8c7d9864->node_61a10407 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_fb15a366 File: runtime cluster_c79c02f6 Class: ObjectNode node_4c059728 41: __init__() node_a2876bdc 238: _pick_member() node_b983406d 248: alias_target_path() node_6d5f95c9 25: _same_components() node_b983406d->node_6d5f95c9 node_eea74fa4 141: children() node_eea74fa4->node_4c059728 node_eea74fa4->node_a2876bdc values.py
This module contains utilities for extracting attribute values.
G cluster_0df293eb File: values node_7df40547 15: get_value() node_86c46b76 29: safe_get_value() node_86c46b76->node_7df40547 visitor.py
This module contains our static analysis agent, capable of parsing and visiting sources, statically.
G cluster_8a98242f File: visitor cluster_fbd45124 Class: Visitor node_034d770c 121: __init__() node_034d770c->node_034d770c node_f82319de 181: _get_docstring() node_361012b6 292: decorators_to_labels() node_8fe8b569 215: generic_visit() node_af90e690 207: visit() node_8fe8b569->node_af90e690 node_29750583 310: get_base_property() node_ce546379 193: get_module() node_ce546379->node_af90e690 node_f75ec78b 508: handle_attribute() node_f75ec78b->node_f82319de node_c5773f21 334: handle_function() node_c5773f21->node_f82319de node_c5773f21->node_361012b6 node_c5773f21->node_8fe8b569 node_c5773f21->node_29750583 node_891f41e1 619: visit_annassign() node_891f41e1->node_f75ec78b node_36941230 611: visit_assign() node_36941230->node_f75ec78b node_d1661daf 445: visit_asyncfunctiondef() node_d1661daf->node_c5773f21 node_eeed7122 246: visit_classdef() node_eeed7122->node_f82319de node_eeed7122->node_361012b6 node_eeed7122->node_8fe8b569 node_4a84073f 437: visit_functiondef() node_4a84073f->node_c5773f21 node_f2f1f98f 648: visit_if() node_f2f1f98f->node_8fe8b569 node_a08133e2 224: visit_module() node_a08133e2->node_f82319de node_a08133e2->node_8fe8b569 node_313995ff 64: visit() node_313995ff->node_034d770c node_313995ff->node_ce546379 c3linear.py
This module contains a single function, c3linear_merge
. The function is generic enough to be in its own module.
G cluster_8b4ce8da File: c3linear cluster_bba79c62 Class: _Dependency cluster_77ad9a1b Class: _DependencyList node_05711cf8 29: tail() node_684422c8 60: __len__() node_05711cf8->node_684422c8 node_651c9e77 48: __init__() node_25f28021 64: __repr__() node_25f28021->node_25f28021 node_2e19ff1a 82: remove() node_3862e420 93: c3linear_merge() node_3862e420->node_651c9e77 node_3862e420->node_2e19ff1a 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_7aa5e12b File: cli cluster_38afd060 Class: _DebugInfo node_058ada14 51: __init__() node_058ada14->node_058ada14 node_108a9a9d 69: _load_packages() node_899283a6 59: _print_data() node_7c1976da 331: dump() node_7c1976da->node_108a9a9d node_7c1976da->node_899283a6 node_5d38bb19 130: get_parser() node_9b0f37d7 575: main() node_9b0f37d7->node_5d38bb19 collections.py
This module contains collection-related classes, which are used throughout the API.
G cluster_178bddb8 File: collections cluster_8ab39ccd Class: LinesCollection node_ad7cf312 56: items() node_ad7cf312->node_ad7cf312 node_2396d511 40: keys() node_2396d511->node_2396d511 node_05f18431 48: values() node_05f18431->node_05f18431 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_c3d43c9d File: debug node_307a4ee8 80: _get_debug_info() node_25bcd391 65: _get_version() node_307a4ee8->node_25bcd391 node_eec234d4 54: _interpreter_name_version() node_307a4ee8->node_eec234d4 node_02781806 99: _print_debug_info() node_02781806->node_307a4ee8 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_6870efc8 File: diff cluster_e07ca705 Class: Breakage node_0c39a3de 217: _explain_github() node_df2be2d0 160: _format_new_value() node_0c39a3de->node_df2be2d0 node_50458a53 157: _format_old_value() node_0c39a3de->node_50458a53 node_b0fa2884 151: _format_title() node_0c39a3de->node_b0fa2884 node_828275a1 197: _explain_markdown() node_828275a1->node_df2be2d0 node_828275a1->node_50458a53 node_3c8b280d 163: _explain_oneline() node_784041b1 154: _format_kind() node_3c8b280d->node_784041b1 node_627d7fec 148: _format_location() node_3c8b280d->node_627d7fec node_3c8b280d->node_df2be2d0 node_3c8b280d->node_50458a53 node_3c8b280d->node_b0fa2884 node_a95f4f25 179: _explain_verbose() node_a95f4f25->node_784041b1 node_a95f4f25->node_627d7fec node_a95f4f25->node_df2be2d0 node_a95f4f25->node_50458a53 node_a95f4f25->node_b0fa2884 node_2e937476 508: _alias_incompatibilities() node_7c60d836 545: _type_based_yield() node_2e937476->node_7c60d836 node_9e7bd746 497: _attribute_incompatibilities() node_d3f2573b 409: _class_incompatibilities() node_ce6a8b03 524: _member_incompatibilities() node_d3f2573b->node_ce6a8b03 node_2e19dba6 422: _function_incompatibilities() node_cbde338d 582: _returns_are_compatible() node_2e19dba6->node_cbde338d node_ce6a8b03->node_7c60d836 node_7c60d836->node_9e7bd746 node_7c60d836->node_d3f2573b node_7c60d836->node_2e19dba6 node_a96037d3 606: find_breaking_changes() node_a96037d3->node_ce6a8b03 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_8383458e File: google node_ceae8d20 485: _annotation_from_parent() node_d487bf0c 456: _get_name_annotation_description() node_23648390 695: _is_empty_line() node_0b7c950c 259: _read_attributes_section() node_f8bbf6be 83: _read_block_items() node_0b7c950c->node_f8bbf6be node_4f849654 146: _read_block() node_4f849654->node_23648390 node_f8bbf6be->node_23648390 node_8f8070ad 443: _read_block_items_maybe() node_8f8070ad->node_4f849654 node_8f8070ad->node_f8bbf6be node_07a739fb 330: _read_classes_section() node_07a739fb->node_f8bbf6be node_9ac57a05 636: _read_examples_section() node_9ac57a05->node_23648390 node_9ac57a05->node_4f849654 node_a8a2c768 295: _read_functions_section() node_a8a2c768->node_f8bbf6be node_a733e1a0 365: _read_modules_section() node_a733e1a0->node_f8bbf6be node_25c9776f 248: _read_other_parameters_section() node_d710921b 177: _read_parameters() node_25c9776f->node_d710921b node_d710921b->node_f8bbf6be node_86b1639c 238: _read_parameters_section() node_86b1639c->node_d710921b node_c09b3045 390: _read_raises_section() node_c09b3045->node_f8bbf6be node_82db6c27 592: _read_receives_section() node_82db6c27->node_ceae8d20 node_82db6c27->node_d487bf0c node_82db6c27->node_8f8070ad node_5e7f3aaf 504: _read_returns_section() node_5e7f3aaf->node_ceae8d20 node_5e7f3aaf->node_d487bf0c node_5e7f3aaf->node_8f8070ad node_96c80697 418: _read_warns_section() node_96c80697->node_f8bbf6be node_1a3cb3f8 548: _read_yields_section() node_1a3cb3f8->node_ceae8d20 node_1a3cb3f8->node_d487bf0c node_1a3cb3f8->node_8f8070ad node_cd6c248f 717: parse_google() node_cd6c248f->node_23648390 node_cd6c248f->node_4f849654 models.py
This module contains the models for storing docstrings structured data.
G cluster_41b2674a File: models cluster_c740bd45 Class: DocstringSection node_e9f21238 202: as_dict() node_e9f21238->node_e9f21238 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_947e6e71 File: numpy node_5fe02e7f 724: _append_section() node_0c16caba 89: _is_dash_line() node_7af4ecc8 85: _is_empty_line() node_0c16caba->node_7af4ecc8 node_ea309961 534: _read_attributes_section() node_c8446809 93: _read_block_items() node_ea309961->node_c8446809 node_7d9d6c51 153: _read_block() node_7d9d6c51->node_0c16caba node_7d9d6c51->node_7af4ecc8 node_c8446809->node_0c16caba node_c8446809->node_7af4ecc8 node_31085a59 601: _read_classes_section() node_31085a59->node_c8446809 node_c7ea9e70 316: _read_deprecated_section() node_c7ea9e70->node_c8446809 node_c5a41f9a 661: _read_examples_section() node_c5a41f9a->node_7af4ecc8 node_c5a41f9a->node_7d9d6c51 node_11bdb589 571: _read_functions_section() node_11bdb589->node_c8446809 node_53eaacf5 631: _read_modules_section() node_53eaacf5->node_c8446809 node_f017f176 300: _read_other_parameters_section() node_749038a4 215: _read_parameters() node_f017f176->node_749038a4 node_749038a4->node_c8446809 node_7aa2d71c 285: _read_parameters_section() node_7aa2d71c->node_749038a4 node_60227619 488: _read_raises_section() node_60227619->node_c8446809 node_9127a51c 444: _read_receives_section() node_9127a51c->node_c8446809 node_a6b1ffd6 340: _read_returns_section() node_a6b1ffd6->node_c8446809 node_0bd91acd 511: _read_warns_section() node_0bd91acd->node_c8446809 node_2c21968a 396: _read_yields_section() node_2c21968a->node_c8446809 node_b6328b2e 760: parse_numpy() node_b6328b2e->node_5fe02e7f node_b6328b2e->node_0c16caba node_b6328b2e->node_7af4ecc8 parsers.py
This module imports all the defined parsers and provides a generic function to parse docstrings.
G cluster_e0e159dc File: parsers node_a24c91bd 107: infer_docstring_style() node_bbd1864f 239: parse() node_15b24d44 180: parse_auto() node_15b24d44->node_a24c91bd node_15b24d44->node_bbd1864f sphinx.py
This module defines functions to parse Sphinx docstrings into structured data.
G cluster_5a464d67 File: sphinx cluster_eb867010 Class: _FieldType node_9bb6a1ee 49: matches() node_3aede3b3 400: _consolidate_continuation_lines() node_0e243364 413: _consolidate_descriptive_type() node_4dd84a57 180: _determine_param_annotation() node_de841ac0 173: _determine_param_default() node_d02c147d 388: _parse_directive() node_d02c147d->node_3aede3b3 node_a9ba19d8 372: _parsed_values_to_sections() node_4683424b 417: _strip_blank_lines() node_a9ba19d8->node_4683424b node_83772e56 239: _read_attribute() node_83772e56->node_d02c147d node_c054cc76 282: _read_attribute_type() node_c054cc76->node_0e243364 node_c054cc76->node_d02c147d node_9ce206ab 309: _read_exception() node_9ce206ab->node_d02c147d node_45149feb 122: _read_parameter() node_45149feb->node_4dd84a57 node_45149feb->node_de841ac0 node_45149feb->node_d02c147d node_32e4aff1 212: _read_parameter_type() node_32e4aff1->node_0e243364 node_32e4aff1->node_d02c147d node_e86df27e 328: _read_return() node_e86df27e->node_d02c147d node_2b096b33 353: _read_return_type() node_2b096b33->node_0e243364 node_2b096b33->node_d02c147d node_3665b766 86: parse_sphinx() node_3665b766->node_9bb6a1ee node_3665b766->node_a9ba19d8 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_caec0e9f File: encoders cluster_8f524920 Class: JSONEncoder node_84e36d0f 48: __init__() node_84e36d0f->node_84e36d0f node_bbc9e073 125: _attach_parent_to_expr() node_546f029a 135: _attach_parent_to_exprs() node_546f029a->node_bbc9e073 node_092a1322 211: _load_attribute() node_8c05d375 85: _load_docstring() node_092a1322->node_8c05d375 node_ea8aee75 174: _load_class() node_ea8aee75->node_546f029a node_6b6a3963 91: _load_decorators() node_ea8aee75->node_6b6a3963 node_ea8aee75->node_8c05d375 node_16584024 95: _load_expression() node_a7adfbaa 197: _load_function() node_a7adfbaa->node_6b6a3963 node_a7adfbaa->node_8c05d375 node_d6864aec 159: _load_module() node_d6864aec->node_546f029a node_d6864aec->node_8c05d375 node_2134a4c7 115: _load_parameter() node_2134a4c7->node_8c05d375 node_d04b7361 242: json_decoder() node_d04b7361->node_16584024 node_d04b7361->node_2134a4c7 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_a37870da File: expressions cluster_5d897646 Class: Expr cluster_68e575a8 Class: ExprAttribute cluster_5806ed81 Class: ExprBinOp cluster_6d6ccd0d Class: ExprBoolOp cluster_94b688cf Class: ExprCall cluster_5242be2f Class: ExprCompare cluster_8d9a3d49 Class: ExprComprehension cluster_ed1d6a06 Class: ExprDict cluster_9a27628c Class: ExprDictComp cluster_106718ee Class: ExprExtSlice cluster_c038eae9 Class: ExprFormatted cluster_a44afee8 Class: ExprGeneratorExp cluster_223ba28b Class: ExprIfExp cluster_63fb8255 Class: ExprJoinedStr cluster_973fe9b2 Class: ExprKeyword cluster_b20df568 Class: ExprVarPositional cluster_79afb56e Class: ExprVarKeyword cluster_2cc9a9aa Class: ExprLambda cluster_bad02b45 Class: ExprList cluster_35148c4f Class: ExprListComp cluster_f793be5b Class: ExprNamedExpr cluster_c8d5af05 Class: ExprSet cluster_9a10dca7 Class: ExprSetComp cluster_d4ea2d30 Class: ExprSlice cluster_854f631f Class: ExprSubscript cluster_f13c02f1 Class: ExprTuple cluster_f99ccb0d Class: ExprUnaryOp cluster_fba4ad23 Class: ExprYield cluster_5248b56c Class: ExprYieldFrom node_f48905ff 98: __iter__() node_67d93ac1 102: iterate() node_f48905ff->node_67d93ac1 node_cbc7b543 95: __str__() node_cbc7b543->node_67d93ac1 node_d4941604 131: as_dict() node_29d3d6ea 68: _expr_as_dict() node_d4941604->node_29d3d6ea node_c9ea4cb3 201: append() node_c9ea4cb3->node_c9ea4cb3 node_954465e7 193: iterate() node_aa53e7fb 41: _join() node_954465e7->node_aa53e7fb node_1b00e811 246: iterate() node_b8b41a07 29: _yield() node_1b00e811->node_b8b41a07 node_4a9f83aa 262: iterate() node_4a9f83aa->node_aa53e7fb node_2f7f2eb6 281: iterate() node_2f7f2eb6->node_aa53e7fb node_2f7f2eb6->node_b8b41a07 node_970e0949 300: iterate() node_970e0949->node_aa53e7fb node_970e0949->node_b8b41a07 node_46471a78 320: iterate() node_46471a78->node_aa53e7fb node_46471a78->node_b8b41a07 node_84a29b59 354: iterate() node_84a29b59->node_aa53e7fb node_aa15ce81 376: iterate() node_aa15ce81->node_aa53e7fb node_aa15ce81->node_b8b41a07 node_dd88b42c 393: iterate() node_dd88b42c->node_aa53e7fb node_2bc66ede 405: iterate() node_2bc66ede->node_b8b41a07 node_678eb560 421: iterate() node_678eb560->node_aa53e7fb node_678eb560->node_b8b41a07 node_54e0e63d 439: iterate() node_54e0e63d->node_b8b41a07 node_b88c7485 455: iterate() node_b88c7485->node_aa53e7fb node_3477496e 496: iterate() node_3477496e->node_b8b41a07 node_196b76a7 538: iterate() node_196b76a7->node_b8b41a07 node_0995d83c 579: iterate() node_0995d83c->node_aa53e7fb node_4145d613 595: iterate() node_4145d613->node_aa53e7fb node_4145d613->node_b8b41a07 node_e41c2c6c 700: iterate() node_e41c2c6c->node_b8b41a07 node_6cac35b0 731: iterate() node_6cac35b0->node_aa53e7fb node_81940027 747: iterate() node_81940027->node_aa53e7fb node_81940027->node_b8b41a07 node_2a55ba44 767: iterate() node_2a55ba44->node_b8b41a07 node_98b24c5f 795: _to_binop() node_98b24c5f->node_98b24c5f node_982e2727 788: iterate() node_982e2727->node_b8b41a07 node_ccfd6348 810: modernize() node_ccfd6348->node_98b24c5f node_ccfd6348->node_ccfd6348 node_79609a60 846: iterate() node_79609a60->node_aa53e7fb node_4c1e9a4e 872: iterate() node_4c1e9a4e->node_b8b41a07 node_4b3d4332 523: iterate() node_4b3d4332->node_b8b41a07 node_d5b9a19f 510: iterate() node_d5b9a19f->node_b8b41a07 node_27b448a5 885: iterate() node_27b448a5->node_b8b41a07 node_b19f9c71 900: iterate() node_b19f9c71->node_b8b41a07 node_c7c2aeb4 1229: _build() node_747df10e 947: _build_attribute() node_747df10e->node_c9ea4cb3 node_747df10e->node_c7c2aeb4 node_d624a99a 959: _build_binop() node_d624a99a->node_c7c2aeb4 node_f5cf2a20 967: _build_boolop() node_f5cf2a20->node_c7c2aeb4 node_3a24d6ae 974: _build_call() node_3a24d6ae->node_c7c2aeb4 node_a6f0508d 981: _build_compare() node_a6f0508d->node_c7c2aeb4 node_a1968834 989: _build_comprehension() node_a1968834->node_c7c2aeb4 node_52bda18b 998: _build_constant() node_52bda18b->node_c7c2aeb4 node_97034cf3 1037: _build_dict() node_97034cf3->node_c7c2aeb4 node_5ab1fb77 1044: _build_dictcomp() node_5ab1fb77->node_c7c2aeb4 node_c55a874e 1052: _build_formatted() node_c55a874e->node_c7c2aeb4 node_4e944287 1062: _build_generatorexp() node_4e944287->node_c7c2aeb4 node_a9436b6f 1069: _build_ifexp() node_a9436b6f->node_c7c2aeb4 node_9f04cf47 1077: _build_joinedstr() node_9f04cf47->node_c7c2aeb4 node_95800948 1087: _build_keyword() node_95800948->node_c7c2aeb4 node_97112e21 1093: _build_lambda() node_97112e21->node_c7c2aeb4 node_d7b4580c 1261: safe_get_expression() node_97112e21->node_d7b4580c node_8c6262b9 1110: _build_list() node_8c6262b9->node_c7c2aeb4 node_865ca73a 1114: _build_listcomp() node_865ca73a->node_c7c2aeb4 node_d30ade31 1122: _build_named_expr() node_d30ade31->node_c7c2aeb4 node_bc28f334 1126: _build_set() node_bc28f334->node_c7c2aeb4 node_fee5bc2e 1130: _build_setcomp() node_fee5bc2e->node_c7c2aeb4 node_e0bd9211 1134: _build_slice() node_e0bd9211->node_c7c2aeb4 node_ffb3f082 1142: _build_starred() node_ffb3f082->node_c7c2aeb4 node_d07c8277 1146: _build_subscript() node_d07c8277->node_c7c2aeb4 node_d27eb51c 1175: _build_tuple() node_d27eb51c->node_c7c2aeb4 node_eedee47f 1185: _build_unaryop() node_eedee47f->node_c7c2aeb4 node_bd871229 1189: _build_yield() node_bd871229->node_c7c2aeb4 node_3c27124c 1193: _build_yield_from() node_3c27124c->node_c7c2aeb4 node_f5966e5c 57: _field_as_dict() node_29d3d6ea->node_f5966e5c node_f5966e5c->node_f5966e5c node_aa53e7fb->node_b8b41a07 node_b8b41a07->node_b8b41a07 node_0381b883 1233: get_expression() node_0381b883->node_c7c2aeb4 node_d7b4580c->node_0381b883 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_ac9a6089 File: base cluster_bf494897 Class: Extension cluster_d785921f Class: Extensions node_9b77db95 56: generic_inspect() node_3b296d8c 48: inspect() node_9b77db95->node_3b296d8c node_7a555f31 39: generic_visit() node_a070af00 31: visit() node_7a555f31->node_a070af00 node_e95afcf5 287: __init__() node_5d51c0de 296: add() node_e95afcf5->node_5d51c0de node_513e21c3 333: _load_extension() node_7ce32e29 322: _load_extension_path() node_513e21c3->node_7ce32e29 node_df346d28 424: load_extensions() node_df346d28->node_e95afcf5 node_df346d28->node_5d51c0de node_df346d28->node_513e21c3 dataclasses.py
Built-in extension adding support for dataclasses.
This extension re-creates __init__
methods of dataclasses during static analysis.
G cluster_1ed077ef File: dataclasses cluster_bc3dfa72 Class: DataclassesExtension node_6ad6aae4 227: on_package_loaded() node_2ffca7ed 203: _apply_recursively() node_6ad6aae4->node_2ffca7ed node_2ffca7ed->node_2ffca7ed node_fdc27002 195: _del_members_annotated_as_initvar() node_2ffca7ed->node_fdc27002 node_814d736b 157: _set_dataclass_init() node_2ffca7ed->node_814d736b node_786856e2 49: _dataclass_arguments() node_09611fd6 25: _dataclass_decorator() node_786856e2->node_09611fd6 node_292d0425 32: _expr_args() node_786856e2->node_292d0425 node_d8f7c08c 66: _dataclass_parameters() node_d8f7c08c->node_786856e2 node_33da10ed 55: _field_arguments() node_d8f7c08c->node_33da10ed node_292d0425->node_292d0425 node_33da10ed->node_292d0425 node_40ee8566 139: _reorder_parameters() node_814d736b->node_09611fd6 node_814d736b->node_d8f7c08c node_814d736b->node_40ee8566 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_2d5d512f File: finder cluster_966e51ed Class: ModuleFinder node_744d1c85 102: __init__() node_9dc41f3f 386: _extend_from_pth_files() node_744d1c85->node_9dc41f3f node_4095f3dc 119: append_search_path() node_744d1c85->node_4095f3dc node_2ff6a49a 374: _contents() node_9dc41f3f->node_2ff6a49a node_9dc41f3f->node_4095f3dc node_222948d6 442: _handle_pth_file() node_9dc41f3f->node_222948d6 node_d892670e 395: _filter_py_modules() node_fa4079e0 359: _module_name_path() node_a9979652 403: _top_module_name() node_dd989fff 132: insert_search_path() node_a9979652->node_dd989fff node_ec262f5f 229: find_package() node_ec262f5f->node_2ff6a49a node_1111792b 427: _is_pkg_style_namespace() node_ec262f5f->node_1111792b node_4a30acf8 146: find_spec() node_4a30acf8->node_fa4079e0 node_4a30acf8->node_a9979652 node_4a30acf8->node_ec262f5f node_24bf612b 276: iter_submodules() node_24bf612b->node_d892670e node_24bf612b->node_24bf612b node_7389b770 342: submodules() node_7389b770->node_24bf612b node_77cd4195 472: _handle_editable_module() node_9539cad8 51: _match_pattern() node_77cd4195->node_9539cad8 node_222948d6->node_77cd4195 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_9b0e7c3d File: git node_502be98c 25: _normalize() node_60c6fe41 31: assert_git_repo() node_79307024 102: tmp_worktree() node_79307024->node_502be98c node_79307024->node_60c6fe41 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_3f397b40 File: importer node_920f2645 17: _error_details() node_ff85f735 43: dynamic_import() node_ff85f735->node_920f2645 node_4fff6f7f 22: sys_path() node_ff85f735->node_4fff6f7f loader.py
This module contains all the logic for loading API data from sources or compiled modules.
G cluster_6e0f9ced File: loader cluster_ed08ca77 Class: GriffeLoader node_43a3b078 53: __init__() node_bb4bef7d 625: _create_module() node_f1d216b8 708: _expand_wildcard() node_3fe3fefb 678: _get_or_create_parent_module() node_3fe3fefb->node_bb4bef7d node_40756a12 653: _inspect_module() node_7ca437c6 528: _load_module() node_525ab714 547: _load_module_path() node_7ca437c6->node_525ab714 node_525ab714->node_bb4bef7d node_525ab714->node_40756a12 node_2a1701a7 570: _load_submodules() node_525ab714->node_2a1701a7 node_adfbe33f 633: _visit_module() node_525ab714->node_adfbe33f node_138b1381 512: _load_package() node_138b1381->node_7ca437c6 node_d658a4ed 306: expand_wildcards() node_138b1381->node_d658a4ed node_c4109b5e 574: _load_submodule() node_c4109b5e->node_3fe3fefb node_c4109b5e->node_7ca437c6 node_2a1701a7->node_c4109b5e node_763d6198 193: _post_load() node_f2c21c10 265: expand_exports() node_763d6198->node_f2c21c10 node_763d6198->node_d658a4ed node_f2c21c10->node_f2c21c10 node_d658a4ed->node_f1d216b8 node_d658a4ed->node_d658a4ed node_bab4726e 101: load() node_d658a4ed->node_bab4726e node_bab4726e->node_40756a12 node_bab4726e->node_138b1381 node_bab4726e->node_763d6198 node_63ebb59b 209: resolve_aliases() node_63ebb59b->node_d658a4ed node_ac74e81c 423: resolve_module_aliases() node_63ebb59b->node_ac74e81c node_ac74e81c->node_bab4726e node_ac74e81c->node_ac74e81c node_473bcac4 717: load() node_473bcac4->node_43a3b078 node_473bcac4->node_bab4726e node_473bcac4->node_63ebb59b node_888eca3b 822: load_git() node_888eca3b->node_473bcac4 node_fbe9acb1 907: load_pypi() node_fbe9acb1->node_473bcac4 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_d8e5da1b File: logger cluster_28107d1c Class: Logger node_53f9b508 0: (global)() node_268d20ef 43: _get() node_53f9b508->node_268d20ef node_e2cf8df3 49: _patch_loggers() node_149c7231 93: get_logger() node_149c7231->node_268d20ef node_08d7abc7 105: patch_loggers() node_08d7abc7->node_e2cf8df3 merger.py
This module contains utilities to merge stubs data and concrete data.
G cluster_ec1cf8a3 File: merger node_cc2e65b2 35: _merge_attribute_stubs() node_ad70b747 40: _merge_stubs_docstring() node_cc2e65b2->node_ad70b747 node_341ceaff 21: _merge_class_stubs() node_341ceaff->node_ad70b747 node_f63f341e 53: _merge_stubs_members() node_341ceaff->node_f63f341e node_89477d79 45: _merge_stubs_overloads() node_341ceaff->node_89477d79 node_dd087b08 27: _merge_function_stubs() node_dd087b08->node_ad70b747 node_94111be7 15: _merge_module_stubs() node_94111be7->node_ad70b747 node_94111be7->node_f63f341e node_94111be7->node_89477d79 node_f63f341e->node_cc2e65b2 node_f63f341e->node_dd087b08 node_ad7ab2ca 87: merge_stubs() node_ad7ab2ca->node_94111be7 mixins.py
This module contains some mixins classes that hold shared methods of the different kinds of objects, and aliases.
G cluster_720b8633 File: mixins cluster_152b6547 Class: GetMembersMixin cluster_30e899a3 Class: DelMembersMixin cluster_5028e4e9 Class: SetMembersMixin node_0757e1b5 97: __delitem__() node_14c9001d 22: _get_parts() node_0757e1b5->node_14c9001d node_a20ff488 124: del_member() node_a20ff488->node_a20ff488 node_a20ff488->node_14c9001d node_4d816e88 42: __getitem__() node_4d816e88->node_14c9001d node_a46ba71a 64: get_member() node_a46ba71a->node_a46ba71a node_a46ba71a->node_14c9001d node_fd7a253e 157: __setitem__() node_fd7a253e->node_14c9001d node_6c8b8813 183: set_member() node_6c8b8813->node_6c8b8813 node_6c8b8813->node_14c9001d models.py
This module contains our models definitions, to represent Python objects (and other aspects of Python APIs)... in Python.
G cluster_ce0c5418 File: models cluster_9e9278b0 Class: Docstring cluster_ebcb679e Class: Parameter cluster_f8b903e7 Class: Parameters cluster_7c806fbb Class: Object cluster_9fd9c05b Class: Alias cluster_53d39f2b Class: Class cluster_876e32fd Class: Function node_b8a9990b 1027: __init__() node_ab0920c3 1749: _update_target_aliases() node_b8a9990b->node_ab0920c3 node_bc53a0fa 1733: _resolve_target() node_9ac2f690 1700: resolve_target() node_bc53a0fa->node_9ac2f690 node_55822a4c 1204: as_json() node_55822a4c->node_55822a4c node_a5d904e2 1385: filter_members() node_a5d904e2->node_a5d904e2 node_011a5e79 1372: has_labels() node_011a5e79->node_011a5e79 node_4e8faf36 1182: inherited_members() node_4e8faf36->node_b8a9990b node_6f404b5d 1303: is_kind() node_6f404b5d->node_6f404b5d node_e5d02ff8 1162: members() node_e5d02ff8->node_b8a9990b node_0fb3cf70 1143: parent() node_0fb3cf70->node_ab0920c3 node_de7b4966 1494: resolve() node_de7b4966->node_de7b4966 node_f85832a2 1651: target() node_f85832a2->node_9ac2f690 node_4ee32aaa 1990: _mro() node_4ee32aaa->node_4ee32aaa node_f979bd50 2001: mro() node_f979bd50->node_4ee32aaa node_cbc0143c 1955: parameters() node_3a36b39f 297: __init__() node_cbc0143c->node_3a36b39f node_bdab5da4 154: parse() node_78fcccb6 150: parsed() node_78fcccb6->node_bdab5da4 node_1b243e70 2031: __init__() node_1b243e70->node_3a36b39f node_ac2b75e8 577: inherited_members() node_ac2b75e8->node_b8a9990b node_d23872c8 931: resolve() node_d23872c8->node_d23872c8 node_da57babb 263: as_dict() node_da57babb->node_da57babb stats.py
This module contains utilities to compute loading statistics, like time spent visiting modules statically or dynamically.
G cluster_c7586654 File: stats cluster_f84d9a62 Class: Stats node_e1526d9c 20: __init__() node_869d10cc 73: _itercount() node_e1526d9c->node_869d10cc node_869d10cc->node_869d10cc 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_1f6075ce File: tests node_6e0713df 396: module_vtree() node_f8f7a14a 353: vtree() node_6e0713df->node_f8f7a14a node_911b36fa 302: temporary_inspected_module() node_7145b32e 53: temporary_pyfile() node_911b36fa->node_7145b32e node_3d929f3c 185: temporary_inspected_package() node_bfaf09dd 71: temporary_pypackage() node_3d929f3c->node_bfaf09dd node_8642dc6b 256: temporary_visited_module() node_8642dc6b->node_7145b32e node_cc7d2a39 120: temporary_visited_package() node_cc7d2a39->node_bfaf09dd