pythontests: keep uv virtualenv outside the checkout - #93
Open
nonprofittechy wants to merge 1 commit into
Open
Conversation
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>
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.
Summary
nltk 3.10.1shipped 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 internalimport regexand breaking test collection for every downstream repo pulling indocassemble.base(e.g.docassemble-ALDashboardrun 31616118565).nltkhas since fixed this in3.10.3, but nothing stops another package from shipping a similar check in the future.UV_PROJECT_ENVIRONMENTat$RUNNER_TEMP/venvbeforeuv syncruns, 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
docassemble-ALDashboardwithUV_PROJECT_ENVIRONMENTpointed outside the repo:uv sync --group dev,uv run mypy . --exclude '^build/' --explicit-package-bases, anduv run pytest docassemble/ALDashboard/test/all pass (372 tests, 61 files clean under mypy).docassemble-ALDashboard'smypy.ymlagainst this branch viaSuffolkLITLab/ALActions/pythontests@uv-venv-outside-workspace).🤖 Generated with Claude Code