Skip to content

Feat/consistent python version#228

Merged
fsargent merged 3 commits intomainfrom
feat/consistent-python-version
Jun 3, 2025
Merged

Feat/consistent python version#228
fsargent merged 3 commits intomainfrom
feat/consistent-python-version

Conversation

@fsargent
Copy link
Contributor

@fsargent fsargent commented Jun 3, 2025

Summary by Sourcery

Standardize Python version to 3.13 across the project and replace Poetry with hatchling for building and UV for dependency management, updating Docker, CI workflows, and documentation accordingly.

Enhancements:

  • Enforce Python >=3.13.1 in project metadata
  • Unify dependency management using UV across development, CI, and Docker

Build:

  • Migrate project metadata from Poetry to PEP 621 [project] and switch build-backend to hatchling with a wheel target

CI:

  • Update GitHub Actions to install UV instead of Poetry, use pip caching, and run tests via UV-installed dependencies

Deployment:

  • Use Python 3.13.2 base image in Dockerfile and install dependencies with UV instead of Poetry

Documentation:

  • Revise README to use pyenv 3.13.2 and UV for virtual environment and dependency setup

Chores:

  • Remove Poetry lockfile and .python-version file, add requirements.lock and VSCode settings

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jun 3, 2025

Reviewer's Guide

Switched from Poetry to PEP 621-standard project config and Hatchling for builds, standardized Python 3.13 across configs, Docker, CI, and replaced Poetry with UV for dependency management throughout the codebase.

File-Level Changes

Change Details Files
Migrated project configuration from Poetry to PEP 621 and Hatchling
  • Replaced [tool.poetry] with [project] metadata
  • Converted dependencies block to PEP 621 'dependencies' array
  • Updated build-system to use Hatchling backend
  • Added tool.hatch wheel target configuration
pyproject.toml
Replaced Poetry with UV for dependency management
  • Removed Poetry install, config, and invocation
  • Installed uv in Dockerfile and GitHub workflow
  • Replaced poetry install commands with uv pip install
Dockerfile
.github/workflows/django.yml
Standardized Python version to 3.13.x
  • Set requires-python >=3.13.1 in pyproject.toml
  • Updated Docker base image to python:3.13.2
  • Bumped .python-version to 3.13.2
  • Adjusted README instructions for pyenv and uv
pyproject.toml
Dockerfile
.python-version
README.md
Updated CI workflow steps
  • Installed uv instead of Poetry via pipx
  • Switched caching from Poetry to pip
  • Replaced poetry run commands with direct python/manage commands
.github/workflows/django.yml
Cleaned up lock files and added IDE settings
  • Removed poetry.lock
  • Added requirements.lock
  • Introduced .vscode/settings.json
poetry.lock
requirements.lock
.vscode/settings.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 3, 2025

Walkthrough

The changes update the project's Python version from 3.11.7 (and 3.14.0a4 in Docker) to 3.13.2 across all configuration files. The dependency management tool is switched from Poetry to UV, with corresponding updates to the Dockerfile and development setup instructions in the README.

Changes

File(s) Summary
.python-version, README.md Updated Python version from 3.11.7 to 3.13.2; updated dev setup instructions to use UV.
Dockerfile Changed base image to Python 3.13.2; replaced Poetry with UV for dependency management.

Poem

A hop from Poetry to UV,
With Python thirteen point two,
Our Docker’s lighter, setup’s new—
The README’s clear, the path in view.
Now bunnies code with extra cheer,
For modern tools are finally here!
🐇✨


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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@trunk-io
Copy link

trunk-io bot commented Jun 3, 2025

Running Code Quality on PRs by uploading data to Trunk will soon be removed. You can still run checks on your PRs using trunk-action - see the migration guide for more information.

@fsargent fsargent merged commit a674a30 into main Jun 3, 2025
1 of 3 checks passed
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
README.md (1)

38-41: Clarify UV usage vs Docker’s --system flag
You’ve replaced Poetry with uv venv, activation, and uv pip install -e .. It may help to briefly explain why the -e (editable) flag is used here, and note how this differs from the Dockerfile’s --system usage.

Dockerfile (2)

13-13: Pin UV version for reproducibility
Installing UV without a version specifier could lead to unexpected upgrades. Consider pinning it, e.g.:

RUN pip install uv==<stable-version> --no-cache-dir

15-19: Optimize Docker layer caching
Copying the entire project before installing dependencies invalidates the cache on any code change. To speed up rebuilds, you can:

  1. Copy only pyproject.toml (and a lock file, if used).
  2. Install UV and project dependencies.
  3. Copy the rest of the source code.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ffe55cf and bee1ef3.

⛔ Files ignored due to path filters (5)
  • .github/workflows/django.yml is excluded by !**/*.yml
  • .vscode/settings.json is excluded by !**/*.json
  • poetry.lock is excluded by !**/*.lock, !**/*.lock
  • pyproject.toml is excluded by !**/*.toml
  • requirements.lock is excluded by !**/*.lock, !**/*.lock
📒 Files selected for processing (3)
  • .python-version (1 hunks)
  • Dockerfile (2 hunks)
  • README.md (1 hunks)
🔇 Additional comments (5)
.python-version (1)

1-1: Confirm Python version alignment
The bump to 3.13.2 in .python-version now matches the Docker base image and README instructions, ensuring consistency across local and container environments.

README.md (2)

34-36: Update Python version in local setup instructions
The steps now correctly reference Python 3.13.2 (pyenv install 3.13.2 and pyenv local 3.13.2), replacing the previous 3.11.7.


34-34: Validate Homebrew formula for uv
Ensure that brew install uv is a valid command on macOS. If Homebrew doesn’t offer a uv formula, consider switching to pip install uv or documenting an alternative installation path.

Dockerfile (2)

1-1: Bump base image to Python 3.13.2
Updating the FROM line to python:3.13.2 aligns the container runtime with your .python-version and README.


19-19: Confirm editable install in production image
The command uv pip install --system -e . installs in editable mode. Please verify if this is intended for production, as editable installs can affect performance and are typically reserved for development.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @fsargent - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 3 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

django-import-export = { extras = ["all"], version = "^4.3.4" }
requires-python = ">=3.13.1"
dependencies = [
"django~=5.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: ~=5.0.0 restricts Django to 5.0.x only

If you want to support all 5.x versions, use ~=5.0 or >=5.0,<6.0 instead.

Suggested change
"django~=5.0.0",
"django~=5.0",

ENV POETRY_VERSION=1.8.4
RUN pip install "poetry==$POETRY_VERSION" --no-cache-dir
# Install UV for dependency management
RUN pip install uv --no-cache-dir
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Pin UV version for reproducibility

Pin UV to a specific version using an ENV UV_VERSION to avoid unexpected breaking changes from future releases.

Comment on lines +15 to +19
# Copy all project files into the working directory
COPY . /code/

# Install dependencies using UV with --system flag
RUN uv pip install --system -e .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (performance): Leverage Docker cache by copying deps separately

Copy only dependency files (e.g., pyproject.toml, requirements.lock) before installing dependencies, then copy the rest of the project to maximize Docker cache efficiency.

Suggested change
# Copy all project files into the working directory
COPY . /code/
# Install dependencies using UV with --system flag
RUN uv pip install --system -e .
# Copy only dependency files first to leverage Docker cache
COPY pyproject.toml requirements.lock* /code/
# Install dependencies using UV with --system flag
RUN uv pip install --system -e .
# Copy the rest of the project files into the working directory
COPY . /code/

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