Add CI, a tests stub, and a project README template - #6
Merged
Conversation
This repo is the base template for the lab's Python projects, but it had no tests, no CI, and its README described the template itself rather than the project built from it. - Add .github/workflows/ci.yml, running the pre-commit hooks over all files and the test suite on every push and pull request. - Add tests/ with a stub covering the example hello function, and pytest as a dev dependency. Unlike the linters, pytest has to import the project, so it needs the environment rather than uvx. - Rename src/python-base to src/package_name. The old name contained a hyphen, so it was not a valid module name and could not be imported; the placeholder is now importable and project-agnostic. This also surfaced a ruff D104 error that had been skipped while the package name was invalid, hence the new __init__ docstring. - Turn README.md into a fill-in-the-blanks template for downstream projects, and move the template's own documentation to GUIDELINES.md. - Document how to populate tests/ and how CI works in GUIDELINES.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
astral-sh/setup-uv publishes floating major tags only up to v7, so `@v8` did not resolve and the pre-commit job failed at setup. Pin the exact release instead. actions/checkout and actions/cache do publish current major tags, so those stay as they are. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This repo is the base template for the lab's Python projects, but it had no tests, no CI, and its README described the template itself rather than the project built from it. It also picks up the pre-commit and container work that was sitting uncommitted in the tree.
What's here
CI —
.github/workflows/ci.ymlruns two jobs on every push tomainand every PR:pre-commit(every hook over all files) andpytest(uv sync --frozenthen the suite). The Python version is pinned viaPYTHON_VERSIONat the top of the workflow and should be kept in step withcontainers/apptainer.def.Tests —
tests/test_hello.pyis a stub covering the examplehello().pytestis a dev dependency rather than auvxtool: unlike the linters, it has to import the project, so it needs the environment.Package rename —
src/python-base/→src/package_name/. The old name contained a hyphen, so it was not a valid module name andimport python_basefailed on a fresh clone. The placeholder is now importable and project-agnostic (python-baseis the repo name, not the package name). This also made ruff start checking the package, surfacing aD104that had been silently skipped — hence the new__init__.pydocstring.Docs —
README.mdbecomes a fill-in-the-blanks template for downstream projects, with the template's own documentation moved toGUIDELINES.md.GUIDELINES.mdgains sections on populatingtests/and on how CI works; setup step 2 now explains the underscore rule for package names.AGENTS.mdnow points atsrc/package_name/instead of the leftoversrc/jaxifer-harness/.Verification
uvx pre-commit run --all-filespasses all 8 hooks,uv sync --frozen && uv run pytestpasses, andactionlintreports no findings on the workflow. The action versions (checkout@v7,setup-uv@v8,cache@v6) were checked against the API rather than guessed.Notes for review
AGENTS.mdandGUIDELINES.mdto 100 columns, which accounts for much of the diff noise in those files..gitignoreno longer ignoresdocs/,containers/, andmodels/, socontainers/is now tracked.--no-verifybecause the installed.git/hooks/pre-commitis stale (it points at an absolute path from another machine). The hooks were run manually over all files instead, with the results above. Runninguvx pre-commit installwill regenerate the hook locally.🤖 Generated with Claude Code