feat(grader): venv hygiene checks + Python .gitignore#5
Open
lassebenni wants to merge 1 commit into
Open
Conversation
Adds three grader_lib checks to surface venv hygiene problems on
every PR, and fixes the template's .gitignore so cloned student
repos don't accidentally track .venv/ or __pycache__/.
- .gitignore: add Python virtualenv folders (.venv/, venv/, env/, ENV/),
bytecode/caches (__pycache__/, *.pyc, .pytest_cache/, .ruff_cache/,
.mypy_cache/), and build artefacts. The template previously shipped
the GitHub Node template only — Python students cloning it had no
protection against committing a venv folder.
- grader_lib.sh:
- Extend check_gitignore_python: also require .venv/ (or venv/).
- Add check_no_venv_committed: FAILs when git ls-files shows a
tracked .venv/, venv/, env/, or ENV/ entry. Curriculum: Week 1
Ch1 'Don't commit the venv folder'.
- Add check_lockfile_present: WARNs when no requirements.txt,
uv.lock, or pyproject.toml is at the repo root, with a nudge
to 'pip freeze > requirements.txt' inside an activated venv.
- test.sh: wire the two new checks into the Code Hygiene block,
matching this PR series' '0-pt warnings, scoring ladder unchanged'
rule.
Companion PR on the curriculum side:
HackYourFuture/hyf-datatrack #245.
Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Stacks on #4 (
feat/autograder-improvements). Rebase tomainonce #4 lands.Summary
.gitignore: adds a Python section (.venv/,venv/,env/,ENV/,__pycache__/,*.pyc,.pytest_cache/,.ruff_cache/,.mypy_cache/, build/dist). The template previously shipped only the GitHub Node template — students cloning it for a Python assignment had zero protection against committing a venv folder.grader_lib.sh: extends the existingcheck_gitignore_pythonto also require.venv//venv/, plus two new hygiene checks following the same pattern:check_no_venv_committed—FAILwhengit ls-filesshows a tracked venv folder. Curriculum cross-link: Week 1 Ch1 Don't commit the venv folder.check_lockfile_present—WARNwhen neitherrequirements.txt,uv.lock, norpyproject.tomlis at the repo root, with a nudge topip freeze > requirements.txt.test.sh: wires both into the Code Hygiene block. Scoring ladder unchanged, matching feat(autograder): shared grader_lib + 7 hygiene checks from c55 reviews #4's promise.Why
Curriculum side: HackYourFuture/hyf-datatrack #245 teaches "commit the recipe, not the cooked meal" and updates Week 1's rubric to call these checks out. Without this PR the rubric is aspirational.
This PR intentionally does not rebuild a fresh venv from the lockfile and run the cleaner inside it. That is the natural next step (and is needed once Week 2 ships pytest/ruff deps), but for Week 1 the cleaner is stdlib-only so the rebuild would be ceremonial. I'll send a follow-up PR that wires the rebuild once we're ready to escalate the rubric beyond static checks.
Test plan
bash .hyf/test.shon this branch in the template repo: new checks fire (✓gitignore,✓no venv committed,⚠no lockfile). Score ladder unchanged..venv/.gitkeep, re-run grader, confirmcheck_no_venv_committedFAILs.touch requirements.txt, re-run grader, confirmcheck_lockfile_presentPASSes.f3e4cb4.🤖 Generated with Claude Code