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
type_alias.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_api.py
test_cli.py
test_diff.py
test_encoders.py
test_expressions.py
test_extensions.py
test_finder.py
test_functions.py
test_git.py
test_inheritance.py
test_inspector.py
test_loader.py
test_merger.py
test_mixins.py
test_models.py
test_nodes.py
test_public_api.py
test_stdlib.py
test_visitor.py
__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_docstrings _griffe. docstrings _griffe_agents_inspector->_griffe_docstrings _griffe_docstrings_parsers _griffe. docstrings. parsers _griffe_agents_inspector->_griffe_docstrings_parsers _griffe_enumerations _griffe. enumerations _griffe_agents_inspector->_griffe_enumerations _griffe_expressions _griffe. expressions _griffe_agents_inspector->_griffe_expressions _griffe_extensions _griffe. extensions _griffe_agents_inspector->_griffe_extensions _griffe_extensions_base _griffe. extensions. base _griffe_agents_inspector->_griffe_extensions_base _griffe_importer _griffe. importer _griffe_agents_inspector->_griffe_importer _griffe_logger _griffe.logger _griffe_agents_inspector->_griffe_logger _griffe_models _griffe.models _griffe_agents_inspector->_griffe_models _griffe_agents_nodes_assignments _griffe. agents. nodes. assignments _griffe_agents_nodes_ast _griffe. agents. nodes. ast _griffe_exceptions _griffe. exceptions _griffe_agents_nodes_ast->_griffe_exceptions _griffe_agents_nodes_docstrings _griffe. agents. nodes. docstrings _griffe_agents_nodes_exports _griffe. agents. nodes. exports _griffe_agents_nodes_values _griffe. agents. nodes. values _griffe_agents_nodes_exports->_griffe_agents_nodes_values _griffe_agents_nodes_exports->_griffe_enumerations _griffe_agents_nodes_exports->_griffe_expressions _griffe_agents_nodes_exports->_griffe_logger _griffe_agents_nodes_exports->_griffe_models _griffe_agents_nodes_imports _griffe. agents. nodes. imports _griffe_agents_nodes_imports->_griffe_models _griffe_agents_nodes_parameters _griffe. agents. nodes. parameters _griffe_agents_nodes_parameters->_griffe_enumerations _griffe_agents_nodes_runtime->_griffe_enumerations _griffe_agents_nodes_runtime->_griffe_logger _griffe_agents_nodes_values->_griffe_logger _griffe_agents_visitor _griffe. agents. visitor _griffe_agents_visitor->_griffe_agents_nodes _griffe_agents_visitor->_griffe_agents_nodes_assignments _griffe_agents_visitor->_griffe_agents_nodes_ast _griffe_agents_visitor->_griffe_agents_nodes_docstrings _griffe_agents_visitor->_griffe_agents_nodes_exports _griffe_agents_visitor->_griffe_agents_nodes_imports _griffe_agents_visitor->_griffe_agents_nodes_parameters _griffe_agents_visitor->_griffe_collections _griffe_agents_visitor->_griffe_docstrings _griffe_agents_visitor->_griffe_docstrings_parsers _griffe_agents_visitor->_griffe_enumerations _griffe_agents_visitor->_griffe_exceptions _griffe_agents_visitor->_griffe_expressions _griffe_agents_visitor->_griffe_extensions _griffe_agents_visitor->_griffe_models _griffe_c3linear _griffe. c3linear _griffe_cli _griffe.cli _griffe_diff _griffe.diff _griffe_cli->_griffe_diff _griffe_encoders _griffe. encoders _griffe_cli->_griffe_encoders _griffe_cli->_griffe_enumerations _griffe_cli->_griffe_exceptions _griffe_cli->_griffe_extensions _griffe_cli->_griffe_extensions_base _griffe_git _griffe.git _griffe_cli->_griffe_git _griffe_loader _griffe.loader _griffe_cli->_griffe_loader _griffe_cli->_griffe_logger _griffe_mixins _griffe.mixins _griffe_collections->_griffe_mixins _griffe_collections->_griffe_models _griffe_diff->_griffe_enumerations _griffe_diff->_griffe_exceptions _griffe_diff->_griffe_git _griffe_diff->_griffe_logger _griffe_diff->_griffe_models _griffe_docstrings_google _griffe. docstrings. google _griffe_docstrings_models _griffe. docstrings. models _griffe_docstrings_google->_griffe_docstrings_models _griffe_docstrings_utils _griffe. docstrings. utils _griffe_docstrings_google->_griffe_docstrings_utils _griffe_docstrings_google->_griffe_enumerations _griffe_docstrings_google->_griffe_expressions _griffe_docstrings_google->_griffe_models _griffe_docstrings_models->_griffe_enumerations _griffe_docstrings_models->_griffe_expressions _griffe_docstrings_numpy _griffe. docstrings. numpy _griffe_docstrings_numpy->_griffe_docstrings_models _griffe_docstrings_numpy->_griffe_docstrings_utils _griffe_docstrings_numpy->_griffe_enumerations _griffe_docstrings_numpy->_griffe_expressions _griffe_docstrings_numpy->_griffe_models _griffe_docstrings_parsers->_griffe_docstrings_google _griffe_docstrings_parsers->_griffe_docstrings_models _griffe_docstrings_parsers->_griffe_docstrings_numpy _griffe_docstrings_sphinx _griffe. docstrings. sphinx _griffe_docstrings_parsers->_griffe_docstrings_sphinx _griffe_docstrings_parsers->_griffe_enumerations _griffe_docstrings_sphinx->_griffe_docstrings_models _griffe_docstrings_sphinx->_griffe_docstrings_utils _griffe_docstrings_sphinx->_griffe_expressions _griffe_docstrings_sphinx->_griffe_models _griffe_docstrings_utils->_griffe_enumerations _griffe_docstrings_utils->_griffe_exceptions _griffe_docstrings_utils->_griffe_expressions _griffe_docstrings_utils->_griffe_logger _griffe_docstrings_utils->_griffe_models _griffe_encoders->_griffe_enumerations _griffe_encoders->_griffe_expressions _griffe_encoders->_griffe_models _griffe_exceptions->_griffe_models _griffe_expressions->_griffe_agents _griffe_expressions->_griffe_agents_nodes _griffe_expressions->_griffe_agents_nodes_parameters _griffe_expressions->_griffe_enumerations _griffe_expressions->_griffe_exceptions _griffe_expressions->_griffe_logger _griffe_expressions->_griffe_models _griffe_extensions_base->_griffe_agents _griffe_extensions_base->_griffe_agents_nodes _griffe_extensions_base->_griffe_agents_nodes_ast _griffe_extensions_base->_griffe_agents_nodes_runtime _griffe_extensions_base->_griffe_agents_visitor _griffe_extensions_base->_griffe_exceptions _griffe_extensions_dataclasses _griffe. extensions. dataclasses _griffe_extensions_base->_griffe_extensions_dataclasses _griffe_extensions_base->_griffe_importer _griffe_extensions_base->_griffe_loader _griffe_extensions_base->_griffe_models _griffe_extensions_dataclasses->_griffe_enumerations _griffe_extensions_dataclasses->_griffe_expressions _griffe_extensions_dataclasses->_griffe_logger _griffe_extensions_dataclasses->_griffe_models _griffe_finder _griffe.finder _griffe_finder->_griffe_exceptions _griffe_finder->_griffe_logger _griffe_finder->_griffe_models _griffe_git->_griffe_exceptions _griffe_loader->_griffe_agents _griffe_loader->_griffe_agents_inspector _griffe_loader->_griffe_agents_visitor _griffe_loader->_griffe_collections _griffe_loader->_griffe_docstrings _griffe_loader->_griffe_docstrings_parsers _griffe_loader->_griffe_enumerations _griffe_loader->_griffe_exceptions _griffe_loader->_griffe_expressions _griffe_loader->_griffe_extensions _griffe_loader->_griffe_finder _griffe_loader->_griffe_git _griffe_loader->_griffe_importer _griffe_loader->_griffe_logger _griffe_merger _griffe.merger _griffe_loader->_griffe_merger _griffe_loader->_griffe_models _griffe_stats _griffe.stats _griffe_loader->_griffe_stats _griffe_merger->_griffe_exceptions _griffe_merger->_griffe_logger _griffe_merger->_griffe_models _griffe_mixins->_griffe_encoders _griffe_mixins->_griffe_enumerations _griffe_mixins->_griffe_exceptions _griffe_mixins->_griffe_merger _griffe_mixins->_griffe_models _griffe_models->_griffe_c3linear _griffe_models->_griffe_docstrings _griffe_models->_griffe_docstrings_models _griffe_models->_griffe_docstrings_parsers _griffe_models->_griffe_enumerations _griffe_models->_griffe_logger _griffe_stats->_griffe_enumerations _griffe_stats->_griffe_models _griffe_tests _griffe.tests _griffe_tests->_griffe_agents _griffe_tests->_griffe_agents_inspector _griffe_tests->_griffe_agents_visitor _griffe_tests->_griffe_collections _griffe_tests->_griffe_docstrings _griffe_tests->_griffe_docstrings_parsers _griffe_tests->_griffe_enumerations _griffe_tests->_griffe_extensions _griffe_tests->_griffe_extensions_base _griffe_tests->_griffe_loader _griffe_tests->_griffe_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_ca8d5ca5 File: inspector cluster_d3b28feb Class: Inspector node_f205785d 123: __init__() node_f205785d->node_f205785d node_546f7cf2 175: _get_docstring() node_340f8be1 197: _get_linenos() node_361f5619 263: generic_inspect() node_361f5619->node_f205785d node_76ae114a 255: inspect() node_361f5619->node_76ae114a node_c4ba8b8d 300: inspect_module() node_361f5619->node_c4ba8b8d node_425ece12 207: get_module() node_425ece12->node_76ae114a node_40928f1b 539: handle_attribute() node_40928f1b->node_546f7cf2 node_b1394c6e 443: handle_function() node_b1394c6e->node_546f7cf2 node_b1394c6e->node_340f8be1 node_adff9ca9 619: _convert_object_to_annotation() node_b1394c6e->node_adff9ca9 node_df172f54 596: _convert_parameter() node_b1394c6e->node_df172f54 node_39c87cb0 655: _convert_type_parameters() node_b1394c6e->node_39c87cb0 node_669c03a2 531: inspect_attribute() node_669c03a2->node_40928f1b node_e426ce47 403: inspect_builtin_function() node_e426ce47->node_b1394c6e node_d80982ac 379: inspect_builtin_method() node_d80982ac->node_b1394c6e node_9059f20b 419: inspect_cached_property() node_9059f20b->node_b1394c6e node_a008c705 322: inspect_class() node_a008c705->node_546f7cf2 node_a008c705->node_340f8be1 node_a008c705->node_361f5619 node_a008c705->node_39c87cb0 node_b909166b 363: inspect_classmethod() node_b909166b->node_b1394c6e node_c4ff7282 395: inspect_coroutine() node_c4ff7282->node_b1394c6e node_1c4bbfb8 411: inspect_function() node_1c4bbfb8->node_b1394c6e node_f8e15595 435: inspect_getset_descriptor() node_f8e15595->node_b1394c6e node_81f3fcf8 387: inspect_method() node_81f3fcf8->node_b1394c6e node_6fea35f2 371: inspect_method_descriptor() node_6fea35f2->node_b1394c6e node_c4ba8b8d->node_546f7cf2 node_18dc28c5 427: inspect_property() node_18dc28c5->node_b1394c6e node_7c2b5db0 355: inspect_staticmethod() node_7c2b5db0->node_b1394c6e node_40d6be74 507: inspect_type_alias() node_40d6be74->node_546f7cf2 node_40d6be74->node_340f8be1 node_40d6be74->node_39c87cb0 node_8126f91c 698: _convert_type_to_annotation() node_40d6be74->node_8126f91c node_df172f54->node_adff9ca9 node_39c87cb0->node_8126f91c node_8126f91c->node_adff9ca9 node_8126f91c->node_8126f91c node_6fef6cf1 55: inspect() node_6fef6cf1->node_f205785d node_6fef6cf1->node_425ece12 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_c4c18621 File: assignments node_59a493e2 40: _get_annassign_names() node_d2261674 23: get_name() node_59a493e2->node_d2261674 node_223e4f9d 35: _get_assign_names() node_223e4f9d->node_d2261674 node_9da0324f 9: _get_attribute_name() node_9da0324f->node_d2261674 node_db7b08ca 63: get_instance_names() node_1db73079 51: get_names() node_db7b08ca->node_1db73079 ast.py
This module contains utilities for navigating AST nodes.
G cluster_7003daf9 File: ast node_9669be98 26: ast_children() node_8b665b39 137: ast_first_child() node_8b665b39->node_9669be98 node_4ed98f11 155: ast_last_child() node_4ed98f11->node_9669be98 node_fa74ea5c 119: ast_next() node_c843ce29 66: ast_next_siblings() node_fa74ea5c->node_c843ce29 node_c843ce29->node_9669be98 node_cb84341c 100: ast_previous() node_5401308f 50: ast_previous_siblings() node_cb84341c->node_5401308f node_5401308f->node_9669be98 node_f0805f3d 82: ast_siblings() node_f0805f3d->node_9669be98 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_e4a3ac98 File: exports node_e2458b96 74: _extract() node_cf367f70 33: _extract_attribute() node_cf367f70->node_e2458b96 node_ce8db269 37: _extract_binop() node_ce8db269->node_e2458b96 node_80e014ec 51: _extract_sequence() node_80e014ec->node_e2458b96 node_6a0434b1 58: _extract_starred() node_6a0434b1->node_e2458b96 node_bc02ae56 78: get__all__() node_bc02ae56->node_e2458b96 node_99c4007d 93: safe_get__all__() node_99c4007d->node_bc02ae56 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_144dffaa File: runtime cluster_a0bc60ad Class: ObjectNode node_cdd0c7cd 52: __init__() node_b3f3f627 264: _pick_member() node_67a2e8db 274: alias_target_path() node_b5811c31 36: _same_components() node_67a2e8db->node_b5811c31 node_fee510c5 154: children() node_fee510c5->node_cdd0c7cd node_fee510c5->node_b3f3f627 values.py
This module contains utilities for extracting attribute values.
G cluster_4f55dbb5 File: values node_ba590be0 15: get_value() node_a65e9f77 29: safe_get_value() node_a65e9f77->node_ba590be0 visitor.py
This module contains our static analysis agent, capable of parsing and visiting sources, statically.
G cluster_af22a48a File: visitor cluster_d9848747 Class: Visitor node_8743f5b1 136: __init__() node_8743f5b1->node_8743f5b1 node_3b101fb2 196: _get_docstring() node_870ddfd2 216: _get_type_parameters() node_4f2014ff 346: decorators_to_labels() node_2b5706e1 267: generic_visit() node_afb95f5d 259: visit() node_2b5706e1->node_afb95f5d node_32f2f91a 364: get_base_property() node_1254e152 245: get_module() node_1254e152->node_afb95f5d node_58a92e44 601: handle_attribute() node_58a92e44->node_3b101fb2 node_6751df44 388: handle_function() node_6751df44->node_3b101fb2 node_6751df44->node_870ddfd2 node_6751df44->node_4f2014ff node_6751df44->node_2b5706e1 node_6751df44->node_32f2f91a node_d89934c4 712: visit_annassign() node_d89934c4->node_58a92e44 node_abfeecc7 704: visit_assign() node_abfeecc7->node_58a92e44 node_4dc2df22 500: visit_asyncfunctiondef() node_4dc2df22->node_6751df44 node_f3cd4c93 298: visit_classdef() node_f3cd4c93->node_3b101fb2 node_f3cd4c93->node_870ddfd2 node_f3cd4c93->node_4f2014ff node_f3cd4c93->node_2b5706e1 node_839edd7d 492: visit_functiondef() node_839edd7d->node_6751df44 node_6f719ea0 741: visit_if() node_6f719ea0->node_2b5706e1 node_031427bc 276: visit_module() node_031427bc->node_3b101fb2 node_031427bc->node_2b5706e1 node_ba59aca9 511: visit_typealias() node_ba59aca9->node_3b101fb2 node_ba59aca9->node_870ddfd2 node_016fa3be 79: visit() node_016fa3be->node_8743f5b1 node_016fa3be->node_1254e152 c3linear.py
This module contains a single function, c3linear_merge
. The function is generic enough to be in its own module.
G cluster_7225fc5d File: c3linear cluster_5c453d99 Class: _Dependency cluster_96a578b9 Class: _DependencyList node_83e79f18 29: tail() node_9c2ea261 60: __len__() node_83e79f18->node_9c2ea261 node_b417177f 48: __init__() node_d0c87b8c 64: __repr__() node_d0c87b8c->node_d0c87b8c node_26adbac2 82: remove() node_b2b7431e 93: c3linear_merge() node_b2b7431e->node_b417177f node_b2b7431e->node_26adbac2 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_2676135a File: cli cluster_b74bbcaa Class: _DebugInfo node_d2a9d86b 51: __init__() node_d2a9d86b->node_d2a9d86b node_8156feac 69: _load_packages() node_a2ffd83c 59: _print_data() node_58d4c646 331: dump() node_58d4c646->node_8156feac node_58d4c646->node_a2ffd83c node_4f030335 130: get_parser() node_b5655414 575: main() node_b5655414->node_4f030335 collections.py
This module contains collection-related classes, which are used throughout the API.
G cluster_8ad2ed8c File: collections cluster_af781061 Class: LinesCollection node_6c084720 56: items() node_6c084720->node_6c084720 node_4acb09de 40: keys() node_4acb09de->node_4acb09de node_c73f7dbb 48: values() node_c73f7dbb->node_c73f7dbb 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_56a24407 File: debug node_154a569e 80: _get_debug_info() node_78e74401 65: _get_version() node_154a569e->node_78e74401 node_4ecb9d08 54: _interpreter_name_version() node_154a569e->node_4ecb9d08 node_aaa5cb89 99: _print_debug_info() node_aaa5cb89->node_154a569e 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_258f6193 File: diff cluster_9196fc03 Class: Breakage node_343f5d14 221: _explain_github() node_379ee859 164: _format_new_value() node_343f5d14->node_379ee859 node_cfd3a521 161: _format_old_value() node_343f5d14->node_cfd3a521 node_19c7c7e4 153: _format_title() node_343f5d14->node_19c7c7e4 node_e2de539c 201: _explain_markdown() node_e2de539c->node_379ee859 node_e2de539c->node_cfd3a521 node_3b6ceb74 167: _explain_oneline() node_e8bbcc46 156: _format_kind() node_3b6ceb74->node_e8bbcc46 node_dcb2f5cd 148: _format_location() node_3b6ceb74->node_dcb2f5cd node_3b6ceb74->node_379ee859 node_3b6ceb74->node_cfd3a521 node_3b6ceb74->node_19c7c7e4 node_d67727f5 183: _explain_verbose() node_d67727f5->node_e8bbcc46 node_d67727f5->node_dcb2f5cd node_d67727f5->node_379ee859 node_d67727f5->node_cfd3a521 node_d67727f5->node_19c7c7e4 node_c2e0e41d 522: _alias_incompatibilities() node_c92735b1 559: _type_based_yield() node_c2e0e41d->node_c92735b1 node_3d714d36 513: _attribute_incompatibilities() node_7aeff5c9 425: _class_incompatibilities() node_a85fb620 538: _member_incompatibilities() node_7aeff5c9->node_a85fb620 node_7b7ad7da 438: _function_incompatibilities() node_5eb90055 596: _returns_are_compatible() node_7b7ad7da->node_5eb90055 node_a85fb620->node_c92735b1 node_c92735b1->node_3d714d36 node_c92735b1->node_7aeff5c9 node_c92735b1->node_7b7ad7da node_84faab9b 620: find_breaking_changes() node_84faab9b->node_a85fb620 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_a7df5815 File: google node_0363151a 616: _annotation_from_parent() node_2acd3cda 585: _get_name_annotation_description() node_e14fc62b 829: _is_empty_line() node_bd35d8f0 344: _read_attributes_section() node_bb46b879 92: _read_block_items() node_bd35d8f0->node_bb46b879 node_35f35ed5 156: _read_block() node_35f35ed5->node_e14fc62b node_bb46b879->node_e14fc62b node_11364c5f 572: _read_block_items_maybe() node_11364c5f->node_35f35ed5 node_11364c5f->node_bb46b879 node_65248123 423: _read_classes_section() node_65248123->node_bb46b879 node_18036833 770: _read_examples_section() node_18036833->node_e14fc62b node_18036833->node_35f35ed5 node_4c6d80a2 386: _read_functions_section() node_4c6d80a2->node_bb46b879 node_ee333a62 485: _read_modules_section() node_ee333a62->node_bb46b879 node_1cc473b8 264: _read_other_parameters_section() node_0d0851a7 187: _read_parameters() node_1cc473b8->node_0d0851a7 node_0d0851a7->node_bb46b879 node_7dff7c43 254: _read_parameters_section() node_7dff7c43->node_0d0851a7 node_bbea0337 513: _read_raises_section() node_bbea0337->node_bb46b879 node_5100e17a 725: _read_receives_section() node_5100e17a->node_0363151a node_5100e17a->node_2acd3cda node_5100e17a->node_11364c5f node_bfa161de 635: _read_returns_section() node_bfa161de->node_0363151a node_bfa161de->node_2acd3cda node_bfa161de->node_11364c5f node_6f567287 460: _read_type_aliases_section() node_6f567287->node_bb46b879 node_97f0fb68 275: _read_type_parameters_section() node_97f0fb68->node_bb46b879 node_a6e3090a 544: _read_warns_section() node_a6e3090a->node_bb46b879 node_9acb2447 680: _read_yields_section() node_9acb2447->node_0363151a node_9acb2447->node_2acd3cda node_9acb2447->node_11364c5f node_7e78a67f 853: parse_google() node_7e78a67f->node_e14fc62b node_7e78a67f->node_35f35ed5 models.py
This module contains the models for storing docstrings structured data.
G cluster_efa5bf48 File: models cluster_f5de324d Class: DocstringSection node_fa363458 246: as_dict() node_fa363458->node_fa363458 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_a6e585b3 File: numpy node_3fc17a0c 856: _append_section() node_807470af 95: _is_dash_line() node_406fcf3c 91: _is_empty_line() node_807470af->node_406fcf3c node_f254a3a0 636: _read_attributes_section() node_44129070 99: _read_block_items() node_f254a3a0->node_44129070 node_46b3b7e0 161: _read_block() node_46b3b7e0->node_807470af node_46b3b7e0->node_406fcf3c node_44129070->node_807470af node_44129070->node_406fcf3c node_1483d5a7 707: _read_classes_section() node_1483d5a7->node_44129070 node_24e4e615 403: _read_deprecated_section() node_24e4e615->node_44129070 node_396af173 791: _read_examples_section() node_396af173->node_406fcf3c node_396af173->node_46b3b7e0 node_e213a2c4 675: _read_functions_section() node_e213a2c4->node_44129070 node_398082bd 759: _read_modules_section() node_398082bd->node_44129070 node_0257bb79 311: _read_other_parameters_section() node_54e7a6c9 223: _read_parameters() node_0257bb79->node_54e7a6c9 node_54e7a6c9->node_44129070 node_dc5f64b5 296: _read_parameters_section() node_dc5f64b5->node_54e7a6c9 node_23485a23 586: _read_raises_section() node_23485a23->node_44129070 node_2af42249 539: _read_receives_section() node_2af42249->node_44129070 node_12ec7dac 429: _read_returns_section() node_12ec7dac->node_44129070 node_b3d5c37e 739: _read_type_aliases_section() node_b3d5c37e->node_44129070 node_36caf5a7 333: _read_type_parameters_section() node_36caf5a7->node_44129070 node_9d2d1b3b 611: _read_warns_section() node_9d2d1b3b->node_44129070 node_d89b5343 488: _read_yields_section() node_d89b5343->node_44129070 node_0ae106fe 894: parse_numpy() node_0ae106fe->node_3fc17a0c node_0ae106fe->node_807470af node_0ae106fe->node_406fcf3c parsers.py
This module imports all the defined parsers and provides a generic function to parse docstrings.
G cluster_ce51881c File: parsers node_fd79f2d1 107: infer_docstring_style() node_2b9df471 239: parse() node_78f582ce 180: parse_auto() node_78f582ce->node_fd79f2d1 node_78f582ce->node_2b9df471 sphinx.py
This module defines functions to parse Sphinx docstrings into structured data.
G cluster_ee3c8f86 File: sphinx cluster_6607df91 Class: _FieldType node_7d8b09d5 49: matches() node_b95649ea 447: _consolidate_continuation_lines() node_b7271ab7 460: _consolidate_descriptive_type() node_08f09725 200: _determine_param_annotation() node_d200a643 193: _determine_param_default() node_9671ae0c 434: _parse_directive() node_9671ae0c->node_b95649ea node_b5886f00 418: _parsed_values_to_sections() node_98a360a4 464: _strip_blank_lines() node_b5886f00->node_98a360a4 node_7aba0838 266: _read_attribute() node_7aba0838->node_9671ae0c node_e5ac23b2 313: _read_attribute_type() node_e5ac23b2->node_b7271ab7 node_e5ac23b2->node_9671ae0c node_dafbd740 343: _read_exception() node_dafbd740->node_9671ae0c node_cfbcf5bd 130: _read_parameter() node_cfbcf5bd->node_08f09725 node_cfbcf5bd->node_d200a643 node_cfbcf5bd->node_9671ae0c node_73574b4e 235: _read_parameter_type() node_73574b4e->node_b7271ab7 node_73574b4e->node_9671ae0c node_7b360fad 364: _read_return() node_7b360fad->node_9671ae0c node_5b783304 397: _read_return_type() node_5b783304->node_b7271ab7 node_5b783304->node_9671ae0c node_602fc1c1 86: parse_sphinx() node_602fc1c1->node_7d8b09d5 node_602fc1c1->node_b5886f00 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_a3243abd File: encoders cluster_05d1b27e Class: JSONEncoder node_dc8bd430 51: __init__() node_dc8bd430->node_dc8bd430 node_95d339d6 137: _attach_parent_to_expr() node_21281803 147: _attach_parent_to_exprs() node_21281803->node_95d339d6 node_1b5de752 238: _load_attribute() node_7e261bad 88: _load_docstring() node_1b5de752->node_7e261bad node_ad39f172 199: _load_class() node_ad39f172->node_21281803 node_8516bae7 94: _load_decorators() node_ad39f172->node_8516bae7 node_ad39f172->node_7e261bad node_82c468db 98: _load_expression() node_dd373ed4 223: _load_function() node_dd373ed4->node_8516bae7 node_dd373ed4->node_7e261bad node_ae5cd907 184: _load_module() node_ae5cd907->node_21281803 node_ae5cd907->node_7e261bad node_534986fb 118: _load_parameter() node_534986fb->node_7e261bad node_8f5cb151 260: _load_type_alias() node_8f5cb151->node_7e261bad node_29f11a4a 128: _load_type_parameter() node_57f36c32 281: json_decoder() node_57f36c32->node_82c468db node_57f36c32->node_534986fb node_57f36c32->node_29f11a4a 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_068383b5 File: expressions cluster_5eb9447b Class: Expr cluster_9d5ffd61 Class: ExprAttribute cluster_10d9f78b Class: ExprBinOp cluster_b576563a Class: ExprBoolOp cluster_d306944c Class: ExprCall cluster_1e745ebb Class: ExprCompare cluster_e21b6251 Class: ExprComprehension cluster_c56977fb Class: ExprDict cluster_a2d1cc64 Class: ExprDictComp cluster_2be08310 Class: ExprExtSlice cluster_a5fae99d Class: ExprFormatted cluster_44a09e90 Class: ExprGeneratorExp cluster_3a4920ec Class: ExprIfExp cluster_9a153422 Class: ExprJoinedStr cluster_6f3eb99c Class: ExprKeyword cluster_dacaa099 Class: ExprVarPositional cluster_29ca0834 Class: ExprVarKeyword cluster_8ca8a173 Class: ExprLambda cluster_0596b5fa Class: ExprList cluster_59eae345 Class: ExprListComp cluster_14f53963 Class: ExprNamedExpr cluster_d1c39954 Class: ExprSet cluster_a800de79 Class: ExprSetComp cluster_ed5c4dff Class: ExprSlice cluster_e5ef0e4a Class: ExprSubscript cluster_d1b2e5e1 Class: ExprTuple cluster_566a7a13 Class: ExprUnaryOp cluster_bef9660d Class: ExprYield cluster_0a508b3b Class: ExprYieldFrom node_381a5a46 173: __iter__() node_f90757f1 177: iterate() node_381a5a46->node_f90757f1 node_a43cbfab 170: __str__() node_a43cbfab->node_f90757f1 node_456777a3 206: as_dict() node_baaf457b 143: _expr_as_dict() node_456777a3->node_baaf457b node_627ffd41 280: append() node_627ffd41->node_627ffd41 node_cd709f31 268: iterate() node_e4c91f82 1118: _get_precedence() node_cd709f31->node_e4c91f82 node_fbea8b31 66: _yield() node_cd709f31->node_fbea8b31 node_ba647630 325: iterate() node_ba647630->node_e4c91f82 node_ba647630->node_fbea8b31 node_b062a336 346: iterate() node_b062a336->node_e4c91f82 node_b062a336->node_fbea8b31 node_fdfd4bf4 370: iterate() node_fdfd4bf4->node_e4c91f82 node_4aec159a 109: _join() node_fdfd4bf4->node_4aec159a node_fdfd4bf4->node_fbea8b31 node_08e15fc1 389: iterate() node_08e15fc1->node_e4c91f82 node_08e15fc1->node_fbea8b31 node_53e9d94d 411: iterate() node_53e9d94d->node_4aec159a node_53e9d94d->node_fbea8b31 node_211cc591 449: iterate() node_211cc591->node_4aec159a node_a0408ad2 471: iterate() node_a0408ad2->node_4aec159a node_a0408ad2->node_fbea8b31 node_881e6c21 488: iterate() node_881e6c21->node_4aec159a node_2180c503 500: iterate() node_2180c503->node_fbea8b31 node_a1b3b528 517: iterate() node_a1b3b528->node_4aec159a node_a1b3b528->node_fbea8b31 node_eb1b87dc 535: iterate() node_eb1b87dc->node_eb1b87dc node_eb1b87dc->node_e4c91f82 node_eb1b87dc->node_fbea8b31 node_067647ad 561: iterate() node_067647ad->node_4aec159a node_9bbf8614 602: iterate() node_9bbf8614->node_fbea8b31 node_6c8d4049 644: iterate() node_6c8d4049->node_fbea8b31 node_b4a6b51c 686: iterate() node_b4a6b51c->node_4aec159a node_44bc95ce 702: iterate() node_44bc95ce->node_4aec159a node_44bc95ce->node_fbea8b31 node_0e3cf313 815: iterate() node_0e3cf313->node_fbea8b31 node_ad75ec95 844: iterate() node_ad75ec95->node_4aec159a node_b72f269f 860: iterate() node_b72f269f->node_4aec159a node_b72f269f->node_fbea8b31 node_02f57d8d 880: iterate() node_02f57d8d->node_fbea8b31 node_94211162 909: _to_binop() node_94211162->node_94211162 node_607bfe7b 901: iterate() node_607bfe7b->node_e4c91f82 node_607bfe7b->node_fbea8b31 node_0cbedd97 924: modernize() node_0cbedd97->node_94211162 node_0cbedd97->node_0cbedd97 node_9dade18e 960: iterate() node_9dade18e->node_4aec159a node_88c8d380 986: iterate() node_88c8d380->node_e4c91f82 node_88c8d380->node_fbea8b31 node_79278efa 629: iterate() node_79278efa->node_fbea8b31 node_62efd22e 616: iterate() node_62efd22e->node_fbea8b31 node_4036b3e0 1001: iterate() node_4036b3e0->node_fbea8b31 node_a72e2c15 1016: iterate() node_a72e2c15->node_fbea8b31 node_01d30a32 1404: _build() node_6aa2ade3 1122: _build_attribute() node_6aa2ade3->node_627ffd41 node_6aa2ade3->node_01d30a32 node_e4a8d362 1134: _build_binop() node_e4a8d362->node_01d30a32 node_f45abd91 1142: _build_boolop() node_f45abd91->node_01d30a32 node_9f15af4f 1149: _build_call() node_9f15af4f->node_01d30a32 node_946fab5c 1156: _build_compare() node_946fab5c->node_01d30a32 node_18457efc 1164: _build_comprehension() node_18457efc->node_01d30a32 node_a22b4309 1173: _build_constant() node_a22b4309->node_01d30a32 node_1c7b8d15 1212: _build_dict() node_1c7b8d15->node_01d30a32 node_25daf9fa 1219: _build_dictcomp() node_25daf9fa->node_01d30a32 node_9713b68c 1227: _build_formatted() node_9713b68c->node_01d30a32 node_1d99989c 1237: _build_generatorexp() node_1d99989c->node_01d30a32 node_b1dc6894 1244: _build_ifexp() node_b1dc6894->node_01d30a32 node_bfa581a1 1252: _build_joinedstr() node_bfa581a1->node_01d30a32 node_9d696b6b 1262: _build_keyword() node_9d696b6b->node_01d30a32 node_3d0d4bd8 1268: _build_lambda() node_3d0d4bd8->node_01d30a32 node_389639ce 1438: safe_get_expression() node_3d0d4bd8->node_389639ce node_b69aca6e 1285: _build_list() node_b69aca6e->node_01d30a32 node_a2c389d9 1289: _build_listcomp() node_a2c389d9->node_01d30a32 node_f4673dce 1297: _build_named_expr() node_f4673dce->node_01d30a32 node_5bcb8ddc 1301: _build_set() node_5bcb8ddc->node_01d30a32 node_38f27f06 1305: _build_setcomp() node_38f27f06->node_01d30a32 node_51fb9846 1309: _build_slice() node_51fb9846->node_01d30a32 node_917b21e0 1317: _build_starred() node_917b21e0->node_01d30a32 node_1d253032 1321: _build_subscript() node_1d253032->node_01d30a32 node_08f7971d 1350: _build_tuple() node_08f7971d->node_01d30a32 node_2c3ff974 1360: _build_unaryop() node_2c3ff974->node_01d30a32 node_d881f58d 1364: _build_yield() node_d881f58d->node_01d30a32 node_9f79797d 1368: _build_yield_from() node_9f79797d->node_01d30a32 node_500a7edd 132: _field_as_dict() node_baaf457b->node_500a7edd node_500a7edd->node_500a7edd node_4aec159a->node_fbea8b31 node_fbea8b31->node_e4c91f82 node_fbea8b31->node_fbea8b31 node_7a4234e8 1408: get_expression() node_7a4234e8->node_01d30a32 node_389639ce->node_7a4234e8 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_1cbcb06b File: base cluster_6357b2cf Class: Extension cluster_3adb15bd Class: Extensions node_002a1ac2 56: generic_inspect() node_03f5eee0 48: inspect() node_002a1ac2->node_03f5eee0 node_fa63e030 39: generic_visit() node_b775c313 31: visit() node_fa63e030->node_b775c313 node_9672d665 313: __init__() node_d4fb7d9c 322: add() node_9672d665->node_d4fb7d9c node_8c769d06 359: _load_extension() node_dd2e78bb 348: _load_extension_path() node_8c769d06->node_dd2e78bb node_13bf61ef 450: load_extensions() node_13bf61ef->node_9672d665 node_13bf61ef->node_d4fb7d9c node_13bf61ef->node_8c769d06 dataclasses.py
Built-in extension adding support for dataclasses.
This extension re-creates __init__
methods of dataclasses during static analysis.
G cluster_2a482e4c File: dataclasses cluster_29c5a32b Class: DataclassesExtension node_9594d64b 227: on_package_loaded() node_543b0610 203: _apply_recursively() node_9594d64b->node_543b0610 node_543b0610->node_543b0610 node_6266a1a3 195: _del_members_annotated_as_initvar() node_543b0610->node_6266a1a3 node_2251a80c 157: _set_dataclass_init() node_543b0610->node_2251a80c node_4050d4fa 49: _dataclass_arguments() node_446e9a79 25: _dataclass_decorator() node_4050d4fa->node_446e9a79 node_e2d759b8 32: _expr_args() node_4050d4fa->node_e2d759b8 node_c88d09db 66: _dataclass_parameters() node_c88d09db->node_4050d4fa node_b2bf17b1 55: _field_arguments() node_c88d09db->node_b2bf17b1 node_e2d759b8->node_e2d759b8 node_b2bf17b1->node_e2d759b8 node_f454ba3e 139: _reorder_parameters() node_2251a80c->node_446e9a79 node_2251a80c->node_c88d09db node_2251a80c->node_f454ba3e 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_bc9fa357 File: finder cluster_9cf5d2fc Class: ModuleFinder node_2447f03a 102: __init__() node_0a433877 386: _extend_from_pth_files() node_2447f03a->node_0a433877 node_bc1fcd76 119: append_search_path() node_2447f03a->node_bc1fcd76 node_c04a194c 374: _contents() node_0a433877->node_c04a194c node_0a433877->node_bc1fcd76 node_5d013f7b 442: _handle_pth_file() node_0a433877->node_5d013f7b node_fbf90ce9 395: _filter_py_modules() node_bcf24d49 359: _module_name_path() node_d7d97ca4 403: _top_module_name() node_bf918a20 132: insert_search_path() node_d7d97ca4->node_bf918a20 node_644e0bd5 229: find_package() node_644e0bd5->node_c04a194c node_f3d0292b 427: _is_pkg_style_namespace() node_644e0bd5->node_f3d0292b node_b7c54c9a 146: find_spec() node_b7c54c9a->node_bcf24d49 node_b7c54c9a->node_d7d97ca4 node_b7c54c9a->node_644e0bd5 node_7004530c 276: iter_submodules() node_7004530c->node_fbf90ce9 node_7004530c->node_7004530c node_bdd5f839 342: submodules() node_bdd5f839->node_7004530c node_db85d5e2 472: _handle_editable_module() node_312fecba 51: _match_pattern() node_db85d5e2->node_312fecba node_5d013f7b->node_db85d5e2 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_4f7a17c7 File: git node_a1ec3c7c 25: _normalize() node_2449a5d0 31: assert_git_repo() node_fcde5c2e 102: tmp_worktree() node_fcde5c2e->node_a1ec3c7c node_fcde5c2e->node_2449a5d0 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_770307d8 File: importer node_61bb010b 17: _error_details() node_e6b58640 43: dynamic_import() node_e6b58640->node_61bb010b node_a569b7ee 22: sys_path() node_e6b58640->node_a569b7ee loader.py
This module contains all the logic for loading API data from sources or compiled modules.
G cluster_f154b91d File: loader cluster_525c8150 Class: GriffeLoader node_80378bac 52: __init__() node_32a53881 624: _create_module() node_bb238033 709: _expand_wildcard() node_b128c3ea 679: _get_or_create_parent_module() node_b128c3ea->node_32a53881 node_86ba4f67 652: _inspect_module() node_02a5e1cf 525: _load_module() node_0b6d96c8 544: _load_module_path() node_02a5e1cf->node_0b6d96c8 node_0b6d96c8->node_32a53881 node_0b6d96c8->node_86ba4f67 node_8a4b316f 569: _load_submodules() node_0b6d96c8->node_8a4b316f node_5684a3da 632: _visit_module() node_0b6d96c8->node_5684a3da node_c6472247 510: _load_package() node_c6472247->node_02a5e1cf node_d3d23353 305: expand_wildcards() node_c6472247->node_d3d23353 node_fc2c98ac 573: _load_submodule() node_fc2c98ac->node_b128c3ea node_fc2c98ac->node_02a5e1cf node_8a4b316f->node_fc2c98ac node_aa881733 192: _post_load() node_ba57e49e 264: expand_exports() node_aa881733->node_ba57e49e node_aa881733->node_d3d23353 node_ba57e49e->node_ba57e49e node_d3d23353->node_bb238033 node_d3d23353->node_d3d23353 node_f0123434 100: load() node_d3d23353->node_f0123434 node_f0123434->node_86ba4f67 node_f0123434->node_c6472247 node_f0123434->node_aa881733 node_2ffc0ed3 208: resolve_aliases() node_2ffc0ed3->node_d3d23353 node_d81700d7 421: resolve_module_aliases() node_2ffc0ed3->node_d81700d7 node_d81700d7->node_f0123434 node_d81700d7->node_d81700d7 node_0796fc9f 718: load() node_0796fc9f->node_80378bac node_0796fc9f->node_f0123434 node_0796fc9f->node_2ffc0ed3 node_bb95eb7f 823: load_git() node_bb95eb7f->node_0796fc9f node_cc027dad 908: load_pypi() node_cc027dad->node_0796fc9f 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_574764e1 File: logger cluster_cdd8c40d Class: Logger node_841dff2e 0: (global)() node_1e9aea1a 43: _get() node_841dff2e->node_1e9aea1a node_4faec007 49: _patch_loggers() node_13f696f9 93: get_logger() node_13f696f9->node_1e9aea1a node_459acb2b 105: patch_loggers() node_459acb2b->node_4faec007 merger.py
This module contains utilities to merge stubs data and concrete data.
G cluster_38468c60 File: merger node_baff66ee 37: _merge_attribute_stubs() node_9db968cd 49: _merge_stubs_docstring() node_baff66ee->node_9db968cd node_7063252a 21: _merge_class_stubs() node_7063252a->node_9db968cd node_b9bf0bff 67: _merge_stubs_members() node_7063252a->node_b9bf0bff node_2b066941 59: _merge_stubs_overloads() node_7063252a->node_2b066941 node_2097cf79 54: _merge_stubs_type_parameters() node_7063252a->node_2097cf79 node_de5162fa 28: _merge_function_stubs() node_de5162fa->node_9db968cd node_de5162fa->node_2097cf79 node_3b043ddf 15: _merge_module_stubs() node_3b043ddf->node_9db968cd node_3b043ddf->node_b9bf0bff node_3b043ddf->node_2b066941 node_b9bf0bff->node_baff66ee node_b9bf0bff->node_de5162fa node_c139d13b 44: _merge_type_alias_stubs() node_b9bf0bff->node_c139d13b node_c139d13b->node_9db968cd node_c139d13b->node_2097cf79 node_29872568 110: merge_stubs() node_29872568->node_3b043ddf mixins.py
This module contains some mixins classes that hold shared methods of the different kinds of objects, and aliases.
G cluster_4b7a6825 File: mixins cluster_4e27f278 Class: GetMembersMixin cluster_fa9374c9 Class: DelMembersMixin cluster_3dd499be Class: SetMembersMixin node_5db97988 97: __delitem__() node_28d34c8d 22: _get_parts() node_5db97988->node_28d34c8d node_a59ee8a2 124: del_member() node_a59ee8a2->node_a59ee8a2 node_a59ee8a2->node_28d34c8d node_e94a620c 42: __getitem__() node_e94a620c->node_28d34c8d node_44a1c918 64: get_member() node_44a1c918->node_44a1c918 node_44a1c918->node_28d34c8d node_d81723e6 157: __setitem__() node_d81723e6->node_28d34c8d node_a113d4df 183: set_member() node_a113d4df->node_a113d4df node_a113d4df->node_28d34c8d models.py
This module contains our models definitions, to represent Python objects (and other aspects of Python APIs)... in Python.
G cluster_c39e5152 File: models cluster_434e29a7 Class: Docstring cluster_0fa07294 Class: Parameter cluster_d9987dc1 Class: Parameters cluster_dd45d51f Class: TypeParameters cluster_bf302c1a Class: Object cluster_583fa833 Class: Alias cluster_89887a96 Class: Class cluster_b4ee299b Class: Function node_e0e6fa33 1243: __init__() node_9c2be513 2012: _update_target_aliases() node_e0e6fa33->node_9c2be513 node_91c2adf8 1996: _resolve_target() node_820b9983 1963: resolve_target() node_91c2adf8->node_820b9983 node_708afabd 1420: as_json() node_708afabd->node_708afabd node_50b7d77d 1632: filter_members() node_50b7d77d->node_50b7d77d node_92b0b064 1619: has_labels() node_92b0b064->node_92b0b064 node_f8623507 1398: inherited_members() node_f8623507->node_e0e6fa33 node_429411d8 1532: is_kind() node_429411d8->node_429411d8 node_b541ff68 1378: members() node_b541ff68->node_e0e6fa33 node_6d1b4fdf 1359: parent() node_6d1b4fdf->node_9c2be513 node_94e2e717 1741: resolve() node_94e2e717->node_94e2e717 node_2008ac0b 1914: target() node_2008ac0b->node_820b9983 node_998ae07d 2271: _mro() node_998ae07d->node_998ae07d node_a620d45c 2282: mro() node_a620d45c->node_998ae07d node_d8596425 2219: parameters() node_b7b4ff26 298: __init__() node_d8596425->node_b7b4ff26 node_11756e28 155: parse() node_ee35e6be 151: parsed() node_ee35e6be->node_11756e28 node_712f2eb6 2312: __init__() node_712f2eb6->node_b7b4ff26 node_964ce23d 569: __init__() node_7d8b71d2 478: __init__() node_964ce23d->node_7d8b71d2 node_a59430ef 764: inherited_members() node_a59430ef->node_e0e6fa33 node_4f38d9d9 1135: resolve() node_4f38d9d9->node_4f38d9d9 node_2aa8c75b 264: as_dict() node_2aa8c75b->node_2aa8c75b stats.py
This module contains utilities to compute loading statistics, like time spent visiting modules statically or dynamically.
G cluster_1d42a6c7 File: stats cluster_bc4c2df9 Class: Stats node_d9c48838 20: __init__() node_1ac2af8d 74: _itercount() node_d9c48838->node_1ac2af8d node_1ac2af8d->node_1ac2af8d 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_4b26e938 File: tests node_dd2e2d5f 397: module_vtree() node_cc7c19ee 354: vtree() node_dd2e2d5f->node_cc7c19ee node_ebc462e4 303: temporary_inspected_module() node_171f7871 54: temporary_pyfile() node_ebc462e4->node_171f7871 node_20a21578 186: temporary_inspected_package() node_95337cfe 72: temporary_pypackage() node_20a21578->node_95337cfe node_488a4ba6 257: temporary_visited_module() node_488a4ba6->node_171f7871 node_38ba3f03 121: temporary_visited_package() node_38ba3f03->node_95337cfe