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_998a9d73 File: inspector cluster_d152b503 Class: Inspector node_96aecbb4 100: __init__() node_96aecbb4->node_96aecbb4 node_de07f971 152: _get_docstring() node_528c09ad 174: _get_linenos() node_00c59034 240: generic_inspect() node_00c59034->node_96aecbb4 node_8583e166 232: inspect() node_00c59034->node_8583e166 node_f9e30b4c 277: inspect_module() node_00c59034->node_f9e30b4c node_edc9f0a8 184: get_module() node_edc9f0a8->node_8583e166 node_03fba8b4 485: handle_attribute() node_03fba8b4->node_de07f971 node_323f5bdb 419: handle_function() node_323f5bdb->node_de07f971 node_323f5bdb->node_528c09ad node_abb3c328 558: _convert_object_to_annotation() node_323f5bdb->node_abb3c328 node_c1dd9165 542: _convert_parameter() node_323f5bdb->node_c1dd9165 node_76d2a7e2 477: inspect_attribute() node_76d2a7e2->node_03fba8b4 node_4903d2b8 379: inspect_builtin_function() node_4903d2b8->node_323f5bdb node_c9421367 355: inspect_builtin_method() node_c9421367->node_323f5bdb node_de24574b 395: inspect_cached_property() node_de24574b->node_323f5bdb node_359351e3 299: inspect_class() node_359351e3->node_de07f971 node_359351e3->node_528c09ad node_359351e3->node_00c59034 node_1196c411 339: inspect_classmethod() node_1196c411->node_323f5bdb node_ec9029e0 371: inspect_coroutine() node_ec9029e0->node_323f5bdb node_2af36c73 387: inspect_function() node_2af36c73->node_323f5bdb node_2d493220 411: inspect_getset_descriptor() node_2d493220->node_323f5bdb node_a9e7f70a 363: inspect_method() node_a9e7f70a->node_323f5bdb node_59e85286 347: inspect_method_descriptor() node_59e85286->node_323f5bdb node_f9e30b4c->node_de07f971 node_3ecfd2fe 403: inspect_property() node_3ecfd2fe->node_323f5bdb node_5a9a3bec 331: inspect_staticmethod() node_5a9a3bec->node_323f5bdb node_c1dd9165->node_abb3c328 node_22777297 32: inspect() node_22777297->node_96aecbb4 node_22777297->node_edc9f0a8 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_cd4104fa File: assignments node_7d243bae 40: _get_annassign_names() node_76fb7129 23: get_name() node_7d243bae->node_76fb7129 node_49096e6e 35: _get_assign_names() node_49096e6e->node_76fb7129 node_3874819f 9: _get_attribute_name() node_3874819f->node_76fb7129 node_8d991933 63: get_instance_names() node_8acd6cdf 51: get_names() node_8d991933->node_8acd6cdf ast.py
This module contains utilities for navigating AST nodes.
G cluster_b0b08886 File: ast node_68739c07 26: ast_children() node_5032d7cd 137: ast_first_child() node_5032d7cd->node_68739c07 node_4e396476 155: ast_last_child() node_4e396476->node_68739c07 node_64bd7eb0 119: ast_next() node_c989ef97 66: ast_next_siblings() node_64bd7eb0->node_c989ef97 node_c989ef97->node_68739c07 node_5c3df54f 100: ast_previous() node_1b133262 50: ast_previous_siblings() node_5c3df54f->node_1b133262 node_1b133262->node_68739c07 node_ff61ec89 82: ast_siblings() node_ff61ec89->node_68739c07 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_c1d34d49 File: exports node_3e196c5d 74: _extract() node_b560689d 33: _extract_attribute() node_b560689d->node_3e196c5d node_58409269 37: _extract_binop() node_58409269->node_3e196c5d node_714e8840 51: _extract_sequence() node_714e8840->node_3e196c5d node_5bcb1874 58: _extract_starred() node_5bcb1874->node_3e196c5d node_64c3c6fc 78: get__all__() node_64c3c6fc->node_3e196c5d node_f7586b4c 93: safe_get__all__() node_f7586b4c->node_64c3c6fc 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_ab6f1e9c File: runtime cluster_cb230366 Class: ObjectNode node_afa6aed6 41: __init__() node_ce6f2942 238: _pick_member() node_7ede4730 248: alias_target_path() node_b941f3a1 25: _same_components() node_7ede4730->node_b941f3a1 node_ae69b000 141: children() node_ae69b000->node_afa6aed6 node_ae69b000->node_ce6f2942 values.py
This module contains utilities for extracting attribute values.
G cluster_26f06ee2 File: values node_8f3d2dd4 15: get_value() node_437c4743 29: safe_get_value() node_437c4743->node_8f3d2dd4 visitor.py
This module contains our static analysis agent, capable of parsing and visiting sources, statically.
G cluster_3e8d6edc File: visitor cluster_3a9577ff Class: Visitor node_1c369585 121: __init__() node_1c369585->node_1c369585 node_cc40c681 181: _get_docstring() node_fa92e7b9 292: decorators_to_labels() node_f1095d4d 215: generic_visit() node_bdc34608 207: visit() node_f1095d4d->node_bdc34608 node_36497173 310: get_base_property() node_8c28813a 193: get_module() node_8c28813a->node_bdc34608 node_6809d03a 508: handle_attribute() node_6809d03a->node_cc40c681 node_527f5484 334: handle_function() node_527f5484->node_cc40c681 node_527f5484->node_fa92e7b9 node_527f5484->node_f1095d4d node_527f5484->node_36497173 node_bba70e66 619: visit_annassign() node_bba70e66->node_6809d03a node_1dbd156a 611: visit_assign() node_1dbd156a->node_6809d03a node_c9e34549 445: visit_asyncfunctiondef() node_c9e34549->node_527f5484 node_1cb0bad1 246: visit_classdef() node_1cb0bad1->node_cc40c681 node_1cb0bad1->node_fa92e7b9 node_1cb0bad1->node_f1095d4d node_fbaebeb0 437: visit_functiondef() node_fbaebeb0->node_527f5484 node_af8a9178 648: visit_if() node_af8a9178->node_f1095d4d node_20f67fc2 224: visit_module() node_20f67fc2->node_cc40c681 node_20f67fc2->node_f1095d4d node_8a7b9195 64: visit() node_8a7b9195->node_1c369585 node_8a7b9195->node_8c28813a c3linear.py
This module contains a single function, c3linear_merge
. The function is generic enough to be in its own module.
G cluster_7d965f6f File: c3linear cluster_3a0ec146 Class: _Dependency cluster_2799d959 Class: _DependencyList node_2cbc4221 29: tail() node_815e378e 60: __len__() node_2cbc4221->node_815e378e node_1f5a02e7 48: __init__() node_45b7b7fe 64: __repr__() node_45b7b7fe->node_45b7b7fe node_170a0404 82: remove() node_6e43040f 93: c3linear_merge() node_6e43040f->node_1f5a02e7 node_6e43040f->node_170a0404 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_e471a941 File: cli cluster_cca7624d Class: _DebugInfo node_77a1999a 51: __init__() node_77a1999a->node_77a1999a node_2cb1ff5c 69: _load_packages() node_f8cbc748 59: _print_data() node_8db89e57 331: dump() node_8db89e57->node_2cb1ff5c node_8db89e57->node_f8cbc748 node_8bc6b1b4 130: get_parser() node_e215f462 575: main() node_e215f462->node_8bc6b1b4 collections.py
This module contains collection-related classes, which are used throughout the API.
G cluster_a66de0b7 File: collections cluster_43da35c2 Class: LinesCollection node_c02809d8 56: items() node_c02809d8->node_c02809d8 node_3a8997c1 40: keys() node_3a8997c1->node_3a8997c1 node_e5b6a32f 48: values() node_e5b6a32f->node_e5b6a32f 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_d95af7ae File: debug node_e34ef362 80: _get_debug_info() node_8bc8ab75 65: _get_version() node_e34ef362->node_8bc8ab75 node_37bd753d 54: _interpreter_name_version() node_e34ef362->node_37bd753d node_dea9f2b5 99: _print_debug_info() node_dea9f2b5->node_e34ef362 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_d74d6bda File: diff cluster_5049a3b7 Class: Breakage node_db27ad33 217: _explain_github() node_ae0a19c8 160: _format_new_value() node_db27ad33->node_ae0a19c8 node_723b9741 157: _format_old_value() node_db27ad33->node_723b9741 node_b0bbe8f4 151: _format_title() node_db27ad33->node_b0bbe8f4 node_dfdc7cf9 197: _explain_markdown() node_dfdc7cf9->node_ae0a19c8 node_dfdc7cf9->node_723b9741 node_4f6657d5 163: _explain_oneline() node_0b2facfb 154: _format_kind() node_4f6657d5->node_0b2facfb node_7660e22c 148: _format_location() node_4f6657d5->node_7660e22c node_4f6657d5->node_ae0a19c8 node_4f6657d5->node_723b9741 node_4f6657d5->node_b0bbe8f4 node_c79a7967 179: _explain_verbose() node_c79a7967->node_0b2facfb node_c79a7967->node_7660e22c node_c79a7967->node_ae0a19c8 node_c79a7967->node_723b9741 node_c79a7967->node_b0bbe8f4 node_2ce2b636 508: _alias_incompatibilities() node_af4f594a 545: _type_based_yield() node_2ce2b636->node_af4f594a node_abaa0fc9 497: _attribute_incompatibilities() node_f2a97ce6 409: _class_incompatibilities() node_5ce04d23 524: _member_incompatibilities() node_f2a97ce6->node_5ce04d23 node_0466366d 422: _function_incompatibilities() node_ccc676ba 582: _returns_are_compatible() node_0466366d->node_ccc676ba node_5ce04d23->node_af4f594a node_af4f594a->node_abaa0fc9 node_af4f594a->node_f2a97ce6 node_af4f594a->node_0466366d node_3f0b509a 606: find_breaking_changes() node_3f0b509a->node_5ce04d23 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_324ad580 File: google node_446ad2b5 485: _annotation_from_parent() node_7aa6ff11 456: _get_name_annotation_description() node_d54762d3 695: _is_empty_line() node_be354a4a 259: _read_attributes_section() node_49b0c2bb 83: _read_block_items() node_be354a4a->node_49b0c2bb node_4ec14e30 146: _read_block() node_4ec14e30->node_d54762d3 node_49b0c2bb->node_d54762d3 node_e4b4f62e 443: _read_block_items_maybe() node_e4b4f62e->node_4ec14e30 node_e4b4f62e->node_49b0c2bb node_457dccf3 330: _read_classes_section() node_457dccf3->node_49b0c2bb node_ee2349fe 636: _read_examples_section() node_ee2349fe->node_d54762d3 node_ee2349fe->node_4ec14e30 node_ff627ed5 295: _read_functions_section() node_ff627ed5->node_49b0c2bb node_cf7cee2f 365: _read_modules_section() node_cf7cee2f->node_49b0c2bb node_9df08c5d 248: _read_other_parameters_section() node_e26e56d5 177: _read_parameters() node_9df08c5d->node_e26e56d5 node_e26e56d5->node_49b0c2bb node_2a2fa8bd 238: _read_parameters_section() node_2a2fa8bd->node_e26e56d5 node_b8dabbdd 390: _read_raises_section() node_b8dabbdd->node_49b0c2bb node_6fe23cbf 592: _read_receives_section() node_6fe23cbf->node_446ad2b5 node_6fe23cbf->node_7aa6ff11 node_6fe23cbf->node_e4b4f62e node_e8c93581 504: _read_returns_section() node_e8c93581->node_446ad2b5 node_e8c93581->node_7aa6ff11 node_e8c93581->node_e4b4f62e node_d251483b 418: _read_warns_section() node_d251483b->node_49b0c2bb node_365ff47b 548: _read_yields_section() node_365ff47b->node_446ad2b5 node_365ff47b->node_7aa6ff11 node_365ff47b->node_e4b4f62e node_f6429841 717: parse_google() node_f6429841->node_d54762d3 node_f6429841->node_4ec14e30 models.py
This module contains the models for storing docstrings structured data.
G cluster_f43a4d71 File: models cluster_5cb1c82a Class: DocstringSection node_49776518 202: as_dict() node_49776518->node_49776518 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_68b6f2be File: numpy node_c9abe212 724: _append_section() node_2beae0dd 89: _is_dash_line() node_818af94d 85: _is_empty_line() node_2beae0dd->node_818af94d node_fa6ba934 534: _read_attributes_section() node_facfac71 93: _read_block_items() node_fa6ba934->node_facfac71 node_825f2396 153: _read_block() node_825f2396->node_2beae0dd node_825f2396->node_818af94d node_facfac71->node_2beae0dd node_facfac71->node_818af94d node_abb5ab77 601: _read_classes_section() node_abb5ab77->node_facfac71 node_1d91a1ee 316: _read_deprecated_section() node_1d91a1ee->node_facfac71 node_afda971e 661: _read_examples_section() node_afda971e->node_818af94d node_afda971e->node_825f2396 node_f68a0126 571: _read_functions_section() node_f68a0126->node_facfac71 node_f2bfb042 631: _read_modules_section() node_f2bfb042->node_facfac71 node_27e7ed7c 300: _read_other_parameters_section() node_adc98811 215: _read_parameters() node_27e7ed7c->node_adc98811 node_adc98811->node_facfac71 node_ccea8cb3 285: _read_parameters_section() node_ccea8cb3->node_adc98811 node_f2cfb9f1 488: _read_raises_section() node_f2cfb9f1->node_facfac71 node_0d6a8403 444: _read_receives_section() node_0d6a8403->node_facfac71 node_320f4e76 340: _read_returns_section() node_320f4e76->node_facfac71 node_fa1c54ae 511: _read_warns_section() node_fa1c54ae->node_facfac71 node_d8c60f23 396: _read_yields_section() node_d8c60f23->node_facfac71 node_abf4757a 760: parse_numpy() node_abf4757a->node_c9abe212 node_abf4757a->node_2beae0dd node_abf4757a->node_818af94d parsers.py
This module imports all the defined parsers and provides a generic function to parse docstrings.
G cluster_f74441a9 File: parsers node_45884c5d 107: infer_docstring_style() node_d7a0d9be 239: parse() node_d5f73db6 180: parse_auto() node_d5f73db6->node_45884c5d node_d5f73db6->node_d7a0d9be sphinx.py
This module defines functions to parse Sphinx docstrings into structured data.
G cluster_c8853b9b File: sphinx cluster_3316d553 Class: _FieldType node_6354aeff 49: matches() node_e7155ce5 400: _consolidate_continuation_lines() node_caf5c801 413: _consolidate_descriptive_type() node_31a5cda5 180: _determine_param_annotation() node_2ca24a2b 173: _determine_param_default() node_5d215cb3 388: _parse_directive() node_5d215cb3->node_e7155ce5 node_49aba02e 372: _parsed_values_to_sections() node_ceff6e69 417: _strip_blank_lines() node_49aba02e->node_ceff6e69 node_565c8f48 239: _read_attribute() node_565c8f48->node_5d215cb3 node_63eb103a 282: _read_attribute_type() node_63eb103a->node_caf5c801 node_63eb103a->node_5d215cb3 node_468ede0e 309: _read_exception() node_468ede0e->node_5d215cb3 node_853049ac 122: _read_parameter() node_853049ac->node_31a5cda5 node_853049ac->node_2ca24a2b node_853049ac->node_5d215cb3 node_0900f71e 212: _read_parameter_type() node_0900f71e->node_caf5c801 node_0900f71e->node_5d215cb3 node_e17b1a53 328: _read_return() node_e17b1a53->node_5d215cb3 node_89915ed5 353: _read_return_type() node_89915ed5->node_caf5c801 node_89915ed5->node_5d215cb3 node_4b9e12cd 86: parse_sphinx() node_4b9e12cd->node_6354aeff node_4b9e12cd->node_49aba02e 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_2eef21c2 File: encoders cluster_092e50d3 Class: JSONEncoder node_1ce3f68f 48: __init__() node_1ce3f68f->node_1ce3f68f node_4fb3075d 125: _attach_parent_to_expr() node_7e97ed3d 135: _attach_parent_to_exprs() node_7e97ed3d->node_4fb3075d node_632ddd88 211: _load_attribute() node_339db09b 85: _load_docstring() node_632ddd88->node_339db09b node_5aa6051d 174: _load_class() node_5aa6051d->node_7e97ed3d node_cfbd0d81 91: _load_decorators() node_5aa6051d->node_cfbd0d81 node_5aa6051d->node_339db09b node_0a30c644 95: _load_expression() node_89285bbf 197: _load_function() node_89285bbf->node_cfbd0d81 node_89285bbf->node_339db09b node_1c3a327b 159: _load_module() node_1c3a327b->node_7e97ed3d node_1c3a327b->node_339db09b node_488da27e 115: _load_parameter() node_488da27e->node_339db09b node_a53563b1 242: json_decoder() node_a53563b1->node_0a30c644 node_a53563b1->node_488da27e 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_24e39fbf File: expressions cluster_b518dce0 Class: Expr cluster_888de94e Class: ExprAttribute cluster_b0e66b31 Class: ExprBinOp cluster_ea5ea33c Class: ExprBoolOp cluster_5fbba6ae Class: ExprCall cluster_a7b6c46e Class: ExprCompare cluster_be49b9fb Class: ExprComprehension cluster_1139fc19 Class: ExprDict cluster_bcf6f749 Class: ExprDictComp cluster_32418bf6 Class: ExprExtSlice cluster_f8992e38 Class: ExprFormatted cluster_1bd84c9d Class: ExprGeneratorExp cluster_3de4e93c Class: ExprIfExp cluster_89fca1c4 Class: ExprJoinedStr cluster_6d22472d Class: ExprKeyword cluster_964a44fb Class: ExprVarPositional cluster_f5afaa38 Class: ExprVarKeyword cluster_245f0ff1 Class: ExprLambda cluster_97081ff0 Class: ExprList cluster_794d7833 Class: ExprListComp cluster_8d1de8bd Class: ExprNamedExpr cluster_a031fc9d Class: ExprSet cluster_d8a105a2 Class: ExprSetComp cluster_1a05f754 Class: ExprSlice cluster_bc44a7cf Class: ExprSubscript cluster_c5f99120 Class: ExprTuple cluster_b3261e94 Class: ExprUnaryOp cluster_b62951a9 Class: ExprYield cluster_c275f1f3 Class: ExprYieldFrom node_01f0cb9c 98: __iter__() node_a469aa13 102: iterate() node_01f0cb9c->node_a469aa13 node_1ea92b5f 95: __str__() node_1ea92b5f->node_a469aa13 node_163d9cb5 131: as_dict() node_63fa4e88 68: _expr_as_dict() node_163d9cb5->node_63fa4e88 node_584c4151 200: append() node_584c4151->node_584c4151 node_2561f023 192: iterate() node_ed8e88de 41: _join() node_2561f023->node_ed8e88de node_70542b2c 245: iterate() node_11e74e6c 29: _yield() node_70542b2c->node_11e74e6c node_242f5b4b 261: iterate() node_242f5b4b->node_ed8e88de node_71c614e0 280: iterate() node_71c614e0->node_ed8e88de node_71c614e0->node_11e74e6c node_8aebbb1e 299: iterate() node_8aebbb1e->node_ed8e88de node_8aebbb1e->node_11e74e6c node_9452ded0 319: iterate() node_9452ded0->node_ed8e88de node_9452ded0->node_11e74e6c node_fba38cc9 353: iterate() node_fba38cc9->node_ed8e88de node_c7bc013d 375: iterate() node_c7bc013d->node_ed8e88de node_c7bc013d->node_11e74e6c node_340ba2fa 392: iterate() node_340ba2fa->node_ed8e88de node_f09f314e 404: iterate() node_f09f314e->node_11e74e6c node_17487496 420: iterate() node_17487496->node_ed8e88de node_17487496->node_11e74e6c node_efcee432 438: iterate() node_efcee432->node_11e74e6c node_7cd4a91e 454: iterate() node_7cd4a91e->node_ed8e88de node_8d2f37c9 495: iterate() node_8d2f37c9->node_11e74e6c node_490acacd 537: iterate() node_490acacd->node_11e74e6c node_09a5bfad 578: iterate() node_09a5bfad->node_ed8e88de node_4c029476 594: iterate() node_4c029476->node_ed8e88de node_4c029476->node_11e74e6c node_1e199fc7 699: iterate() node_1e199fc7->node_11e74e6c node_a3be5a05 730: iterate() node_a3be5a05->node_ed8e88de node_c5e1be08 746: iterate() node_c5e1be08->node_ed8e88de node_c5e1be08->node_11e74e6c node_30751324 766: iterate() node_30751324->node_11e74e6c node_9ca257ec 794: _to_binop() node_9ca257ec->node_9ca257ec node_89b895ec 787: iterate() node_89b895ec->node_11e74e6c node_018cfc37 809: modernize() node_018cfc37->node_9ca257ec node_018cfc37->node_018cfc37 node_f7f8e91c 845: iterate() node_f7f8e91c->node_ed8e88de node_906a10f0 871: iterate() node_906a10f0->node_11e74e6c node_1e34381b 522: iterate() node_1e34381b->node_11e74e6c node_e4643589 509: iterate() node_e4643589->node_11e74e6c node_8b0a9a55 884: iterate() node_8b0a9a55->node_11e74e6c node_222179f2 899: iterate() node_222179f2->node_11e74e6c node_91509b28 1228: _build() node_8d022b2d 946: _build_attribute() node_8d022b2d->node_584c4151 node_8d022b2d->node_91509b28 node_f20232d7 958: _build_binop() node_f20232d7->node_91509b28 node_22c218f2 966: _build_boolop() node_22c218f2->node_91509b28 node_937b7ffc 973: _build_call() node_937b7ffc->node_91509b28 node_0c106594 980: _build_compare() node_0c106594->node_91509b28 node_f1dfc1ca 988: _build_comprehension() node_f1dfc1ca->node_91509b28 node_c04fe15c 997: _build_constant() node_c04fe15c->node_91509b28 node_f2f11f19 1036: _build_dict() node_f2f11f19->node_91509b28 node_9a4495ad 1043: _build_dictcomp() node_9a4495ad->node_91509b28 node_4e5ef161 1051: _build_formatted() node_4e5ef161->node_91509b28 node_9e7597d5 1061: _build_generatorexp() node_9e7597d5->node_91509b28 node_51625836 1068: _build_ifexp() node_51625836->node_91509b28 node_e9c9760d 1076: _build_joinedstr() node_e9c9760d->node_91509b28 node_054115ff 1086: _build_keyword() node_054115ff->node_91509b28 node_32aabdef 1092: _build_lambda() node_32aabdef->node_91509b28 node_a585cbc9 1260: safe_get_expression() node_32aabdef->node_a585cbc9 node_3a196802 1109: _build_list() node_3a196802->node_91509b28 node_59df9f79 1113: _build_listcomp() node_59df9f79->node_91509b28 node_e2faa21f 1121: _build_named_expr() node_e2faa21f->node_91509b28 node_571a2f90 1125: _build_set() node_571a2f90->node_91509b28 node_39a1204e 1129: _build_setcomp() node_39a1204e->node_91509b28 node_2a5f1c0f 1133: _build_slice() node_2a5f1c0f->node_91509b28 node_d531a898 1141: _build_starred() node_d531a898->node_91509b28 node_03331cb7 1145: _build_subscript() node_03331cb7->node_91509b28 node_db61625b 1174: _build_tuple() node_db61625b->node_91509b28 node_a713d8dd 1184: _build_unaryop() node_a713d8dd->node_91509b28 node_572c1c82 1188: _build_yield() node_572c1c82->node_91509b28 node_b53261c5 1192: _build_yield_from() node_b53261c5->node_91509b28 node_9d1de332 57: _field_as_dict() node_63fa4e88->node_9d1de332 node_9d1de332->node_9d1de332 node_ed8e88de->node_11e74e6c node_11e74e6c->node_11e74e6c node_f696f1e9 1232: get_expression() node_f696f1e9->node_91509b28 node_a585cbc9->node_f696f1e9 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_af050f2d File: base cluster_de5ab289 Class: Extension cluster_b703de43 Class: Extensions node_6cf26abe 56: generic_inspect() node_7206cff9 48: inspect() node_6cf26abe->node_7206cff9 node_fe7ad4d3 39: generic_visit() node_3dfe7787 31: visit() node_fe7ad4d3->node_3dfe7787 node_53283614 287: __init__() node_17e2f8de 296: add() node_53283614->node_17e2f8de node_7560cefd 333: _load_extension() node_425cd4d0 322: _load_extension_path() node_7560cefd->node_425cd4d0 node_0e4ddac4 424: load_extensions() node_0e4ddac4->node_53283614 node_0e4ddac4->node_17e2f8de node_0e4ddac4->node_7560cefd dataclasses.py
Built-in extension adding support for dataclasses.
This extension re-creates __init__
methods of dataclasses during static analysis.
G cluster_b00d9fe9 File: dataclasses cluster_1dc34409 Class: DataclassesExtension node_2ef60d6a 227: on_package_loaded() node_7b0d07a4 203: _apply_recursively() node_2ef60d6a->node_7b0d07a4 node_7b0d07a4->node_7b0d07a4 node_12910b15 195: _del_members_annotated_as_initvar() node_7b0d07a4->node_12910b15 node_0013fae0 157: _set_dataclass_init() node_7b0d07a4->node_0013fae0 node_3aa4c0b2 49: _dataclass_arguments() node_b088a1c8 25: _dataclass_decorator() node_3aa4c0b2->node_b088a1c8 node_06512dc9 32: _expr_args() node_3aa4c0b2->node_06512dc9 node_1dd3a799 66: _dataclass_parameters() node_1dd3a799->node_3aa4c0b2 node_7397b824 55: _field_arguments() node_1dd3a799->node_7397b824 node_06512dc9->node_06512dc9 node_7397b824->node_06512dc9 node_4b19d945 139: _reorder_parameters() node_0013fae0->node_b088a1c8 node_0013fae0->node_1dd3a799 node_0013fae0->node_4b19d945 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_b2fdb516 File: finder cluster_413086b6 Class: ModuleFinder node_4a914b60 102: __init__() node_2428b382 386: _extend_from_pth_files() node_4a914b60->node_2428b382 node_4cbb01ab 119: append_search_path() node_4a914b60->node_4cbb01ab node_db8d86d1 374: _contents() node_2428b382->node_db8d86d1 node_2428b382->node_4cbb01ab node_43eaa821 442: _handle_pth_file() node_2428b382->node_43eaa821 node_b0577b41 395: _filter_py_modules() node_7731b70f 359: _module_name_path() node_8a52dfcb 403: _top_module_name() node_e3a5a65f 132: insert_search_path() node_8a52dfcb->node_e3a5a65f node_45b23cad 229: find_package() node_45b23cad->node_db8d86d1 node_1d0ea82e 427: _is_pkg_style_namespace() node_45b23cad->node_1d0ea82e node_af15300d 146: find_spec() node_af15300d->node_7731b70f node_af15300d->node_8a52dfcb node_af15300d->node_45b23cad node_df15ecdf 276: iter_submodules() node_df15ecdf->node_b0577b41 node_df15ecdf->node_df15ecdf node_c27d9397 342: submodules() node_c27d9397->node_df15ecdf node_3e48700d 472: _handle_editable_module() node_62b991c0 51: _match_pattern() node_3e48700d->node_62b991c0 node_43eaa821->node_3e48700d 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_e5d6cb01 File: git node_12ac9eaa 25: _normalize() node_fdccacd1 31: assert_git_repo() node_655e5f35 102: tmp_worktree() node_655e5f35->node_12ac9eaa node_655e5f35->node_fdccacd1 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_56a5a179 File: importer node_8fc0cc4d 17: _error_details() node_1471edf6 43: dynamic_import() node_1471edf6->node_8fc0cc4d node_fcfe70da 22: sys_path() node_1471edf6->node_fcfe70da loader.py
This module contains all the logic for loading API data from sources or compiled modules.
G cluster_639b4c48 File: loader cluster_904e25da Class: GriffeLoader node_4c691082 53: __init__() node_c92dbf3a 625: _create_module() node_7a11072d 708: _expand_wildcard() node_a1500870 678: _get_or_create_parent_module() node_a1500870->node_c92dbf3a node_ef8fda28 653: _inspect_module() node_6b6e336d 528: _load_module() node_57701dca 547: _load_module_path() node_6b6e336d->node_57701dca node_57701dca->node_c92dbf3a node_57701dca->node_ef8fda28 node_1f083879 570: _load_submodules() node_57701dca->node_1f083879 node_13aca8df 633: _visit_module() node_57701dca->node_13aca8df node_31e21c67 512: _load_package() node_31e21c67->node_6b6e336d node_4b2f425b 306: expand_wildcards() node_31e21c67->node_4b2f425b node_03657158 574: _load_submodule() node_03657158->node_a1500870 node_03657158->node_6b6e336d node_1f083879->node_03657158 node_cc96ad21 193: _post_load() node_c3a91e5f 265: expand_exports() node_cc96ad21->node_c3a91e5f node_cc96ad21->node_4b2f425b node_c3a91e5f->node_c3a91e5f node_4b2f425b->node_7a11072d node_4b2f425b->node_4b2f425b node_51cce5a8 101: load() node_4b2f425b->node_51cce5a8 node_51cce5a8->node_ef8fda28 node_51cce5a8->node_31e21c67 node_51cce5a8->node_cc96ad21 node_1c16129a 209: resolve_aliases() node_1c16129a->node_4b2f425b node_2c4be529 423: resolve_module_aliases() node_1c16129a->node_2c4be529 node_2c4be529->node_51cce5a8 node_2c4be529->node_2c4be529 node_842ed588 717: load() node_842ed588->node_4c691082 node_842ed588->node_51cce5a8 node_842ed588->node_1c16129a node_a74d39bf 822: load_git() node_a74d39bf->node_842ed588 node_9f3b0337 907: load_pypi() node_9f3b0337->node_842ed588 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_5064caa7 File: logger cluster_322af552 Class: Logger node_8932c41b 0: (global)() node_2eb401c2 43: _get() node_8932c41b->node_2eb401c2 node_08779a4f 49: _patch_loggers() node_66c3a1d6 93: get_logger() node_66c3a1d6->node_2eb401c2 node_d8b6d572 105: patch_loggers() node_d8b6d572->node_08779a4f merger.py
This module contains utilities to merge stubs data and concrete data.
G cluster_50e00e94 File: merger node_c51089ca 35: _merge_attribute_stubs() node_459c54c6 40: _merge_stubs_docstring() node_c51089ca->node_459c54c6 node_15b47d64 21: _merge_class_stubs() node_15b47d64->node_459c54c6 node_2676ef09 53: _merge_stubs_members() node_15b47d64->node_2676ef09 node_42fa91d9 45: _merge_stubs_overloads() node_15b47d64->node_42fa91d9 node_71969d98 27: _merge_function_stubs() node_71969d98->node_459c54c6 node_4ca28295 15: _merge_module_stubs() node_4ca28295->node_459c54c6 node_4ca28295->node_2676ef09 node_4ca28295->node_42fa91d9 node_2676ef09->node_c51089ca node_2676ef09->node_71969d98 node_68a857e3 87: merge_stubs() node_68a857e3->node_4ca28295 mixins.py
This module contains some mixins classes that hold shared methods of the different kinds of objects, and aliases.
G cluster_83441845 File: mixins cluster_c66a818e Class: GetMembersMixin cluster_35884c26 Class: DelMembersMixin cluster_813147e8 Class: SetMembersMixin node_fe197858 97: __delitem__() node_4bb80c9d 22: _get_parts() node_fe197858->node_4bb80c9d node_e740bd18 124: del_member() node_e740bd18->node_e740bd18 node_e740bd18->node_4bb80c9d node_129be315 42: __getitem__() node_129be315->node_4bb80c9d node_3eaf0d08 64: get_member() node_3eaf0d08->node_3eaf0d08 node_3eaf0d08->node_4bb80c9d node_d1650093 157: __setitem__() node_d1650093->node_4bb80c9d node_66b682ad 183: set_member() node_66b682ad->node_66b682ad node_66b682ad->node_4bb80c9d models.py
This module contains our models definitions, to represent Python objects (and other aspects of Python APIs)... in Python.
G cluster_ec2a17a0 File: models cluster_278d329a Class: Docstring cluster_c10639b4 Class: Parameter cluster_0c4a7dde Class: Parameters cluster_0324951a Class: Object cluster_4b627f76 Class: Alias cluster_7f1c0051 Class: Class cluster_056a637e Class: Function node_05c81918 1027: __init__() node_deabcb3b 1749: _update_target_aliases() node_05c81918->node_deabcb3b node_2e8ba6ca 1733: _resolve_target() node_3f1c5051 1700: resolve_target() node_2e8ba6ca->node_3f1c5051 node_7e14d020 1204: as_json() node_7e14d020->node_7e14d020 node_d7637a5f 1385: filter_members() node_d7637a5f->node_d7637a5f node_2fb82f95 1372: has_labels() node_2fb82f95->node_2fb82f95 node_8f5b3ee1 1182: inherited_members() node_8f5b3ee1->node_05c81918 node_ac6b3cf7 1303: is_kind() node_ac6b3cf7->node_ac6b3cf7 node_8e3a69b7 1162: members() node_8e3a69b7->node_05c81918 node_44938d82 1143: parent() node_44938d82->node_deabcb3b node_96b2a528 1494: resolve() node_96b2a528->node_96b2a528 node_74aefc6d 1651: target() node_74aefc6d->node_3f1c5051 node_4a112d3d 1990: _mro() node_4a112d3d->node_4a112d3d node_d2b97a7c 2001: mro() node_d2b97a7c->node_4a112d3d node_607eca45 1955: parameters() node_9e119c36 297: __init__() node_607eca45->node_9e119c36 node_dcd29b7d 154: parse() node_5fe8200c 150: parsed() node_5fe8200c->node_dcd29b7d node_74fc5c49 2031: __init__() node_74fc5c49->node_9e119c36 node_fffce68c 577: inherited_members() node_fffce68c->node_05c81918 node_d4ce1c2a 931: resolve() node_d4ce1c2a->node_d4ce1c2a node_4547dca8 263: as_dict() node_4547dca8->node_4547dca8 stats.py
This module contains utilities to compute loading statistics, like time spent visiting modules statically or dynamically.
G cluster_8ea74dc9 File: stats cluster_1b067f29 Class: Stats node_c3d9dfe0 20: __init__() node_dc445351 73: _itercount() node_c3d9dfe0->node_dc445351 node_dc445351->node_dc445351 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_19b843e6 File: tests node_c6b2ad9d 396: module_vtree() node_a332a3c7 353: vtree() node_c6b2ad9d->node_a332a3c7 node_aef2bee8 302: temporary_inspected_module() node_537eb494 53: temporary_pyfile() node_aef2bee8->node_537eb494 node_c31bd8db 185: temporary_inspected_package() node_3747718c 71: temporary_pypackage() node_c31bd8db->node_3747718c node_39a62943 256: temporary_visited_module() node_39a62943->node_537eb494 node_533fe750 120: temporary_visited_package() node_533fe750->node_3747718c