Use best-practice pyproject.toml, and uv for managing dependencies#124
Conversation
|
Separate comment for discussion... |
There was a problem hiding this comment.
Pull request overview
This PR migrates the repo’s Python dependency management from requirements*.txt files to a pyproject.toml + uv workflow, and updates the Docker-based dev environment accordingly.
Changes:
- Add
pyproject.tomland a committeduv.lock; removerequirements*.in/requirements*.txt. - Update Docker Compose + entrypoint to use the
ghcr.io/astral-sh/uvimage and runuv sync/uv run. - Add a
.dockerignore(primarily to exclude local Python artifacts like.venv).
Reviewed changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| uv.lock | Adds the uv lockfile to enable reproducible installs. |
| requirements.txt | Removed in favor of pyproject.toml/uv.lock. |
| requirements.in | Removed in favor of pyproject.toml/uv.lock. |
| requirements-dev.txt | Removed in favor of pyproject.toml/uv.lock. |
| requirements-dev.in | Removed in favor of pyproject.toml/uv.lock. |
| pyproject.toml | Defines project metadata and direct dependencies for uv to manage. |
| docker-entrypoint.sh | Switches container bootstrap from pip install -r requirements.txt to uv sync. |
| docker-compose.yml | Switches base image/cache volume and runs MkDocs via uv run. |
| .dockerignore | Ignores .venv/__pycache__/.git* when building images. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| image: ghcr.io/astral-sh/uv:python3.14-trixie-slim | ||
| working_dir: /app | ||
| entrypoint: /app/docker-entrypoint.sh | ||
| command: uv run -- mkdocs serve -a 0.0.0.0:8000 --watch-theme --livereload |
There was a problem hiding this comment.
I'd like to do this in a separate PR. @mrbiggred comments?
There was a problem hiding this comment.
@normanlorrain was this addressed in PR #128 which installs all the dependencies in the requirements file and not just mkdocs?
You are correct @normanlorrain. The following command will run a shell in the Docker container: I like adding the |
mrbiggred
left a comment
There was a problem hiding this comment.
@normanlorrain thanks upgrading from pip to uv and for adding the .dockerignore file, I always forget to create one.
I kicked off a Copilot review and will let you respond to Copilot's feedback as needed. I also added some of my own thoughts.
mrbiggred
left a comment
There was a problem hiding this comment.
I put a comment in conversation about CI still using pip.
https://github.com/weeklydevchat/weeklydevchat.github.io/pull/124/changes#r3304918902
Did PR #128 help with this issue? In either case I'm happy to merge this as is and make any CI changes in another PR if needed.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
4c6ea8e to
7244caa
Compare
Python has evolved over the years, with respect to package management. The
requirements.txtfile nas now been replaced bypyproject.toml. Also,pipis losing favour to theuvtool.I'm trying to stay with best practices, so this PR makes the changes.
The docker command is the same:
docker compose up app. The docker base image changed to include the uv tool.Done with the assistance of Grok AI.
Tested on Linux Mint.