{"id":1046,"library":"griffe","title":"Griffe","description":"Griffe is a Python library (current version 2.0.2) that provides signatures for entire Python programs. It extracts the structure, frame, and skeleton of a project, enabling tasks like API documentation generation and detection of breaking API changes. The library maintains a regular release cadence, with frequent updates including bug fixes, features, and occasional deprecations or breaking changes between major versions.","status":"active","version":"2.0.2","language":"python","source_language":"en","source_url":"https://github.com/mkdocstrings/griffe","tags":["API documentation","static analysis","code introspection","breaking changes","docstrings"],"install":[{"cmd":"pip install griffe","lang":"bash","label":"Standard installation"},{"cmd":"pip install griffe[pypi]","lang":"bash","label":"With PyPI index support (for `griffe check`)"}],"dependencies":[],"imports":[{"note":"Griffe exposes its public API directly in the top-level 'griffe' module. Importing from internal or private modules (e.g., '_internal' or those starting with an underscore) is not guaranteed to be stable and can break across minor versions, as seen with the '_griffe' package refactoring in 1.11.1.","wrong":"from griffe._internal import some_private_module","symbol":"griffe","correct":"import griffe"}],"quickstart":{"code":"import griffe\nimport os\n\n# Create a dummy Python file for demonstration\nwith open('my_dummy_module.py', 'w') as f:\n    f.write('def my_function(param1: str, param2: int = 0) -> str:\\n    \"\"\"A dummy function.\"\"\"\\n    return f\"{param1}-{param2}\"\\n\\nclass MyClass:\\n    \"\"\"A dummy class.\"\"\"\\n    def __init__(self, name: str):\\n        self.name = name\\n\\n    def greet(self) -> str:\\n        \"\"\"Greets by name.\"\"\"\\n        return f\"Hello, {self.name}\"\\n')\n\n# Load the module's API data\n# Griffe will try to find sources and fall back to introspection if not found\n# Using the current directory as a search path\npackage = griffe.load(\"my_dummy_module\", search_paths=['.'])\n\n# Access a module, class, or function\nprint(f\"Package name: {package.name}\")\n\nmy_function = package[\"my_function\"]\nprint(f\"Function: {my_function.name}, Parameters: {[p.name for p in my_function.parameters]}\")\n\nmy_class = package[\"MyClass\"]\nprint(f\"Class: {my_class.name}, Methods: {[m.name for m in my_class.members.values() if m.is_function]}\")\n\n# Clean up the dummy file\nos.remove('my_dummy_module.py')","lang":"python","description":"This quickstart demonstrates how to use `griffe.load` to extract API information from a Python module. It creates a temporary Python file, loads its structure into Griffe's data models, and then prints basic information about the extracted function and class."},"warnings":[{"fix":"Review the 2.0.0 changelog for a complete list of removed APIs. Replace usage of these deprecated functions/objects with their current equivalents, or remove dependencies on them.","message":"Version 2.0.0 removed several previously deprecated public APIs, including `ExportedName`, `infer_docstring_style`, `parse_auto`, `parse_google`, `parse_numpy`, `parse_sphinx`, `assert_git_repo`, `get_latest_tag`, `get_repo_root`, and `tmp_worktree`.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Update custom handlers or extensions that interact with the `on_alias` event to match the new signature `on_alias(self, *, alias: Alias, loader: GriffeLoader, **kwargs)`.","message":"The signature of the `on_alias` event changed in version 1.14.0. It changed from `on_alias(self, *, node: AST | ObjectNode, alias: Alias, agent: Visitor | Inspector, **kwargs)` (an analysis event) to `on_alias(self, *, alias: Alias, loader: GriffeLoader, **kwargs)` (a load event).","severity":"deprecated","affected_versions":">=1.14.0"},{"fix":"Avoid importing from or relying on undocumented internal modules or packages. Stick to the public API exposed directly under the `griffe` top-level module to ensure forward compatibility. If you must use internals, pin your `griffe` version tightly.","message":"Internal packages and modules, particularly those starting with an underscore (e.g., `_griffe`), may be refactored or moved without prior deprecation. Version 1.11.1 moved the private `_griffe` package under `griffe._internal`.","severity":"gotcha","affected_versions":"<1.11.1 relying on internals"}],"env_vars":null,"search_vec":"'2.0.2':9 'analysi':65 'api':30,37,62 'break':36,57,68 'bug':50 'cadenc':45 'chang':38,58,69 'code':66 'current':7 'deprec':55 'detect':34 'docstr':70 'document':31,63 'enabl':27 'entir':14 'extract':18 'featur':52 'fix':51 'frame':21 'frequent':47 'generat':32 'griff':1,2 'includ':49 'introspect':67 'librari':6,40 'like':29 'maintain':41 'major':60 'occasion':54 'program':16 'project':26 'provid':11 'python':5,15 'regular':43 'releas':44 'signatur':12 'skeleton':23 'static':64 'structur':20 'task':28 'updat':48 'version':8,61","created_at":"2026-03-31T14:31:03.461891+00:00","updated_at":"2026-04-16T15:28:42.304752+00:00","problems":[{"fix":"Downgrade `griffe` to a version prior to the breaking change (e.g., `pip install griffe==0.48`) or update your code to use the current API of `griffe` if an alternative exists.","cause":"The `griffe.enumerations` module was removed in `griffe` 1.x as part of breaking changes to the library's API.","error":"ModuleNotFoundError: No module named 'griffe.enumerations'"},{"fix":"Pin `griffe` to a compatible version for your project or its dependencies (e.g., `pip install 'griffe<1.0.0'` or `griffe==0.48`) or update your project's code to align with `griffe`'s current API.","cause":"This error often occurs when a project relies on an older structure of `griffe`, specifically `griffe.dataclasses`, which was refactored or removed in `griffe` 1.0.0 and subsequent versions.","error":"ModuleNotFoundError: No module named 'griffe.dataclasses'"},{"fix":"Install the `griffe` package using your package manager (e.g., `pip install griffe`).","cause":"The `griffe` library is not installed in the Python environment where the code is being executed.","error":"ModuleNotFoundError: No module named 'griffe'"},{"fix":"To fix this, avoid wildcard imports, explicitly define `__all__` in your modules to declare the public API, and prevent name shadowing where a module and a member within its parent package share the same name.","cause":"`griffe` encountered an alias it could not resolve, often due to the use of wildcard imports (`from module import *`), undeclared `__all__` variables, or name shadowing between modules and members.","error":"griffe._internal.exceptions.AliasResolutionError: Could not resolve alias ..."}],"ecosystem":"pypi","meta_description":null,"install_score":100,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2.0.2","cli_name":"griffe","cli_version":"griffe 2.0.2","type":"library","homepage":"https://mkdocstrings.github.io/griffe","github":"https://github.com/mkdocstrings/griffe","docs":"https://mkdocstrings.github.io/griffe","changelog":"https://mkdocstrings.github.io/griffe/changelog","pypi":"https://pypi.org/project/griffe/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing","web-framework"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-28","install_tag":"verified"}}