Compare commits

...

7 Commits

Author SHA1 Message Date
Andrew Murray
b71096460f Update MANIFEST 2026-04-25 11:30:32 +10:00
Andrew Murray
933716f3d3 Added CLAUDE.md 2026-04-25 11:19:53 +10:00
Andrew Murray
6305a17401 Update alignment 2026-04-24 20:53:43 +10:00
Jeffrey 'Alex' Clark
35c3fcc7e3 Remove CI checks section from AGENTS.md
Not actionable for agents — knowing workflow names and triggers
does not help write better code.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-22 20:04:35 -04:00
Jeffrey 'Alex' Clark
d9fb08b797 Update AGENTS.md
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
2026-04-22 19:53:49 -04:00
Jeffrey 'Alex' Clark
17e6f08f83 Rename copilot-instructions.md -> AGENTS.md 2026-04-22 16:28:06 -04:00
Jeffrey 'Alex' Clark
718edc5cc7 Add .github/copilot-instructions.md
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-22 14:06:09 -04:00
3 changed files with 97 additions and 0 deletions

1
.claude/CLAUDE.md Normal file
View File

@ -0,0 +1 @@
@../AGENTS.md

95
AGENTS.md Normal file
View File

@ -0,0 +1,95 @@
# Agent Instructions for Pillow
## What this project is
Pillow is the Python Imaging Library fork — a Python 3.10+ library for opening,
manipulating, and saving many image file formats. It is a mix of Python and C:
pure Python format plugins live in `src/PIL/`, and eight C extension modules
(`_imaging`, `_imagingcms`, `_imagingft`, `_imagingmath`, `_imagingmorph`,
`_imagingtk`, `_avif`, `_webp`) are compiled at install time via `setup.py`.
## Project layout
```
src/PIL/ Python source and C extension stubs (.pyi)
src/thirdparty/ Vendored C libraries (raqm, fribidi-shim, pythoncapi_compat)
Tests/ pytest test suite; Tests/helper.py has shared utilities
docs/ Sphinx documentation (RST)
docs/releasenotes/ Per-release changelog entries
setup.py C extension build configuration
_custom_build/ Custom setuptools build backend
src/PIL/_version.py Version number (PEP 440)
pyproject.toml Project metadata and optional dependency groups
.pre-commit-config.yaml All linting and formatting hooks
```
## Install
```bash
python3 -m pip install -e ".[tests]"
```
The C extensions are compiled during install. Native libraries (libjpeg,
libpng, libtiff, libwebp, freetype2, littlecms2, etc.) must already be present
on the system.
## Test
```bash
python3 selftest.py # quick sanity check
python3 -m pytest Tests/ # full test suite
python3 -m pytest Tests/ -n auto # parallel (requires pytest-xdist)
```
Always run `python3 selftest.py` first. New features and bug fixes must include
tests. Test files follow the naming pattern `Tests/test_*.py`.
## Lint and format
```bash
make lint # runs tox -e lint → pre-commit (black, ruff, clang-format,
# bandit, sphinx-lint, pyproject-fmt, and more)
make lint-fix # auto-fixes black and ruff violations
```
Or run pre-commit directly:
```bash
pre-commit run --all-files
```
All hooks must pass before a PR can be merged. Separate reformatting commits
from functional commits.
## Type checking
```bash
python3 -m tox -e mypy
```
## Documentation
Docs use Sphinx/RST. Build locally with `make doc`. Release notes go in
`docs/releasenotes/<version>.rst` using the existing section structure
(Security, Backwards incompatible changes, Deprecations, API changes, API
additions, Other changes). Use the `:cve:` RST role for CVE references.
Include a release note entry for any user-visible change.
## Pillow-specific guidance
Use `python3` and `python3 -m pip install` — never `python` or bare `pip`.
`Image.open()` takes a `formats=` argument (list/tuple of format IDs to
allowlist). There is no `format=` parameter.
`Image.OPEN` is an internal format registry. Do not recommend that users
mutate it as a security or configuration mechanism.
`pybind11` is a build-time-only dependency used for parallel C compilation,
not for C++/Python bindings.
Use fully qualified exception names: `Image.DecompressionBombError` and
`Image.DecompressionBombWarning`, not the bare class names.
Do not embed specific numeric values for thresholds like `MAX_IMAGE_PIXELS`
they may be changed by the user at runtime. Reference the named constant instead.

View File

@ -12,6 +12,7 @@ include .flake8
include LICENSE
include Makefile
include tox.ini
graft .claude
graft Tests
graft Tests/images
graft checks