Repository navigation
fix: stop writing bytecode caches in installs and the test suite - #16
Merged
Merged
Conversation
Any lint run on a normal Python created wikilint/__pycache__/ in the install. The template ships no .gitignore, so the agent's next `git add -A` would commit bytecode into the wiki's history. lint.py now sets sys.dont_write_bytecode before importing the engine; recompiling ~1,900 lines per run costs milliseconds. The suite also littered the template: test_variants' py_compile wrote wiki/__pycache__/lint.*.pyc, which then surfaced as an unknown top-level entry when linting the template. It now uses builtin compile(), and helpers.py disables bytecode writes for the whole run.
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
Install bug: on any Python that writes bytecode (any normal 3.11+), each
python3 lint.py ...run createdwikilint/__pycache__/inside the wiki. The template ships no.gitignore, so the agent's nextgit add -Awould commit.pycfiles into the wiki's history. Reproduced on a field-test install:?? wikilint/__pycache__/after a single lint run.lint.pynow setssys.dont_write_bytecode = Truebefore importing the engine. Recompiling about 1,900 lines per run costs milliseconds, so the cache bought nothing.Test hygiene: the suite wrote
wiki/__pycache__/lint.*.pycinto the template throughpy_compileintest_everything_compiles. That directory then showed up as an "unknown top-level entry" warning when linting the template. The test now uses builtincompile(), which checks syntax without writing files, andtests/helpers.pyturns off bytecode writes for the whole run.Test plan
tests/test_no_bytecode.pywritten red first (a subprocess lint run in a copied install leaves no__pycache__; the suite runs with bytecode writes off; nopy_compilein tests)__pycache__dirs afterwardsgit statusand no bytecode ingit ls-files