This file defines repo-specific guidance for coding agents working on setupmeta.
Use it as the first source of truth for how to make changes safely and consistently.
setupmetaprimarily supports git-tag-based versioning and automated version bumps.- Secondarily, it also:
- Provides custom setup commands:
explain,version, andcheck(this will be phased out assetup.pygets retired in favor ofpyproject.toml). - Helps keep
setup.pyfiles minimal by auto filling metadata and requirements (this will also be sunset withpyproject.toml, as that format is declarative and doesn't lend itself to autofill).
- Provides custom setup commands:
- The project is self-hosted:
setup.pyusessetupmetaitself and has bootstrap behavior.
- Preserve backward compatibility for users relying on legacy
setup.pyworkflows. - Keep runtime dependencies minimal; prefer stdlib for runtime code.
- Favor explicit, test-covered behavior over cleverness.
- Keep documentation aligned with actual behavior and test scenarios.
setupmeta/: main library code (commands,model,scm,versioning, etc.)tests/: unit tests + scenario replay teststests/scenarios/andexamples/: behavior fixtures withexpected.txtsnapshotsdocs/: user and contributor documentationsetup.py: self-bootstrapping package definitiontox.ini: test/lint/docs/coverage orchestration
Use these commands from repo root:
- Quick tests:
.venv/bin/pytest -q - Full test/lint/docs run:
tox - Single tox env:
tox -e py314 - Fast compatibility matrix (old+new + coverage):
tox -e py39,py314,coverage - Style only:
tox -e style - Docs checks:
tox -e docs - Refresh scenario snapshots:
tox -e refreshscenarios - Manual command checks:
.venv/bin/python setup.py explain.venv/bin/python setup.py version.venv/bin/python setup.py check -q
Notes:
tox.inipinsUV_CACHE_DIRto.tox/.uv-cache, to help runs in sandboxed environments.py37tox target exists because it is the oldest Python still supported by this library.- If
py37is unavailable locally (common on macOS arm64), substitute the oldest available interpreter and pair it with the newest one. Example: system Python3.9+3.14viatox -e py39,py314,coverage. - Intent: keep local runs fast while still exercising one older runtime and one modern runtime,
with
coverage combinevalidating cross-env coverage data.
- Keep changes narrow and focused.
- Maintain Python compatibility targeted by this repo (including older supported versions).
- When changing behavior, update both tests and docs in the same change.
- Do not silently alter CLI output formats used by scenario snapshots unless intentional.
- If you touch versioning logic, verify:
tests/test_versioning.pytests/test_setup_py.py- scenario outputs that include
version/explain.
- Scenario tests compare command output against
expected.txt. - If behavior changes are intentional:
- Regenerate snapshots (
tox -e refreshscenarios). - Review diffs in
tests/scenarios/*/expected.txtandexamples/*/expected.txt. - Ensure docs and release notes explain user-visible changes.
- Regenerate snapshots (
- If behavior changes are not intentional, fix code/tests instead of accepting snapshot churn.
- Keep
README.rst,docs/*.rst, and example READMEs consistent with current behavior. - Avoid documenting deprecated/removed commands as active features.
- Keep versioning docs aligned with current strategy defaults and command examples.
- Record user-visible changes in
HISTORY.rst.
Before finalizing a change, verify:
- Tests pass for affected areas.
- Formatting/lint checks pass.
- Scenario snapshots are unchanged unless intentionally updated.
- Docs are updated if behavior or commands changed.
- No unrelated files were modified.
Ask the maintainer before proceeding if:
- A change could break backward compatibility.
- Expected output changes are broad/noisy and intent is unclear.
- A docs update conflicts with tested behavior.
- A refactor touches bootstrap or version bump internals in
setup.py,setupmeta/hook.py,setupmeta/versioning.py, orsetupmeta/scm.py.