PSD401 template for Python tools and libraries. uv-managed, src layout, Python 3.12+.
- uv-managed project:
pyproject.toml+ committeduv.lock,requires-python >= 3.12, hatchling build backend, src layout with a typed example module (src/psd_tool/text.py,py.typedmarker). - pytest with real, exact-value assertions covering unicode, truncation, empty input, and both error paths (
tests/test_slugify.py). PSD CI fails zero-test repos by design. - ruff as both linter and formatter — line length 100,
E W F I UP B SIM RUFrule set, config lives inpyproject.toml. - PSD CI wiring (org reusable workflows), Dependabot (github-actions + uv, weekly, minor/patch grouped), MIT LICENSE, CLAUDE.md.
Everything runs through uv — never bare python or pip:
uv run pytest # not: python -m pytest
uv run some_script.py # not: python some_script.pySingle-file scripts declare inline dependencies with PEP 723 metadata and run with uv run script.py:
# /// script
# requires-python = ">=3.12"
# dependencies = ["httpx"]
# ///- Rename:
nameinpyproject.toml, thesrc/psd_tool/package directory, the[tool.hatch.build.targets.wheel]packages entry, and imports intests/. Naming: lowercase-kebab repo, snake_case package,psd-prefix for district-specific tools. - Set repo custom properties:
tier(defaultc-experiment),owner,lifecycle: active; add topics (python, …). - Review CLAUDE.md and prune it to your tool.
- Verify green:
uv sync && uv run pytest && uv run ruff check && uv run ruff format --check. - Replace
text.py/test_slugify.pywith your real module and tests — never leave the repo with zero tests.
| Task | Command |
|---|---|
| Install/sync | uv sync |
| Test | uv run pytest |
| Lint | uv run ruff check |
| Format | uv run ruff format |
| Format check (CI) | uv run ruff format --check |
Technology Services, Peninsula School District.