{"id":1502,"library":"griffecli","title":"Griffe CLI","description":"griffecli provides the command-line interface for Griffe, a powerful library designed to extract structural information and API signatures from Python projects. It's used to generate API documentation and detect breaking changes. The current version is 2.0.2, and it follows the release cadence of its core library, Griffe, which is actively maintained.","status":"active","version":"2.0.2","language":"en","source_language":"en","source_url":"https://github.com/mkdocstrings/griffe","tags":["documentation","api-generation","cli","code-analysis","type-hints"],"install":[{"cmd":"pip install griffecli","lang":"bash","label":"Install griffecli"}],"dependencies":[{"reason":"griffecli is a command-line interface wrapper for the griffe library, and it explicitly depends on griffe>=2.0.0 for its core functionality.","package":"griffe","optional":false}],"imports":[{"note":"griffecli itself is primarily a console script entry point. Programmatic access to its CLI functionality is typically done by importing and calling `main` from the underlying `griffe.cli` module. Direct imports from `griffecli` are not common for API usage, as the core library `griffe` offers direct programmatic interfaces.","wrong":"import griffecli","symbol":"main","correct":"from griffe.cli import main"}],"quickstart":{"code":"import os\nfrom pathlib import Path\nfrom griffe.cli import main\n\n# Create a dummy module for demonstration\nPath('my_module.py').write_text(\n    \"\"\"\"\"\"A simple module.\n\ndef hello():\n    \"\"\"Say hello.\"\"\"\n    return 'Hello, Griffe!'\n\"\"\"\n)\n\n# Programmatically run the 'griffe dump' command\n# Equivalent to: griffe dump my_module.py --output-format json\n# We pass arguments as if they were from the command line\ntry:\n    main(['dump', 'my_module.py', '--output-format', 'json'])\nexcept SystemExit as e:\n    if e.code != 0:\n        print(f\"Error running Griffe: {e}\")\n\n# Clean up\nPath('my_module.py').unlink(missing_ok=True)\nPath('my_module.json').unlink(missing_ok=True)\n","lang":"python","description":"The primary way to use `griffecli` is via the command line. This example demonstrates how to programmatically invoke the `griffe dump` command, which extracts module information, and outputs it in JSON format. It's equivalent to running `griffe dump my_module.py --output-format json` in your shell."},"warnings":[{"fix":"Review the Griffe 2.0 migration guide if upgrading from 1.x. Adapt programmatic usage to the new API. Be aware of changes in the `griffe dump` output schema.","message":"Griffe 2.x (and thus griffecli 2.x) introduced significant breaking changes from Griffe 1.x. The internal API was heavily refactored, which impacts users who were accessing Griffe programmatically (e.g., `GriffeLoader` instantiation). The output format of `griffe dump` also changed.","severity":"breaking","affected_versions":"griffecli 2.x, griffe 2.x"},{"fix":"For programmatic usage, refer to the `griffe` library documentation for its Python API. Use `griffecli` mainly for its command-line entry point (`griffe`).","message":"griffecli is primarily a command-line wrapper. The actual core logic and API are provided by the `griffe` library. When using programmatically, you will typically import directly from `griffe` (e.g., `from griffe.loader import GriffeLoader`) rather than trying to import from `griffecli` itself.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Remove the `docstrings_parser` parameter from your code. If you need to specify a parser, use the `docstring_parser` string argument instead, e.g., `docstring_parser='markdown'`.","message":"The `docstrings_parser` argument (a parameter) was removed in Griffe 2.x. Its functionality was replaced by the `docstring_parser` argument (a string name, like 'markdown' or 'griffe') or inferred automatically.","severity":"deprecated","affected_versions":"griffecli 2.x, griffe 2.x"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}