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_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_fbc13eef File: inspector cluster_47675b57 Class: Inspector node_213a899e 101: __init__() node_213a899e->node_213a899e node_9721f178 153: _get_docstring() node_9938e045 175: _get_linenos() node_b7fe10bf 241: generic_inspect() node_b7fe10bf->node_213a899e node_e2440ecd 233: inspect() node_b7fe10bf->node_e2440ecd node_fa12d704 278: inspect_module() node_b7fe10bf->node_fa12d704 node_3292b9b6 185: get_module() node_3292b9b6->node_e2440ecd node_ff18f059 486: handle_attribute() node_ff18f059->node_9721f178 node_0d3d94df 420: handle_function() node_0d3d94df->node_9721f178 node_0d3d94df->node_9938e045 node_a5804848 559: _convert_object_to_annotation() node_0d3d94df->node_a5804848 node_1ae020ac 543: _convert_parameter() node_0d3d94df->node_1ae020ac node_ab31df10 478: inspect_attribute() node_ab31df10->node_ff18f059 node_4c98b79f 380: inspect_builtin_function() node_4c98b79f->node_0d3d94df node_ea2ee719 356: inspect_builtin_method() node_ea2ee719->node_0d3d94df node_66fdf6a7 396: inspect_cached_property() node_66fdf6a7->node_0d3d94df node_643e9100 300: inspect_class() node_643e9100->node_9721f178 node_643e9100->node_9938e045 node_643e9100->node_b7fe10bf node_82d768ae 340: inspect_classmethod() node_82d768ae->node_0d3d94df node_168d91e1 372: inspect_coroutine() node_168d91e1->node_0d3d94df node_bd773dcd 388: inspect_function() node_bd773dcd->node_0d3d94df node_589da38e 412: inspect_getset_descriptor() node_589da38e->node_0d3d94df node_08b56a40 364: inspect_method() node_08b56a40->node_0d3d94df node_4f60d671 348: inspect_method_descriptor() node_4f60d671->node_0d3d94df node_fa12d704->node_9721f178 node_dad6d34f 404: inspect_property() node_dad6d34f->node_0d3d94df node_b30137b9 332: inspect_staticmethod() node_b30137b9->node_0d3d94df node_1ae020ac->node_a5804848 node_723ae3ac 33: inspect() node_723ae3ac->node_213a899e node_723ae3ac->node_3292b9b6 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_d1c75f97 File: assignments node_50c5a398 40: _get_annassign_names() node_841f0e1e 23: get_name() node_50c5a398->node_841f0e1e node_eb721c47 35: _get_assign_names() node_eb721c47->node_841f0e1e node_7a8b1abf 9: _get_attribute_name() node_7a8b1abf->node_841f0e1e node_af78fcf5 63: get_instance_names() node_901f4d64 51: get_names() node_af78fcf5->node_901f4d64 ast.py
This module contains utilities for navigating AST nodes.
G cluster_8486f073 File: ast node_3386fe8e 26: ast_children() node_aba3dd7e 137: ast_first_child() node_aba3dd7e->node_3386fe8e node_cb7ceb42 155: ast_last_child() node_cb7ceb42->node_3386fe8e node_0fe7c2d8 119: ast_next() node_6fd1e092 66: ast_next_siblings() node_0fe7c2d8->node_6fd1e092 node_6fd1e092->node_3386fe8e node_2f33c917 100: ast_previous() node_fe2dd208 50: ast_previous_siblings() node_2f33c917->node_fe2dd208 node_fe2dd208->node_3386fe8e node_52a24fe7 82: ast_siblings() node_52a24fe7->node_3386fe8e 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_3d10b7a4 File: exports node_493074e5 74: _extract() node_41524146 33: _extract_attribute() node_41524146->node_493074e5 node_d3da026b 37: _extract_binop() node_d3da026b->node_493074e5 node_27567b15 51: _extract_sequence() node_27567b15->node_493074e5 node_6ce19a0a 58: _extract_starred() node_6ce19a0a->node_493074e5 node_c960a64a 78: get__all__() node_c960a64a->node_493074e5 node_730c2b95 93: safe_get__all__() node_730c2b95->node_c960a64a 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_1aaafac6 File: runtime cluster_a426e587 Class: ObjectNode node_b01ab38f 41: __init__() node_13bc7073 243: _pick_member() node_ec91fd74 253: alias_target_path() node_908258c7 25: _same_components() node_ec91fd74->node_908258c7 node_911413fd 141: children() node_911413fd->node_b01ab38f node_911413fd->node_13bc7073 values.py
This module contains utilities for extracting attribute values.
G cluster_72f991fc File: values node_4d09eaad 15: get_value() node_ca9d2129 29: safe_get_value() node_ca9d2129->node_4d09eaad visitor.py
This module contains our static analysis agent, capable of parsing and visiting sources, statically.
G cluster_467a96d5 File: visitor cluster_bfce05ad Class: Visitor node_47c38fdc 122: __init__() node_47c38fdc->node_47c38fdc node_6b65612a 182: _get_docstring() node_9194a90f 293: decorators_to_labels() node_4eed05dc 216: generic_visit() node_5c29516e 208: visit() node_4eed05dc->node_5c29516e node_ff5c996d 311: get_base_property() node_1faf53c7 194: get_module() node_1faf53c7->node_5c29516e node_75bac423 509: handle_attribute() node_75bac423->node_6b65612a node_9635ec7f 335: handle_function() node_9635ec7f->node_6b65612a node_9635ec7f->node_9194a90f node_9635ec7f->node_4eed05dc node_9635ec7f->node_ff5c996d node_38f3e33e 620: visit_annassign() node_38f3e33e->node_75bac423 node_9809e707 612: visit_assign() node_9809e707->node_75bac423 node_b1164873 446: visit_asyncfunctiondef() node_b1164873->node_9635ec7f node_121dcfbf 247: visit_classdef() node_121dcfbf->node_6b65612a node_121dcfbf->node_9194a90f node_121dcfbf->node_4eed05dc node_02d4d31a 438: visit_functiondef() node_02d4d31a->node_9635ec7f node_4cc2158e 649: visit_if() node_4cc2158e->node_4eed05dc node_6c7f231f 225: visit_module() node_6c7f231f->node_6b65612a node_6c7f231f->node_4eed05dc node_b0577f69 65: visit() node_b0577f69->node_47c38fdc node_b0577f69->node_1faf53c7 c3linear.py
This module contains a single function, c3linear_merge
. The function is generic enough to be in its own module.
G cluster_c1979c90 File: c3linear cluster_4044cb3d Class: _Dependency cluster_422181dd Class: _DependencyList node_d6646d9a 29: tail() node_ba10f315 60: __len__() node_d6646d9a->node_ba10f315 node_4c86f6ea 48: __init__() node_d7a716bd 64: __repr__() node_d7a716bd->node_d7a716bd node_b0ced719 82: remove() node_82f2c402 93: c3linear_merge() node_82f2c402->node_4c86f6ea node_82f2c402->node_b0ced719 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_02ddc341 File: cli cluster_64094582 Class: _DebugInfo node_b214ae3f 51: __init__() node_b214ae3f->node_b214ae3f node_131e80df 69: _load_packages() node_ecd98efc 59: _print_data() node_8f90d8a2 331: dump() node_8f90d8a2->node_131e80df node_8f90d8a2->node_ecd98efc node_7c2ff0e9 130: get_parser() node_049ce58a 575: main() node_049ce58a->node_7c2ff0e9 collections.py
This module contains collection-related classes, which are used throughout the API.
G cluster_4b3e6227 File: collections cluster_6e5f4a02 Class: LinesCollection node_b872079a 56: items() node_b872079a->node_b872079a node_2a25a29f 40: keys() node_2a25a29f->node_2a25a29f node_ddb8051c 48: values() node_ddb8051c->node_ddb8051c 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_499b77a8 File: debug node_9fe4b666 80: _get_debug_info() node_79edfb80 65: _get_version() node_9fe4b666->node_79edfb80 node_54f2880d 54: _interpreter_name_version() node_9fe4b666->node_54f2880d node_afe92ae9 99: _print_debug_info() node_afe92ae9->node_9fe4b666 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_c0c43630 File: diff cluster_fdeece00 Class: Breakage node_966728d1 221: _explain_github() node_2793f7dd 164: _format_new_value() node_966728d1->node_2793f7dd node_9ab98ad5 161: _format_old_value() node_966728d1->node_9ab98ad5 node_9c3fcfc0 153: _format_title() node_966728d1->node_9c3fcfc0 node_7b4926a3 201: _explain_markdown() node_7b4926a3->node_2793f7dd node_7b4926a3->node_9ab98ad5 node_046373ab 167: _explain_oneline() node_ffa5cb2e 156: _format_kind() node_046373ab->node_ffa5cb2e node_bf23d574 148: _format_location() node_046373ab->node_bf23d574 node_046373ab->node_2793f7dd node_046373ab->node_9ab98ad5 node_046373ab->node_9c3fcfc0 node_fba6b583 183: _explain_verbose() node_fba6b583->node_ffa5cb2e node_fba6b583->node_bf23d574 node_fba6b583->node_2793f7dd node_fba6b583->node_9ab98ad5 node_fba6b583->node_9c3fcfc0 node_054a7c58 522: _alias_incompatibilities() node_615b683f 559: _type_based_yield() node_054a7c58->node_615b683f node_d8d714f3 513: _attribute_incompatibilities() node_bb02acd9 425: _class_incompatibilities() node_b52170bc 538: _member_incompatibilities() node_bb02acd9->node_b52170bc node_f98dbeff 438: _function_incompatibilities() node_f80ff122 596: _returns_are_compatible() node_f98dbeff->node_f80ff122 node_b52170bc->node_615b683f node_615b683f->node_d8d714f3 node_615b683f->node_bb02acd9 node_615b683f->node_f98dbeff node_27bce346 620: find_breaking_changes() node_27bce346->node_b52170bc 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_9786cc6e File: google node_d8b53663 513: _annotation_from_parent() node_26b54c60 482: _get_name_annotation_description() node_c6cf2bed 726: _is_empty_line() node_6fbeea39 266: _read_attributes_section() node_89d1cd71 83: _read_block_items() node_6fbeea39->node_89d1cd71 node_8df98372 147: _read_block() node_8df98372->node_c6cf2bed node_89d1cd71->node_c6cf2bed node_dd9768d8 469: _read_block_items_maybe() node_dd9768d8->node_8df98372 node_dd9768d8->node_89d1cd71 node_70bca1aa 345: _read_classes_section() node_70bca1aa->node_89d1cd71 node_bc28ac26 667: _read_examples_section() node_bc28ac26->node_c6cf2bed node_bc28ac26->node_8df98372 node_3857940b 308: _read_functions_section() node_3857940b->node_89d1cd71 node_cb12c1d6 382: _read_modules_section() node_cb12c1d6->node_89d1cd71 node_4dd764ae 255: _read_other_parameters_section() node_9e5cfd99 178: _read_parameters() node_4dd764ae->node_9e5cfd99 node_9e5cfd99->node_89d1cd71 node_61f1666a 245: _read_parameters_section() node_61f1666a->node_9e5cfd99 node_22c2427c 410: _read_raises_section() node_22c2427c->node_89d1cd71 node_1fbcf62b 622: _read_receives_section() node_1fbcf62b->node_d8b53663 node_1fbcf62b->node_26b54c60 node_1fbcf62b->node_dd9768d8 node_e307f162 532: _read_returns_section() node_e307f162->node_d8b53663 node_e307f162->node_26b54c60 node_e307f162->node_dd9768d8 node_7d455117 441: _read_warns_section() node_7d455117->node_89d1cd71 node_3c56e2ea 577: _read_yields_section() node_3c56e2ea->node_d8b53663 node_3c56e2ea->node_26b54c60 node_3c56e2ea->node_dd9768d8 node_c5ea9d5e 748: parse_google() node_c5ea9d5e->node_c6cf2bed node_c5ea9d5e->node_8df98372 models.py
This module contains the models for storing docstrings structured data.
G cluster_299e3b0c File: models cluster_90a5dac4 Class: DocstringSection node_0698ffa8 202: as_dict() node_0698ffa8->node_0698ffa8 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_fa53aa5d File: numpy node_073f3afc 760: _append_section() node_a3fde088 89: _is_dash_line() node_aac9d344 85: _is_empty_line() node_a3fde088->node_aac9d344 node_2a497cf6 560: _read_attributes_section() node_80fcce79 93: _read_block_items() node_2a497cf6->node_80fcce79 node_d44c0186 155: _read_block() node_d44c0186->node_a3fde088 node_d44c0186->node_aac9d344 node_80fcce79->node_a3fde088 node_80fcce79->node_aac9d344 node_f11eb95f 631: _read_classes_section() node_f11eb95f->node_80fcce79 node_3773acf3 327: _read_deprecated_section() node_3773acf3->node_80fcce79 node_e04aaa88 695: _read_examples_section() node_e04aaa88->node_aac9d344 node_e04aaa88->node_d44c0186 node_3ccb3ce0 599: _read_functions_section() node_3ccb3ce0->node_80fcce79 node_c10c3cda 663: _read_modules_section() node_c10c3cda->node_80fcce79 node_e5828660 305: _read_other_parameters_section() node_dedd03d0 217: _read_parameters() node_e5828660->node_dedd03d0 node_dedd03d0->node_80fcce79 node_cfa63884 290: _read_parameters_section() node_cfa63884->node_dedd03d0 node_5570f91d 510: _read_raises_section() node_5570f91d->node_80fcce79 node_947a4f0a 463: _read_receives_section() node_947a4f0a->node_80fcce79 node_692f53f5 353: _read_returns_section() node_692f53f5->node_80fcce79 node_8af27229 535: _read_warns_section() node_8af27229->node_80fcce79 node_03919a2c 412: _read_yields_section() node_03919a2c->node_80fcce79 node_2d32efe5 796: parse_numpy() node_2d32efe5->node_073f3afc node_2d32efe5->node_a3fde088 node_2d32efe5->node_aac9d344 parsers.py
This module imports all the defined parsers and provides a generic function to parse docstrings.
G cluster_97a7960c File: parsers node_15d5972e 107: infer_docstring_style() node_5d39d0a1 239: parse() node_dab270e8 180: parse_auto() node_dab270e8->node_15d5972e node_dab270e8->node_5d39d0a1 sphinx.py
This module defines functions to parse Sphinx docstrings into structured data.
G cluster_dd9ade09 File: sphinx cluster_49e37146 Class: _FieldType node_c4d5e29c 49: matches() node_80f01524 437: _consolidate_continuation_lines() node_5bc06cc9 450: _consolidate_descriptive_type() node_cc4a5434 191: _determine_param_annotation() node_3614725c 184: _determine_param_default() node_1cf1d516 424: _parse_directive() node_1cf1d516->node_80f01524 node_2998b908 408: _parsed_values_to_sections() node_076745ae 454: _strip_blank_lines() node_2998b908->node_076745ae node_4194b2b7 256: _read_attribute() node_4194b2b7->node_1cf1d516 node_309af521 303: _read_attribute_type() node_309af521->node_5bc06cc9 node_309af521->node_1cf1d516 node_d95cf92f 333: _read_exception() node_d95cf92f->node_1cf1d516 node_6d4a2d5b 130: _read_parameter() node_6d4a2d5b->node_cc4a5434 node_6d4a2d5b->node_3614725c node_6d4a2d5b->node_1cf1d516 node_5f5ee1d9 226: _read_parameter_type() node_5f5ee1d9->node_5bc06cc9 node_5f5ee1d9->node_1cf1d516 node_3d6ff18b 354: _read_return() node_3d6ff18b->node_1cf1d516 node_718c1901 387: _read_return_type() node_718c1901->node_5bc06cc9 node_718c1901->node_1cf1d516 node_06534299 86: parse_sphinx() node_06534299->node_c4d5e29c node_06534299->node_2998b908 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_11fa322d File: encoders cluster_c11c28a9 Class: JSONEncoder node_dfa52031 48: __init__() node_dfa52031->node_dfa52031 node_4be8af18 125: _attach_parent_to_expr() node_efed57f6 135: _attach_parent_to_exprs() node_efed57f6->node_4be8af18 node_3ea6dd6f 211: _load_attribute() node_b60e5de5 85: _load_docstring() node_3ea6dd6f->node_b60e5de5 node_a3c77b81 174: _load_class() node_a3c77b81->node_efed57f6 node_ac2f7c2c 91: _load_decorators() node_a3c77b81->node_ac2f7c2c node_a3c77b81->node_b60e5de5 node_83f27c32 95: _load_expression() node_255df62b 197: _load_function() node_255df62b->node_ac2f7c2c node_255df62b->node_b60e5de5 node_8a35a7d2 159: _load_module() node_8a35a7d2->node_efed57f6 node_8a35a7d2->node_b60e5de5 node_a7f42804 115: _load_parameter() node_a7f42804->node_b60e5de5 node_2f1a0ea0 242: json_decoder() node_2f1a0ea0->node_83f27c32 node_2f1a0ea0->node_a7f42804 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_814059af File: expressions cluster_3d93ed6d Class: Expr cluster_ae5ed1e6 Class: ExprAttribute cluster_7124d15a Class: ExprBinOp cluster_e44577c5 Class: ExprBoolOp cluster_39c1ab50 Class: ExprCall cluster_42823505 Class: ExprCompare cluster_f10c763f Class: ExprComprehension cluster_3e65b1e6 Class: ExprDict cluster_971329ca Class: ExprDictComp cluster_6bc038d8 Class: ExprExtSlice cluster_083fc574 Class: ExprFormatted cluster_e35ac65c Class: ExprGeneratorExp cluster_a940a9d3 Class: ExprIfExp cluster_bc553c85 Class: ExprJoinedStr cluster_0d99c43d Class: ExprKeyword cluster_75ebe6e9 Class: ExprVarPositional cluster_fc21523a Class: ExprVarKeyword cluster_47e7ff22 Class: ExprLambda cluster_3f0cb930 Class: ExprList cluster_1b89c72a Class: ExprListComp cluster_bec6db5b Class: ExprNamedExpr cluster_2a9baec1 Class: ExprSet cluster_b2a42694 Class: ExprSetComp cluster_d35000ca Class: ExprSlice cluster_3ab5ec22 Class: ExprSubscript cluster_8e38bd23 Class: ExprTuple cluster_99a0da98 Class: ExprUnaryOp cluster_4bfffedd Class: ExprYield cluster_f220f4f0 Class: ExprYieldFrom node_271965d6 98: __iter__() node_a5a5339d 102: iterate() node_271965d6->node_a5a5339d node_233acdd3 95: __str__() node_233acdd3->node_a5a5339d node_0e41af31 131: as_dict() node_c77b7d29 68: _expr_as_dict() node_0e41af31->node_c77b7d29 node_8d79a3fa 201: append() node_8d79a3fa->node_8d79a3fa node_63a9682d 193: iterate() node_d7bf0140 41: _join() node_63a9682d->node_d7bf0140 node_f0ab2ff1 246: iterate() node_2b237422 29: _yield() node_f0ab2ff1->node_2b237422 node_8d563027 262: iterate() node_8d563027->node_d7bf0140 node_09084af3 281: iterate() node_09084af3->node_d7bf0140 node_09084af3->node_2b237422 node_a1909528 300: iterate() node_a1909528->node_d7bf0140 node_a1909528->node_2b237422 node_a521f87c 320: iterate() node_a521f87c->node_d7bf0140 node_a521f87c->node_2b237422 node_d0292f67 358: iterate() node_d0292f67->node_d7bf0140 node_9456b8c3 380: iterate() node_9456b8c3->node_d7bf0140 node_9456b8c3->node_2b237422 node_261ecb91 397: iterate() node_261ecb91->node_d7bf0140 node_e70dad0e 409: iterate() node_e70dad0e->node_2b237422 node_319ccac8 425: iterate() node_319ccac8->node_d7bf0140 node_319ccac8->node_2b237422 node_e1f9bbe6 443: iterate() node_e1f9bbe6->node_2b237422 node_300a39b0 459: iterate() node_300a39b0->node_d7bf0140 node_03307eb2 500: iterate() node_03307eb2->node_2b237422 node_8b94fe07 542: iterate() node_8b94fe07->node_2b237422 node_32ae72d9 583: iterate() node_32ae72d9->node_d7bf0140 node_2b161b32 599: iterate() node_2b161b32->node_d7bf0140 node_2b161b32->node_2b237422 node_97f38800 704: iterate() node_97f38800->node_2b237422 node_a2207f73 735: iterate() node_a2207f73->node_d7bf0140 node_182d6bc8 751: iterate() node_182d6bc8->node_d7bf0140 node_182d6bc8->node_2b237422 node_388a97a0 771: iterate() node_388a97a0->node_2b237422 node_9876b52f 799: _to_binop() node_9876b52f->node_9876b52f node_b95969c5 792: iterate() node_b95969c5->node_2b237422 node_47c7bfec 814: modernize() node_47c7bfec->node_9876b52f node_47c7bfec->node_47c7bfec node_211cc147 850: iterate() node_211cc147->node_d7bf0140 node_b5713263 876: iterate() node_b5713263->node_2b237422 node_3592d1e8 527: iterate() node_3592d1e8->node_2b237422 node_7adb08c3 514: iterate() node_7adb08c3->node_2b237422 node_1e4e807d 889: iterate() node_1e4e807d->node_2b237422 node_5e39a71e 904: iterate() node_5e39a71e->node_2b237422 node_b80697e0 1233: _build() node_69625cba 951: _build_attribute() node_69625cba->node_8d79a3fa node_69625cba->node_b80697e0 node_92b125d4 963: _build_binop() node_92b125d4->node_b80697e0 node_48b066fd 971: _build_boolop() node_48b066fd->node_b80697e0 node_dfb9082f 978: _build_call() node_dfb9082f->node_b80697e0 node_5cf64403 985: _build_compare() node_5cf64403->node_b80697e0 node_b6655219 993: _build_comprehension() node_b6655219->node_b80697e0 node_2e67114b 1002: _build_constant() node_2e67114b->node_b80697e0 node_3b6ca1a0 1041: _build_dict() node_3b6ca1a0->node_b80697e0 node_7f9304ee 1048: _build_dictcomp() node_7f9304ee->node_b80697e0 node_4e222c40 1056: _build_formatted() node_4e222c40->node_b80697e0 node_95f37bd0 1066: _build_generatorexp() node_95f37bd0->node_b80697e0 node_cbedcca0 1073: _build_ifexp() node_cbedcca0->node_b80697e0 node_09935a9d 1081: _build_joinedstr() node_09935a9d->node_b80697e0 node_fdc2ac63 1091: _build_keyword() node_fdc2ac63->node_b80697e0 node_571b860d 1097: _build_lambda() node_571b860d->node_b80697e0 node_d3442872 1265: safe_get_expression() node_571b860d->node_d3442872 node_ec7ed429 1114: _build_list() node_ec7ed429->node_b80697e0 node_863995bf 1118: _build_listcomp() node_863995bf->node_b80697e0 node_4531b783 1126: _build_named_expr() node_4531b783->node_b80697e0 node_515a0489 1130: _build_set() node_515a0489->node_b80697e0 node_d9d4d463 1134: _build_setcomp() node_d9d4d463->node_b80697e0 node_19491950 1138: _build_slice() node_19491950->node_b80697e0 node_dd577884 1146: _build_starred() node_dd577884->node_b80697e0 node_0e27c15b 1150: _build_subscript() node_0e27c15b->node_b80697e0 node_597ddf7f 1179: _build_tuple() node_597ddf7f->node_b80697e0 node_5927396f 1189: _build_unaryop() node_5927396f->node_b80697e0 node_97ff7abf 1193: _build_yield() node_97ff7abf->node_b80697e0 node_7c0c26be 1197: _build_yield_from() node_7c0c26be->node_b80697e0 node_e9ca35f6 57: _field_as_dict() node_c77b7d29->node_e9ca35f6 node_e9ca35f6->node_e9ca35f6 node_d7bf0140->node_2b237422 node_2b237422->node_2b237422 node_e336731c 1237: get_expression() node_e336731c->node_b80697e0 node_d3442872->node_e336731c 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_82195835 File: base cluster_c1543b07 Class: Extension cluster_b6949157 Class: Extensions node_6fe67f33 56: generic_inspect() node_185bfaf9 48: inspect() node_6fe67f33->node_185bfaf9 node_9424d287 39: generic_visit() node_3e211a15 31: visit() node_9424d287->node_3e211a15 node_5fc2acd6 287: __init__() node_f1baaa5e 296: add() node_5fc2acd6->node_f1baaa5e node_0d576dd4 333: _load_extension() node_dce6cd24 322: _load_extension_path() node_0d576dd4->node_dce6cd24 node_27c16626 424: load_extensions() node_27c16626->node_5fc2acd6 node_27c16626->node_f1baaa5e node_27c16626->node_0d576dd4 dataclasses.py
Built-in extension adding support for dataclasses.
This extension re-creates __init__
methods of dataclasses during static analysis.
G cluster_ef5d9d5c File: dataclasses cluster_2a7864c1 Class: DataclassesExtension node_ccba5714 227: on_package_loaded() node_fe0ce2ac 203: _apply_recursively() node_ccba5714->node_fe0ce2ac node_fe0ce2ac->node_fe0ce2ac node_7e5c8f81 195: _del_members_annotated_as_initvar() node_fe0ce2ac->node_7e5c8f81 node_8f20660b 157: _set_dataclass_init() node_fe0ce2ac->node_8f20660b node_60d75fb0 49: _dataclass_arguments() node_3258a07b 25: _dataclass_decorator() node_60d75fb0->node_3258a07b node_2b9b5ae2 32: _expr_args() node_60d75fb0->node_2b9b5ae2 node_cb18f541 66: _dataclass_parameters() node_cb18f541->node_60d75fb0 node_165f0da7 55: _field_arguments() node_cb18f541->node_165f0da7 node_2b9b5ae2->node_2b9b5ae2 node_165f0da7->node_2b9b5ae2 node_4ba3f349 139: _reorder_parameters() node_8f20660b->node_3258a07b node_8f20660b->node_cb18f541 node_8f20660b->node_4ba3f349 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_c47d2c57 File: finder cluster_175244d2 Class: ModuleFinder node_213ce6f9 102: __init__() node_66a7b88f 386: _extend_from_pth_files() node_213ce6f9->node_66a7b88f node_3347e84c 119: append_search_path() node_213ce6f9->node_3347e84c node_f1d63a29 374: _contents() node_66a7b88f->node_f1d63a29 node_66a7b88f->node_3347e84c node_e3ac4142 442: _handle_pth_file() node_66a7b88f->node_e3ac4142 node_f3af3edf 395: _filter_py_modules() node_07480ff1 359: _module_name_path() node_ff0f3ede 403: _top_module_name() node_d81701ba 132: insert_search_path() node_ff0f3ede->node_d81701ba node_55c75bd6 229: find_package() node_55c75bd6->node_f1d63a29 node_1accf43c 427: _is_pkg_style_namespace() node_55c75bd6->node_1accf43c node_450ca6b9 146: find_spec() node_450ca6b9->node_07480ff1 node_450ca6b9->node_ff0f3ede node_450ca6b9->node_55c75bd6 node_abfd499f 276: iter_submodules() node_abfd499f->node_f3af3edf node_abfd499f->node_abfd499f node_6cfe33a0 342: submodules() node_6cfe33a0->node_abfd499f node_ffcb69bd 472: _handle_editable_module() node_51484693 51: _match_pattern() node_ffcb69bd->node_51484693 node_e3ac4142->node_ffcb69bd 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_2fd34914 File: git node_a6908766 25: _normalize() node_9d1fa099 31: assert_git_repo() node_c6f0646f 102: tmp_worktree() node_c6f0646f->node_a6908766 node_c6f0646f->node_9d1fa099 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_cab4f24a File: importer node_a1f5ef4b 17: _error_details() node_044b596b 43: dynamic_import() node_044b596b->node_a1f5ef4b node_bc11f0a1 22: sys_path() node_044b596b->node_bc11f0a1 loader.py
This module contains all the logic for loading API data from sources or compiled modules.
G cluster_6c40e375 File: loader cluster_9914ad1a Class: GriffeLoader node_2ead8928 52: __init__() node_2f89af12 627: _create_module() node_e4dcd0b7 712: _expand_wildcard() node_307642c8 682: _get_or_create_parent_module() node_307642c8->node_2f89af12 node_5aa716e1 655: _inspect_module() node_4674d66f 528: _load_module() node_c3aa3b4a 547: _load_module_path() node_4674d66f->node_c3aa3b4a node_c3aa3b4a->node_2f89af12 node_c3aa3b4a->node_5aa716e1 node_1a38623c 572: _load_submodules() node_c3aa3b4a->node_1a38623c node_e40b42df 635: _visit_module() node_c3aa3b4a->node_e40b42df node_d226ad06 513: _load_package() node_d226ad06->node_4674d66f node_23e2f435 305: expand_wildcards() node_d226ad06->node_23e2f435 node_821b0706 576: _load_submodule() node_821b0706->node_307642c8 node_821b0706->node_4674d66f node_1a38623c->node_821b0706 node_2fa65678 192: _post_load() node_252ed8a3 264: expand_exports() node_2fa65678->node_252ed8a3 node_2fa65678->node_23e2f435 node_252ed8a3->node_252ed8a3 node_23e2f435->node_e4dcd0b7 node_23e2f435->node_23e2f435 node_c95e4e23 100: load() node_23e2f435->node_c95e4e23 node_c95e4e23->node_5aa716e1 node_c95e4e23->node_d226ad06 node_c95e4e23->node_2fa65678 node_99815b2b 208: resolve_aliases() node_99815b2b->node_23e2f435 node_f9bc7082 424: resolve_module_aliases() node_99815b2b->node_f9bc7082 node_f9bc7082->node_c95e4e23 node_f9bc7082->node_f9bc7082 node_7121f1d8 721: load() node_7121f1d8->node_2ead8928 node_7121f1d8->node_c95e4e23 node_7121f1d8->node_99815b2b node_75477a9d 826: load_git() node_75477a9d->node_7121f1d8 node_1d88d1c4 911: load_pypi() node_1d88d1c4->node_7121f1d8 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_10e4a181 File: logger cluster_73101194 Class: Logger node_cbe3ae79 0: (global)() node_af9a069d 43: _get() node_cbe3ae79->node_af9a069d node_55ee66f7 49: _patch_loggers() node_2917dddb 93: get_logger() node_2917dddb->node_af9a069d node_eaa320fb 105: patch_loggers() node_eaa320fb->node_55ee66f7 merger.py
This module contains utilities to merge stubs data and concrete data.
G cluster_877f103f File: merger node_54c9de9a 35: _merge_attribute_stubs() node_9b9333a2 42: _merge_stubs_docstring() node_54c9de9a->node_9b9333a2 node_800f16f2 21: _merge_class_stubs() node_800f16f2->node_9b9333a2 node_32b464a6 55: _merge_stubs_members() node_800f16f2->node_32b464a6 node_bbe9b93f 47: _merge_stubs_overloads() node_800f16f2->node_bbe9b93f node_3b3922d8 27: _merge_function_stubs() node_3b3922d8->node_9b9333a2 node_88b6dac3 15: _merge_module_stubs() node_88b6dac3->node_9b9333a2 node_88b6dac3->node_32b464a6 node_88b6dac3->node_bbe9b93f node_32b464a6->node_54c9de9a node_32b464a6->node_3b3922d8 node_f89f397e 96: merge_stubs() node_f89f397e->node_88b6dac3 mixins.py
This module contains some mixins classes that hold shared methods of the different kinds of objects, and aliases.
G cluster_092f0baf File: mixins cluster_72063176 Class: GetMembersMixin cluster_c2b5251c Class: DelMembersMixin cluster_56eb13f8 Class: SetMembersMixin node_4b407eb9 97: __delitem__() node_2652af16 22: _get_parts() node_4b407eb9->node_2652af16 node_b3b1c760 124: del_member() node_b3b1c760->node_b3b1c760 node_b3b1c760->node_2652af16 node_a9cedfb1 42: __getitem__() node_a9cedfb1->node_2652af16 node_859f8773 64: get_member() node_859f8773->node_859f8773 node_859f8773->node_2652af16 node_23b04b28 157: __setitem__() node_23b04b28->node_2652af16 node_c9991783 183: set_member() node_c9991783->node_c9991783 node_c9991783->node_2652af16 models.py
This module contains our models definitions, to represent Python objects (and other aspects of Python APIs)... in Python.
G cluster_9c5ac437 File: models cluster_a5e7e92c Class: Docstring cluster_c70fc6a3 Class: Parameter cluster_84afecb9 Class: Parameters cluster_5243e851 Class: Object cluster_a458c52a Class: Alias cluster_81c23243 Class: Class cluster_de1715fa Class: Function node_1809d88c 1026: __init__() node_dd202149 1760: _update_target_aliases() node_1809d88c->node_dd202149 node_50b6ab3d 1744: _resolve_target() node_ca0ce061 1711: resolve_target() node_50b6ab3d->node_ca0ce061 node_8711b4a6 1203: as_json() node_8711b4a6->node_8711b4a6 node_8f8df1e8 1392: filter_members() node_8f8df1e8->node_8f8df1e8 node_7af15b36 1379: has_labels() node_7af15b36->node_7af15b36 node_fee4aa17 1181: inherited_members() node_fee4aa17->node_1809d88c node_c59562e9 1310: is_kind() node_c59562e9->node_c59562e9 node_8550f660 1161: members() node_8550f660->node_1809d88c node_08583628 1142: parent() node_08583628->node_dd202149 node_351e06bb 1501: resolve() node_351e06bb->node_351e06bb node_fd95e5ab 1662: target() node_fd95e5ab->node_ca0ce061 node_8ee69427 2002: _mro() node_8ee69427->node_8ee69427 node_f9cd7c3f 2013: mro() node_f9cd7c3f->node_8ee69427 node_8a6e5ae9 1967: parameters() node_fbaa3e06 297: __init__() node_8a6e5ae9->node_fbaa3e06 node_386a7570 154: parse() node_165b1ddf 150: parsed() node_165b1ddf->node_386a7570 node_70b3e8a4 2043: __init__() node_70b3e8a4->node_fbaa3e06 node_7c71fd8c 577: inherited_members() node_7c71fd8c->node_1809d88c node_9fd95821 931: resolve() node_9fd95821->node_9fd95821 node_c4756bcf 263: as_dict() node_c4756bcf->node_c4756bcf stats.py
This module contains utilities to compute loading statistics, like time spent visiting modules statically or dynamically.
G cluster_fd823731 File: stats cluster_ad2636f8 Class: Stats node_160ae4ad 20: __init__() node_784edbbd 73: _itercount() node_160ae4ad->node_784edbbd node_784edbbd->node_784edbbd 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_42e31945 File: tests node_b29a329c 397: module_vtree() node_161eb511 354: vtree() node_b29a329c->node_161eb511 node_415acde2 303: temporary_inspected_module() node_bc5d5d74 54: temporary_pyfile() node_415acde2->node_bc5d5d74 node_5605d4b2 186: temporary_inspected_package() node_3bada60c 72: temporary_pypackage() node_5605d4b2->node_3bada60c node_32a4aeba 257: temporary_visited_module() node_32a4aeba->node_bc5d5d74 node_485245ef 121: temporary_visited_package() node_485245ef->node_3bada60c