Skip to content

pythontests: keep uv virtualenv outside the checkout - #93

Open
nonprofittechy wants to merge 1 commit into
mainfrom
uv-venv-outside-workspace
Open

pythontests: keep uv virtualenv outside the checkout#93
nonprofittechy wants to merge 1 commit into
mainfrom
uv-venv-outside-workspace

Conversation

@nonprofittechy

Copy link
Copy Markdown
Member

Summary

  • nltk 3.10.1 shipped an import-time guard (nltk/inisec.py) meant to mitigate CWE-427 (uncontrolled search path) by blocking any import that resolves to a path inside the current working directory. It false-positives against a project-local .venv (uv's default), blocking nltk's own internal import regex and breaking test collection for every downstream repo pulling in docassemble.base (e.g. docassemble-ALDashboard run 31616118565).
  • nltk has since fixed this in 3.10.3, but nothing stops another package from shipping a similar check in the future.
  • This adds one step that points UV_PROJECT_ENVIRONMENT at $RUNNER_TEMP/venv before uv sync runs, so the virtualenv never lives inside $GITHUB_WORKSPACE. Everything downstream (uv sync, uv run mypy, uv run pytest) picks it up automatically via the exported env var.

Test plan

  • Ran the equivalent of this action's steps locally against docassemble-ALDashboard with UV_PROJECT_ENVIRONMENT pointed outside the repo: uv sync --group dev, uv run mypy . --exclude '^build/' --explicit-package-bases, and uv run pytest docassemble/ALDashboard/test/ all pass (372 tests, 61 files clean under mypy).
  • Confirm this workflow still passes in CI for at least one consuming repo (e.g. re-run docassemble-ALDashboard's mypy.yml against this branch via SuffolkLITLab/ALActions/pythontests@uv-venv-outside-workspace).

🤖 Generated with Claude Code

nltk 3.10.1 added an import-time guard against CWD module hijacking
that misfires whenever the venv lives inside the project directory
(uv's default), blocking nltk's own internal imports and breaking
test collection for every consuming repo. Moving the environment to
$RUNNER_TEMP sidesteps this and any future package doing the same
kind of check.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant