This guide applies to the entire repository. It is the canonical operational policy for contributors and coding agents.
- Before editing
docs-site/**, also readdocs-site/AGENTS.md. - Before editing
pythonlings/docs/**or its generator, also readpythonlings/docs/AGENTS.md. - Nested guides add local requirements; this root guide still applies.
- Treat
.pythonlings/as ignored learner runtime state, not repository source.
Run commands from the repository root.
- Install development dependencies:
python -m pip install -e ".[dev]" - Run a targeted test:
python -m pytest tests/unit/test_runner.py -q - Run the full suite:
python -m pytest -q - Verify a passing curriculum:
pythonlings --root tests/fixtures/passing_curriculum verify - Install the packaging frontend:
python -m pip install build - Build the source and wheel distributions:
python -m build
Every pull request must run:
python -m pytest -qpythonlings --root tests/fixtures/passing_curriculum verify
Add the checks that match the change:
- Packaging, curriculum, or workspace changes: install
build, runpython -m build, runpython -m pip install --force-reinstall dist/pythonlings-*.whl, and exercise the relevant installed flow. - CLI changes: run the relevant tests under
tests/integration/and include representative command output. - TUI changes: run the relevant tests under
tests/tui/and include current screenshots or GIFs of the affected flow. - Documentation changes: follow the applicable nested
AGENTS.md.
Record the exact commands and their results in the pull request description.
- Follow
CONTRIBUTING.mdfor branch naming, pull request content, and the contributor workflow. - Branch from the current
devusingfeature/<name>orfix/<name>, and target pull requests todev. - Keep pull requests in draft until local validation is complete and recorded.
- Squash-merge feature and fix pull requests into
devonly after CI passes and review feedback is resolved. - Promote a verified
devbranch tomainwith a merge commit. Do not squash thedevtomainrelease promotion. - Never merge or enable auto-merge without explicit maintainer approval.
- Maintain Python 3.9 compatibility. Guard standard-library APIs introduced in newer Python versions and preserve required fallbacks.
- Keep Textual imports out of
pythonlings/core/and one-shot CLI command import paths. Core behavior must remain usable without loading the TUI. - Preserve the runner's isolated subprocess, five-second default timeout,
shared exercise/check namespace, and
# I AM NOT DONEcompletion marker. - Preserve atomic state writes and corrupt-state backup. Do not discard learner progress when changing state handling.
- Preserve learner-edited exercises during workspace updates. Reset snapshots and bundled curriculum updates must not overwrite learner work implicitly.
Exercise names and their order in info.toml are learner-facing compatibility.
Avoid renaming, reordering, or removing them without an explicit migration.
For each curriculum change, keep all of these synchronized:
exercises/<topic>/<name>.py- the mirrored
checks/<topic>/<name>.py solutions/<name>.py, which is a reference-solution loader- the corresponding answer in
solutions/_answers.py - the hint, documentation URL, and ordered manifest entry in
info.toml
Keep learner exercise files intentionally incomplete with # I AM NOT DONE.
Checks must use bare assertions with actionable, beginner-facing messages. Keep
curriculum code self-contained because it is copied into learner workspaces.
For changed learner exercises, confirm the marker remains present and run
python -m pytest tests/integration/test_solution_verify.py -q to prove their
reference solutions pass.
- Report vulnerabilities privately. Never disclose them through public issues
or pull requests; follow
SECURITY.md. - Use only
pythonlingsas the distribution name. Do not publish or document this repository under a different package name. - Read
RELEASE.mdbefore changing versions, tags, release workflows, or publishing behavior.