Skip to content

Add --use-uv flag for faster venv creation using uv#409

Open
budaesandrei wants to merge 1 commit intoaws:mainfrom
budaesandrei:feature/use-uv-for-venv-creation
Open

Add --use-uv flag for faster venv creation using uv#409
budaesandrei wants to merge 1 commit intoaws:mainfrom
budaesandrei:feature/use-uv-for-venv-creation

Conversation

@budaesandrei
Copy link
Copy Markdown
Contributor

Summary

Adds an opt-in --use-uv flag to create_venvs.py that uses uv instead of the stdlib venv + pip for significantly faster virtual environment creation and package installation.

Changes

  • Added is_uv_available() helper to check if uv is on PATH.
  • Added uv_install() function that uses uv pip install --python <venv_python> for package installation.
  • Updated create_venv() to accept a use_uv parameter:
    • When True: uses uv venv for venv creation and uv pip install for all packages, skipping the pip upgrade step (not needed with uv).
    • When False (default): behavior is completely unchanged.
  • Added --use-uv argparse flag with a clear error message if uv is not installed.
  • Updated README with usage example.

Compatibility

  • CI workflows are unaffected — they call create_venvs.py --target production without --use-uv.
  • uv venv produces a standard venv structure (bin/activate, bin/python) so all downstream consumers (quality checks, linting, unit tests, build scripts, VS Code settings) work identically.
  • Requirements files use standard PEP 508 syntax fully supported by uv.
  • The flag is purely opt-in — no existing behavior changes without it.

Testing

Verified the following scenarios:

  • --use-uv with uv installed — creates venv with uv venv, installs packages with uv pip install
  • Without --use-uv — identical behavior to before
  • --use-uv without uv installed — exits with clear error message
  • --use-uv with --recreate — properly deletes and recreates venv using uv
  • --help — new flag appears in usage output

Added opt-in --use-uv flag to create_venvs.py that uses uv for venv creation and package installation instead of the stdlib venv + pip. When the flag is not provided, behavior is unchanged. Updated README with usage example.
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