Migrate project from Poetry to uv for dependency management#52
Migrate project from Poetry to uv for dependency management#52kodzonko wants to merge 5 commits into
Conversation
Migrate the project from Poetry to uv for dependency management and environment handling. This includes updating the build system, configuration files, and CI/CD workflows. - Replace `pyproject.toml` Poetry configuration with PEP 621 `[project]` and PEP 735 `[dependency-groups]` metadata. - Update `Dockerfile` to use `uv` for installing dependencies. - Update GitHub Actions workflow to use `astral-sh/setup-uv`. - Update documentation (README, MIGRATION_STATUS, UPGRADE_PLAN) to reflect `uv sync` and `uv run` commands. - Update all test scripts, examples, and internal error messages to use `uv` instead of `poetry`. - Switch build backend from `poetry-core` to `hatchling`.
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Migrates the project’s packaging, tooling, and developer docs from Poetry to uv, updating CI/Docker and user-facing instructions accordingly.
Changes:
- Replaced Poetry configuration with PEP 621
[project]metadata, PEP 735 dependency groups, and Hatchling build backend. - Updated Dockerfile and GitHub Actions CI workflow to install/sync/run via
uv. - Updated tests, examples, and docs to reference
uvcommands instead ofpoetry.
Reviewed changes
Copilot reviewed 12 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_session_continuity.py | Updates server-start guidance message to uv run .... |
| tests/test_parameter_mapping.py | Updates docstring and runtime guidance to use uv. |
| tests/test_docker_workspace.sh | Switches docker test invocations from poetry run to uv run. |
| tests/conftest.py | Updates skip reason message to reference uv. |
| src/main.py | Updates run_server docstring and port error hint to uv. |
| pyproject.toml | Migrates from Poetry config to PEP 621 + PEP 735 + Hatchling. |
| examples/session_continuity.py | Updates runtime guidance message to use uv. |
| docs/UPGRADE_PLAN.md | Updates migration commands from Poetry to uv. |
| docs/MIGRATION_STATUS.md | Updates migration status instructions to uv. |
| README.md | Updates install/run/testing instructions from Poetry to uv; adjusts formatting. |
| Dockerfile | Replaces Poetry install with pinned uv binaries and uv sync; uses uv run CMD. |
| .github/workflows/ci.yml | Replaces Poetry-based CI steps with uv install/sync/run. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| | Variable | Description | Default | | ||
| | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------- | | ||
| | `PORT` | Server port | `8000` | | ||
| | `MAX_TIMEOUT` | Request timeout (seconds) | `300` | |
Remove the explicit `uv python install` step from the CI workflow as `uv sync` handles the Python version requirement automatically when using the `--python` flag.
Pin the `uv` version to `0.11.19` in both the GitHub Actions workflow and the Dockerfile to ensure consistent lockfile resolution and identical environments between CI and container builds.
Update documentation, examples, and test instructions to use the new `claude-wrapper` entry point instead of direct python module invocation. This aligns the project with the recent migration from Poetry to `uv` and standardizes the CLI usage pattern.
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v5 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
|
|
||
| - name: Install Poetry | ||
| uses: snok/install-poetry@v1 | ||
| with: | ||
| virtualenvs-create: true | ||
| virtualenvs-in-project: true | ||
|
|
||
| - name: Load cached venv | ||
| id: cached-poetry-dependencies | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: .venv | ||
| key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} | ||
| # Keep in sync with the uv version pinned in the Dockerfile so lockfile | ||
| # resolution behaves identically in CI and Docker builds. | ||
| version: "0.11.19" | ||
| enable-cache: true | ||
|
|
||
| - name: Install dependencies | ||
| if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
| run: poetry install --no-interaction --no-root | ||
|
|
||
| - name: Install project | ||
| run: poetry install --no-interaction | ||
| run: uv sync --locked --python ${{ matrix.python-version }} |
There was a problem hiding this comment.
uv sync pulls required python version on its own. Doesn't need to be available on the host.
|
|
||
| # Run the app with Uvicorn (development mode with reload; switch to --no-reload for prod) | ||
| CMD ["poetry", "run", "uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"] No newline at end of file | ||
| CMD ["uv", "run", "uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"] |
There was a problem hiding this comment.
This was the original code so I'm not changing this
There was a problem hiding this comment.
I think this suggestion is beneficial, see here
|
@RichardAtCT are you open to contributions to this repo? |
Similar to what PR #9 offered but I believe that one was abandoned (no changes in response to author's code review in several months)
Migrate the project from Poetry to uv for dependency management and environment handling. This includes updating the build system, configuration files, and CI/CD workflows.
pyproject.tomlPoetry configuration with PEP 621[project]and PEP 735[dependency-groups]metadata.Dockerfileto useuvfor installing dependencies.astral-sh/setup-uv.uv syncanduv runcommands.uvinstead ofpoetry.poetry-coretohatchling.