Skip to content

Commit 45a2620

Browse files
Add CLAUDE.md with development guidance
also add uv based tooling to ease things Co-Authored-By: Claude <[email protected]> - add ruff/mypy - allow claude to run some commands directly
1 parent 96e05d6 commit 45a2620

File tree

6 files changed

+595
-3
lines changed

6 files changed

+595
-3
lines changed

.claude/settings.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(uv run pytest:*)",
5+
"Bash(git add:*)",
6+
"Bash(uv run mypy:*)",
7+
"Bash(uv run pre-commit:*)"
8+
9+
],
10+
"deny": []
11+
}
12+
}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,6 @@ pip-wheel-metadata/
6767

6868
# pytest-benchmark
6969
.benchmarks/
70+
71+
# Claude Code local settings
72+
.claude/settings.local.json

CLAUDE.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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.)

pyproject.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ readme = {file = "README.rst", content-type = "text/x-rst"}
3535
requires-python = ">=3.9"
3636

3737
dynamic = ["version"]
38-
[project.optional-dependencies]
39-
dev = ["pre-commit", "tox"]
38+
[dependency-groups]
39+
dev = ["pre-commit", "tox", "mypy", "ruff"]
4040
testing = ["pytest", "pytest-benchmark", "coverage"]
4141

42+
4243
[tool.setuptools]
4344
packages = ["pluggy"]
4445
package-dir = {""="src"}
@@ -67,6 +68,9 @@ lines-after-imports = 2
6768

6869
[tool.setuptools_scm]
6970

71+
[tool.uv]
72+
default-groups = ["dev", "testing"]
73+
7074
[tool.towncrier]
7175
package = "pluggy"
7276
package_dir = "src/pluggy"

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ commands=
99
setenv=
1010
_PYTEST_SETUP_SKIP_PLUGGY_DEP=1
1111
coverage: _PLUGGY_TOX_CMD=coverage run -m pytest
12-
extras=testing
12+
dependency_groups=testing
1313
deps=
1414
coverage: coverage
1515
pytestmain: git+https://github.com/pytest-dev/pytest.git@main

0 commit comments

Comments
 (0)