Skip to content

Add ensure_venv/2,3 for automatic venv creation and activation#13

Merged
benoitc merged 6 commits intomainfrom
feature/ensure-venv
Mar 8, 2026
Merged

Add ensure_venv/2,3 for automatic venv creation and activation#13
benoitc merged 6 commits intomainfrom
feature/ensure-venv

Conversation

@benoitc
Copy link
Owner

@benoitc benoitc commented Mar 7, 2026

Summary

  • Add ensure_venv/2,3 to create venv if needed, install dependencies, and activate
  • Support both requirements.txt and pyproject.toml formats
  • Auto-detect uv or pip as installer
  • Options: extras, installer, python, force
  • Fix activate_venv to auto-detect site-packages directory (handles venv created with different Python version)
  • Add py_venv_SUITE with 7 tests

benoitc added 6 commits March 7, 2026 18:38
- ensure_venv(Path, RequirementsFile) creates venv if needed
- Supports requirements.txt and pyproject.toml formats
- Auto-detects uv or pip as installer
- Options: extras, installer, python, force
- Updated activate_venv to auto-detect site-packages directory
  (handles venv created with different Python version)
- Added py_venv_SUITE with 7 tests
- sys.executable returns beam.smp when embedded
- Use sys.prefix to find actual Python binary
- Search for pythonX.Y, python3, python in prefix/bin
Avoid exec/eval pair that can fail in some environments.
Use a single eval with lambda expression instead.
@benoitc benoitc merged commit d5bd222 into main Mar 8, 2026
11 checks passed
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