Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .claude/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"permissions": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how it works but I'm not sure it's OK to decide permissions for someone, they can easily be made unsafe.

I saw in the previous commit that that is a local claude config file, I suggest to use that and not commit permissions to git.

"allow": [
"Bash(uv run pytest:*)",
"Bash(git add:*)",
"Bash(uv run mypy:*)",
"Bash(uv run pre-commit:*)"

],
"deny": []
}
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,6 @@ pip-wheel-metadata/

# pytest-benchmark
.benchmarks/

# Claude Code local settings
.claude/settings.local.json
51 changes: 51 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# CLAUDE.md
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read that the best practice now is not to have tool-specific file but to use an AGENTS.md file. Most tools pick it up automatically. If claude doesn't, maybe the CLAUDE.md file can be a symlink or point to AGENTS.md.


This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

Pluggy is a minimalist production-ready plugin system that serves as the core framework for pytest, datasette and devpi.
It provides hook specification and implementation mechanisms through a plugin manager system.

## Development Commands

All commands use `uv run` for consistent environments.

### Testing
- `uv run pytest` - Run all tests (prefer running all tests for quick feedback)
- `uv run pytest testing/benchmark.py` - Run benchmark tests

### Code Quality
- `uv run pre-commit run -a` - Run all pre-commit hooks (linting, formatting, type checking)
- Always reread files modified by pre-commit

## Development Process

- Always read `src/pluggy/*.py` to get a full picture
- Consider backward compatibility
- Always run all tests: `uv run pytest`
- Always run pre-commit before committing: `uv run pre-commit run -a`
- Prefer running full pre-commit over individual tools (ruff/mypy)



## Core Architecture

### Main Components

- **PluginManager** (`src/pluggy/_manager.py`): Central registry that manages plugins and coordinates hook calls
- **HookCaller** (`src/pluggy/_hooks.py`): Executes hook implementations with proper argument binding
- **HookImpl/HookSpec** (`src/pluggy/_hooks.py`): Represent hook implementations and specifications
- **Result** (`src/pluggy/_result.py`): Handles hook call results and exception propagation
- **Multicall** (`src/pluggy/_callers.py`): Core execution engine for calling multiple hook implementations

### Package Structure
- `src/pluggy/` - Main package source
- `testing/` - Test suite using pytest
- `docs/` - Sphinx documentation and examples
- `changelog/` - Towncrier fragments for changelog generation

## Configuration Files
- `pyproject.toml` - Project metadata, build system, tool configuration (ruff, mypy, setuptools-scm)
- `tox.ini` - Multi-environment testing configuration
- `.pre-commit-config.yaml` - Code quality automation (ruff, mypy, flake8, etc.)
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ readme = {file = "README.rst", content-type = "text/x-rst"}
requires-python = ">=3.9"

dynamic = ["version"]
[project.optional-dependencies]
[dependency-groups]
dev = ["pre-commit", "tox"]
testing = ["pytest", "pytest-benchmark", "coverage"]


[tool.setuptools]
packages = ["pluggy"]
package-dir = {""="src"}
Expand Down Expand Up @@ -67,6 +68,9 @@ lines-after-imports = 2

[tool.setuptools_scm]

[tool.uv]
default-groups = ["dev", "testing"]

[tool.towncrier]
package = "pluggy"
package_dir = "src/pluggy"
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ commands=
setenv=
_PYTEST_SETUP_SKIP_PLUGGY_DEP=1
coverage: _PLUGGY_TOX_CMD=coverage run -m pytest
extras=testing
dependency_groups=testing
deps=
coverage: coverage
pytestmain: git+https://github.com/pytest-dev/pytest.git@main
Expand Down
Loading