|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +Pluggy is a minimalist production-ready plugin system that serves as the core framework for pytest, datasette and devpi. |
| 8 | +It provides hook specification and implementation mechanisms through a plugin manager system. |
| 9 | + |
| 10 | +## Development Commands |
| 11 | + |
| 12 | +### Testing |
| 13 | +- `uv run pytest` - Run all tests, prefer runnign all tests to quickly get feedback |
| 14 | +- `uv run pytest testing/benchmark.py` runs the benchmark tests |
| 15 | + |
| 16 | +### Code Quality |
| 17 | +- `uv run pre-commit run -a` - Run all pre-commit hooks - gives linting and typing errors + corrects files |
| 18 | +- reread files that get fixed by pre-commit |
| 19 | + |
| 20 | + |
| 21 | +## Development process |
| 22 | + |
| 23 | +- always read `src/pluggy/*.py` to get a full picture |
| 24 | +- consider backward compatibility |
| 25 | +- always run all tests |
| 26 | +- always run pre-commit before try to commit |
| 27 | +- prefer running full pre-commit over ruff/mypy alone |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | +## Core Architecture |
| 32 | + |
| 33 | +### Main Components |
| 34 | + |
| 35 | +- **PluginManager** (`src/pluggy/_manager.py`): Central registry that manages plugins and coordinates hook calls |
| 36 | +- **HookCaller** (`src/pluggy/_hooks.py`): Executes hook implementations with proper argument binding |
| 37 | +- **HookImpl/HookSpec** (`src/pluggy/_hooks.py`): Represent hook implementations and specifications |
| 38 | +- **Result** (`src/pluggy/_result.py`): Handles hook call results and exception propagation |
| 39 | +- **Multicall** (`src/pluggy/_callers.py`): Core execution engine for calling multiple hook implementations |
| 40 | + |
| 41 | +### Package Structure |
| 42 | +- `src/pluggy/` - Main package source |
| 43 | +- `testing/` - Test suite using pytest |
| 44 | +- `docs/` - Sphinx documentation and examples |
| 45 | +- `changelog/` - Towncrier fragments for changelog generation |
| 46 | + |
| 47 | +## Configuration Files |
| 48 | +- `pyproject.toml` - Project metadata, build system, tool configuration (ruff, mypy, setuptools-scm) |
| 49 | +- `tox.ini` - Multi-environment testing configuration |
| 50 | +- `.pre-commit-config.yaml` - Code quality automation (ruff, mypy, flake8, etc.) |
0 commit comments