Contributing¶
Thanks for helping improve pypresscart.
Ground rules¶
Runtime deps stay at
requests+pydantic. If you think you need a third, open an issue first.Single sync client. No async variant without a clear design proposal.
Every new endpoint method needs matching Pydantic models and at least one test.
Every public method supports dual-mode (Pydantic and dict). See Dual-Mode I/O.
Local setup¶
git clone https://github.com/pypresscart/py-presscart.git
cd py-presscart
uv sync --group dev
Activate pre-commit hooks:
uv run pre-commit install # ruff + mypy on every commit
uv run pre-commit install --hook-type pre-push # pytest on every push
Development loop¶
uv run pytest -v # unit tests
uv run pytest --cov # with coverage (≥75% required)
uv run ruff check --fix . # lint + autofix (includes isort)
uv run ruff format . # format
uv run mypy src # type-check (strict)
Before opening a PR, all five commands must pass. The pre-commit hooks run the first three; the pre-push hook runs pytest.
Building the library¶
uv build
# produces dist/pypresscart-<version>-py3-none-any.whl
# dist/pypresscart-<version>.tar.gz
Adding a new endpoint¶
When Presscart ships a new endpoint:
Locate (or add) the spec in
api-docs/api-reference-<resource>.md.Add or extend the Pydantic model(s) in
src/pypresscart/models/<resource>.py.Add a method on the corresponding
*Resourceclass insrc/pypresscart/resources/<resource>.py. Include the scope in its docstring.Re-export user-facing model types from
src/pypresscart/__init__.py.Add tests under
tests/test_<resource>.py: happy path, dual-mode coverage, one error path if interesting.Run the full dev loop.
Update the matching docs page (e.g.
docs/resource-<name>.md) anddocs/models-reference.md.
Adding a new resource¶
If Presscart adds a whole new resource group:
Create
src/pypresscart/models/<name>.py.Create
src/pypresscart/resources/<name>.pywith a<Name>Resource(ResourceBase)class.Wire it into
PresscartClient.__init__asself.<name>: <Name>Resource = <Name>Resource(self).Re-export from
pypresscart/__init__.py.Add a docs page:
docs/resource-<name>.md.Add a
toctreeentry indocs/index.mdand the resource table in the projectREADME.md.
Commits and PRs¶
Commit messages describe why, not what.
fixfor bug fixes,featfor additions,refactorfor non-behavioral changes,docsfor documentation.Do not add
Co-Authored-By: Claude ...trailers (or any AI attribution) to commits.Rebase on
mainbefore opening a PR; squash noise into meaningful commits.
Releasing¶
Releases are cut from main by maintainers. See the release skill in .claude/skills/release/ for the full procedure. In short:
# bump src/pypresscart/_version.py AND pyproject.toml
uv build
uv publish # needs UV_PUBLISH_TOKEN
git tag v<X.Y.Z> && git push --tags
Docs¶
Docs in docs/ build a Sphinx site deployed to GitHub Pages by .github/workflows/docs.yml. See docs/README.md in the repo for the local authoring workflow.
Code of conduct¶
Be kind. Assume good faith. Flag issues, not people.