Implement Python environment management during install#140
Implement Python environment management during install#140Copilot wants to merge 4 commits intofeat/deepwork-public-python-via-uvfrom
Conversation
- Created PythonEnvironment class for managing virtual environments - Added support for uv, system Python, and skip options - Added --python-manager CLI flag to install command - Implemented interactive prompt for Python setup - Added detection of existing virtual environments - Updated config.yml schema to include python section - Added comprehensive unit and integration tests - Updated existing tests to work with new Python manager option Co-authored-by: ncrmro <8276365+ncrmro@users.noreply.github.com>
|
@copilot this should actually create the .venv and ensure its gitignored (and that uv works and is availalbe) |
- Created _ensure_venv_in_gitignore() function to manage project .gitignore - Automatically creates or updates .gitignore to include .venv when venv is created - Handles existing .gitignore files gracefully by appending - Prevents duplication if .venv already exists in .gitignore - Added 3 new integration tests to verify gitignore handling - All 40 integration tests pass - All 14 unit tests for python_env pass Co-authored-by: ncrmro <8276365+ncrmro@users.noreply.github.com>
Done in e00aa43. The implementation now:
Added 3 new integration tests to verify the gitignore behavior. All 40 integration tests pass. |
|
@copilot this is also needs to run |
- Modified _setup_with_uv() to run uv init --no-workspace before creating venv - Only runs uv init if pyproject.toml doesn't already exist - Preserves existing pyproject.toml files without modification - Updated unit test to verify uv init is called appropriately - Added new unit test for when pyproject.toml already exists - Added 2 new integration tests to verify pyproject.toml handling - All 15 unit tests pass - All 42 integration tests pass Co-authored-by: ncrmro <8276365+ncrmro@users.noreply.github.com>
Done in 4130a98. The implementation now runs Key behaviors:
Added 3 new tests (1 unit + 2 integration) to verify pyproject.toml handling. All 42 integration tests and 15 unit tests pass. |
Implements automated Python environment setup during
deepwork installas specified in PLAN.md. Users can now choose between uv, system Python, or skip environment creation, with configuration persisted in.deepwork/config.yml.Changes
Core Infrastructure
src/deepwork/utils/python_env.py: NewPythonEnvironmentclass managing venv creation, package installation, and existing environment detectionuv(recommended),system(uses python3 from PATH),skip(manual management)CLI Integration
src/deepwork/cli/install.py: Added--python-manageroption and interactive prompt.venv,venv,.virtualenv).deepwork/config.ymlwith backward compatibility.gitignoremanagement: Creates or updates project's.gitignoreto include.venvwhen virtual environment is created.gitignorefiles by appending.venvalready presentpyproject.tomlcreation: Runsuv init --no-workspacewhen using uv manager to create Python project structurepyproject.tomlif it doesn't already existpyproject.tomlfiles without modificationConfig Schema Extension
Usage
Existing projects without the
pythonconfig section continue to work unchanged.💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.