plane icon indicating copy to clipboard operation
plane copied to clipboard

Use UV to manage python dependencies

Open icovada opened this issue 1 week ago โ€ข 2 comments

Description

This PR adds uv as package manager for the api Python app. Dockerfile has been refactored to be multi-stage as well as producing "production", "dev" and "test" images

Type of Change

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] Feature (non-breaking change which adds functionality)
  • [X] Improvement (change that would cause existing functionality to not work as expected)
  • [ ] Code refactoring
  • [ ] Performance improvements
  • [ ] Documentation update

Screenshots and Media (if applicable)

Test Scenarios

Built application, verified it's running

References


[!NOTE] Switch API to uv-managed pyproject and multi-stage Dockerfile, update CI to use new Dockerfile, and remove legacy requirements/Dockerfiles.

  • Backend/API:
    • Replace legacy Dockerfile.api/Dockerfile.dev with a multi-stage apps/api/Dockerfile leveraging uv and dependency caching; add apps/api/.dockerignore.
    • Move dependencies to apps/api/pyproject.toml (runtime + local/test groups); remove requirements* files.
  • CI:
    • Update .github/workflows/build-branch.yml to build API using apps/api/Dockerfile.

Written by Cursor Bugbot for commit 4e0316f69c7946931640597d3f10d0bf8cc5b2ac. This will update automatically on new commits. Configure here.

Summary by CodeRabbit

  • Chores
    • Consolidated container build into a single multi-stage image for dev, test, and production and added ignore patterns to slim build contexts.
    • Removed legacy container variants and cleared legacy dependency manifests, simplifying dependency management.
    • Updated project metadata and bumped version to v1.21.1.
    • CI and deployment build pipelines updated to use the new container build layout.

โœ๏ธ Tip: You can customize this high-level summary in your review settings.

icovada avatar Dec 19 '25 17:12 icovada

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Dec 19 '25 17:12 CLAassistant

[!NOTE]

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Consolidates API Docker build into a single multi-stage apps/api/Dockerfile, removes legacy API Dockerfiles and several requirements manifests, adds apps/api/.dockerignore, updates pyproject.toml, and updates CI/deploy/docker-compose references from Dockerfile.api to Dockerfile.

Changes

Cohort / File(s) Change Summary
Unified API Dockerfile
apps/api/Dockerfile, apps/api/Dockerfile.api, apps/api/Dockerfile.dev
Added a new multi-stage apps/api/Dockerfile (builder/dev/test/prod stages); deleted apps/api/Dockerfile.api and apps/api/Dockerfile.dev.
Docker context ignore
apps/api/.dockerignore
Added .dockerignore entries: venv/, .venv/, and Dockerfile.
Dependency manifest migration
apps/api/pyproject.toml, apps/api/requirements.txt, apps/api/requirements/*
Updated pyproject.toml (project name/version/description, requires-python, expanded dependencies, added [dependency-groups]); emptied or removed apps/api/requirements.txt and files under apps/api/requirements/ (base.txt, local.txt, production.txt, test.txt).
CI & deployment references
.github/workflows/build-branch.yml, deployments/cli/community/build.yml, docker-compose.yml
Replaced Dockerfile paths for API builds from Dockerfile.api to Dockerfile; build contexts unchanged.

Estimated code review effort

๐ŸŽฏ 4 (Complex) | โฑ๏ธ ~45 minutes

  • Inspect apps/api/Dockerfile multi-stage COPY/WORKDIR/USER steps and file ownership/permissions.
  • Verify ./bin/docker-entrypoint-api.sh and any referenced scripts are present and executable.
  • Ensure dependencies moved into pyproject.toml cover required runtime and dev/test tooling previously in requirements files.
  • Confirm .dockerignore does not exclude files the new Dockerfile needs (notably Dockerfile is ignored).
  • Check CI and docker-compose changes for any remaining references to deleted Dockerfile variants.

Poem

๐Ÿ‡ I hopped through layers, merged stages with delight,

Old Dockerfiles tucked away, a single one in sight,
Toml pages updated, dependencies in line,
CI points to the new path and builds hum just fine,
A little rabbit cheers โ€” containers take flight!

Pre-merge checks and finishing touches

โœ… Passed checks (3 passed)
Check name Status Explanation
Title check โœ… Passed The title 'Use UV to manage python dependencies' clearly and concisely summarizes the primary change: migrating to uv as the Python package manager for the API.
Description check โœ… Passed The description covers the main changes (uv adoption, multi-stage Dockerfile, dependency consolidation), includes the required Type of Change selection, provides test verification, and adds supplementary context via cursor summary.
Docstring Coverage โœ… Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
โœจ Finishing touches
๐Ÿงช Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

๐Ÿ“œ Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between a8071acdc92913ff734ed8ab9665f6027706a0fb and 4e0316f69c7946931640597d3f10d0bf8cc5b2ac.

๐Ÿ“’ Files selected for processing (1)
  • apps/api/Dockerfile
๐Ÿงฐ Additional context used
๐Ÿง  Learnings (1)
๐Ÿ“š Learning: 2025-11-25T10:17:39.709Z
Learnt from: CR
Repo: makeplane/plane PR: 0
File: .github/instructions/bash.instructions.md:0-0
Timestamp: 2025-11-25T10:17:39.709Z
Learning: Applies to docker-compose.yml : Use docker-compose.yml for production and staging Docker configuration

Applied to files:

  • apps/api/Dockerfile
โฐ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Cursor Bugbot
๐Ÿ”‡ Additional comments (3)
apps/api/Dockerfile (3)

1-43: Excellent multi-stage build structure!

The builder-with-tools stage is well-designed:

  • uv version is pinned for reproducibility
  • System dependencies are properly separated into build-time and runtime packages
  • Cache mounts optimize dependency installation
  • PYTHONUNBUFFERED is correctly set for container logging
  • Layer ordering (dependencies before project copy) maximizes cache efficiency

Previous concerns about missing runtime libraries (libpq, libxslt, xmlsec), bash, and PATH configuration have all been addressed.


45-61: Dev, test, and builder stages are correctly structured.

The stage inheritance is optimal:

  • dev and test inherit from builder-with-tools (retaining build dependencies for compiling packages with native extensions)
  • builder removes build dependencies after inheriting from builder-with-tools
  • This ensures dev/test can compile packages while keeping production lean

64-70: Entrypoint script already uses production-ready server.

The ./bin/docker-entrypoint-api.sh already executes gunicorn with uvicorn workers for async ASGI support (line 38), not Django's development server. The configuration includes proper worker settings, request limits, and access logging, making it production-ready.

Likely an incorrect or invalid review comment.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

โค๏ธ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Dec 19 '25 17:12 coderabbitai[bot]