Skip to content

chore: untrack committed developer virtualenv (build-env/) [#106] - #132

Merged
karlwaldman merged 1 commit into
mainfrom
chore/untrack-build-env-106
Sep 13, 2026
Merged

karlwaldman merged 1 commit into
mainfrom
chore/untrack-build-env-106

Conversation

@karlwaldman

Copy link
Copy Markdown
Member

Closes #106.

A developer virtualenv was tracked in version control. This removes the tracked entries from the tip of main, adds an ignore rule so a recreated environment is not re-added, and adds a guard test so it cannot regress. No history rewrite; no developer's on-disk environment is deleted.

1. Reproduced on current main

$ git rev-parse HEAD
7982b0b9bbb4a0d9cc5343033baa74abc8224455

$ git ls-tree -r HEAD --name-only | grep -c '^build-env'
49

The 49 entries are 45 launcher scripts under build-env/bin/ (including pip, pip3, pip3.12, pytest, py.test, python, python3, python3.12, black, mypy, ruff, twine, virtualenv, pre-commit, oilprice), the four shell activation scripts (activate, activate.csh, activate.fish, Activate.ps1), build-env/pyvenv.cfg, and the build-env/lib64 symlink. Each launcher carries a shebang with an absolute path to one machine's interpreter.

The local build-env/ directory is 34 MB; only these 49 entries were ever tracked, and only those 49 are in scope here.

2. Nothing in the repository consumes build-env

Search over every tracked file:

$ git grep -n -I -e 'build-env' -e 'build_env' -- . ':(exclude)build-env'
$ echo $?
1

Recursive search over the whole working tree, not just tracked files:

$ grep -rn --binary-files=without-match 'build-env' . --exclude-dir=.git --exclude-dir=build-env
$ echo $?
1

Targeted search of the build/CI surface:

$ grep -rn 'build-env' .github scripts docs
$ echo $?
1

Both greps returned no matches (exit 1). A positive control with the same command shape confirms the invocation works rather than silently matching nothing:

$ git grep -n -I -e 'oilpriceapi' -- . ':(exclude)build-env' | head -3
.env.example:5:# Get your API key at: https://oilpriceapi.com
.env.example:9:# Default: https://api.oilpriceapi.com
.env.example:11:OILPRICEAPI_BASE_URL=https://api.oilpriceapi.com

The other consumers named in the issue do not exist in this repository — there is no Makefile, tox.ini, noxfile.py, setup.py, setup.cfg or .pre-commit-config.yaml. MANIFEST.in and pyproject.toml exist and neither mentions build-env. The five workflows under .github/workflows/ (github-pages.yml, live-tests.yml, publish.yml, test.yml, weekly-health.yml) each create their own environment; none reference the tracked one.

Conclusion: no required consumer. Deletion is safe.

3. Red / green evidence

tests/test_no_tracked_virtualenv.py shells out to git ls-files and asserts that (a) no tracked path sits under a virtualenv directory, (b) no pyvenv.cfg or activation script is tracked anywhere, and (c) git check-ignore covers build-env/, so recreating the environment cannot re-add it.

RED — on the parent commit, with the 49 files still tracked

$ git ls-files | grep -c '^build-env'
49

$ python -m pytest tests/test_no_tracked_virtualenv.py -q
...
E       AssertionError: virtualenv marker files are tracked in git and must be removed: ['build-env/bin/Activate.ps1', 'build-env/bin/activate', 'build-env/bin/activate.csh', 'build-env/bin/activate.fish', 'build-env/pyvenv.cfg']
...
E       AssertionError: 'build-env/bin/pip' is not ignored by .gitignore, so recreating the developer environment would re-add it to version control. git check-ignore said: ''

=========================== short test summary info ============================
FAILED tests/test_no_tracked_virtualenv.py::test_no_virtualenv_directory_is_tracked
FAILED tests/test_no_tracked_virtualenv.py::test_no_virtualenv_marker_files_are_tracked
FAILED tests/test_no_tracked_virtualenv.py::test_gitignore_excludes_the_build_env_directory
============================== 3 failed in 0.07s ===============================

GREEN — after git rm -r --cached build-env and the .gitignore rule

$ python -m pytest tests/test_no_tracked_virtualenv.py -q
collected 3 items

tests/test_no_tracked_virtualenv.py ...                                  [100%]

============================== 3 passed in 0.06s ===============================

The ignore rule is in force, and the developer's environment is still on disk:

$ git ls-files | grep -c '^build-env'
0

$ ls build-env/bin/pip
build-env/bin/pip

$ git check-ignore -v build-env/bin/pip build-env/pyvenv.cfg
.gitignore:114:build-env/	build-env/bin/pip
.gitignore:114:build-env/	build-env/pyvenv.cfg

4. Packaging proof — sdist and wheel contain no virtualenv files

Built with the 34 MB build-env/ still present on disk, so this exercises the realistic developer case:

$ du -sh build-env
 34M	build-env

$ python -m build
Successfully built oilpriceapi-1.14.0.tar.gz and oilpriceapi-1.14.0-py3-none-any.whl

sdist — 79 entries, no virtualenv artifacts:

$ tar -tzf dist/oilpriceapi-1.14.0.tar.gz | wc -l
79

$ tar -tzf dist/oilpriceapi-1.14.0.tar.gz | grep -Ei 'build-env|pyvenv\.cfg|/activate|/bin/'
NONE FOUND

Wheel — 54 entries, two top-level directories, no virtualenv artifacts:

$ python -c "import zipfile; print(len(zipfile.ZipFile('dist/oilpriceapi-1.14.0-py3-none-any.whl').namelist()))"
54

$ # grep the namelist for build-env|pyvenv.cfg|/activate|bin/
NONE FOUND

$ # top-level entries
oilpriceapi
oilpriceapi-1.14.0.dist-info

Clean install of that wheel into a throwaway venv:

$ python3 -m venv smokevenv
$ ./smokevenv/bin/pip install ./repo/dist/oilpriceapi-1.14.0-py3-none-any.whl
$ ./smokevenv/bin/pip show oilpriceapi | head -4
Name: oilpriceapi
Version: 1.14.0
Summary: Official Python SDK for source-timestamped OilPriceAPI energy data
Home-page: https://oilpriceapi.com

$ ./smokevenv/bin/python -c "import oilpriceapi; from oilpriceapi import OilPriceAPI; ..."
version: 1.14.0
client ok: OilPriceAPI | prices resource: PricesResource

$ ./smokevenv/bin/oilprice --version
CLI requires extra dependencies. Install with:
  pip install oilpriceapi[cli]

$ find ./smokevenv/lib -path '*oilpriceapi*' \( -name 'pyvenv.cfg' -o -name 'activate*' -o -name '*build-env*' \) | wc -l
0

The CLI message is the expected behaviour of the base install: oilprice is declared as an entry point and the rich/typer dependencies live in the [cli] extra. The entry point resolves and runs.

5. Full suite

passed failed skipped
clean main (baseline) 864 3 63
this branch 867 3 63

867 = 864 + 3 — the three new guard assertions. The same three failures appear on both sides: tests/integration/test_demo_contract.py makes live calls to the demo endpoint and is receiving HTTP 429. Environmental, unrelated to this change, unchanged by it.

Diff shape

 .gitignore                          |   3 +
 tests/test_no_tracked_virtualenv.py |  99 +++++++++++++++
 49 build-env/ entries               | 734 ------------------------------
 51 files changed, 102 insertions(+), 734 deletions(-)

Nothing else is touched. No source file, no pyproject.toml dependency declaration, no version bump (stays at 1.14.0), no history rewrite.

Scope and constraints

  • Deletion is from the tip only — no filter-branch, no filter-repo. The blobs remain in history; this PR removes them from the working tree going forward.
  • git rm -r --cached was used, so no developer loses their actual environment.
  • Do not merge until the issue's approval gate is satisfied. Not published to PyPI.

🤖 Generated with Claude Code

https://claude.ai/code/session_015ao5paex73xXvuM424Libo

Closes #106.

49 entries under `build-env/` were tracked in version control: pip/pytest
launchers with a hardcoded absolute interpreter path, the four shell
activation scripts, `pyvenv.cfg`, and a `lib64` symlink. These are
machine-specific environment artifacts, not SDK source.

- `git rm -r --cached build-env` removes them from the index only; a
  developer's actual on-disk environment is untouched.
- `.gitignore` gains `build-env/` plus `pyvenv.cfg` so a recreated
  environment is not re-added.
- `tests/test_no_tracked_virtualenv.py` asserts via `git ls-files` that no
  virtualenv directory or marker file is tracked, and that `build-env/` is
  ignored. All three assertions fail on the parent commit.

No history rewrite. No source, packaging or dependency declaration changed.
Nothing in the repository referenced `build-env` (verified by `git grep`
over all tracked files and a recursive grep over the working tree), and
neither the sdist nor the wheel ever contained these files.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015ao5paex73xXvuM424Libo
@coderabbitai

coderabbitai Bot commented Sep 13, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 3aea1cd3-bb7e-4508-ba35-e82b540a38ab


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@karlwaldman
karlwaldman merged commit fe64010 into main Sep 13, 2026
7 checks passed
@karlwaldman
karlwaldman deleted the chore/untrack-build-env-106 branch September 13, 2026 19:06
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.

[P3][Review] Delete tracked developer virtual-environment launchers

1 participant