Skip to content

Guard deploy.py behind __main__; test that import has no side effects - #4

Merged
thorwhalen merged 1 commit into
masterfrom
fix/deploy-import-side-effects
Oct 13, 2026
Merged

thorwhalen merged 1 commit into
masterfrom
fix/deploy-import-side-effects

Conversation

@thorwhalen

Copy link
Copy Markdown
Owner

Fixes #3.

deploy.py ran a build and twine upload at module level, so anything that imported it (pytest --doctest-modules from the repo root, a dependents gate) uploaded to PyPI. It now exposes main() behind if __name__ == "__main__": and uses sys.executable. tests/test_deploy_import.py imports the file with subprocess.run/Popen patched and asserts nothing is called.

Adversarial review (fresh Opus subagent): SHIP, no confirmed defects. Noted non-blocking: the test only watches subprocess calls, and grub has no setup.py, so the script cannot work at all (follow-up issue filed).

https://claude.ai/code/session_01BgadceR6ocdAzYbAQpcztz

@thorwhalen
thorwhalen merged commit 9c3e3ae into master Oct 13, 2026
12 checks passed
@thorwhalen
thorwhalen deleted the fix/deploy-import-side-effects branch October 13, 2026 03:55
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.

deploy.py uploads to PyPI on import (pytest collection runs it)

1 participant