Skip to content

Conversation

Twixes
Copy link
Member

@Twixes Twixes commented Mar 30, 2025

Problem

requirements.txt is the barbarian's way of managing dependencies – no locking, no clear way to handle dev dependencies, while pyproject.toml is the modern (and PEP-approved) format for dependencies.

Its simplest to use with uv. The uv sync command does it all:

  1. If a virtual environment is missing, it creates it under .venv/, even installing the right version of Python if it's specified with --python.
  2. Resolves all dependency versions and updates the uv.lock lockfile if anything has changed.
  3. Installs (and upgrades/downgrades) installed dependencies based on the lockfile. In production, you skip dev dependencies using --no-dev.

Changes

Moved all the deps into pyproject.toml. requirements{,-dev}.{txt,in} are no more.
Moved to uv sync across: Dockerfiles, Actions workflows, Flox activation. pip install is no more.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Overall, this PR transitions dependency management from the legacy requirements.txt system to a modern, lockfile-based approach using pyproject.toml and uv sync across development, CI, and Docker environments.

  • Updated .devcontainer/Dockerfile and Dockerfile to install uv and run "uv sync" with proper flags.
  • Modified multiple GitHub workflows (e.g., .github/workflows/ci-backend.yml, benchmark.yml, and ci-turbo.yml) to use "uv sync --frozen" and highlighted potential caching issues.
  • Adjusted dependency guidelines in .cursor/rules/django-python.mdc to recommend "uv sync" and "uv add PACKAGE".
  • Removed legacy dependency files (requirements.txt, requirements.in, requirements-dev.txt).

23 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile

Copy link
Contributor

github-actions bot commented Mar 30, 2025

Size Change: +6 B (0%)

Total Size: 9.96 MB

ℹ️ View Unchanged
Filename Size Change
frontend/dist/toolbar.js 9.96 MB +6 B (0%)

compressed-size-action

@Twixes Twixes force-pushed the move-to-uv branch 2 times, most recently from b3d30fb to 05e3198 Compare March 31, 2025 10:46
Copy link
Collaborator

@mariusandra mariusandra left a comment

Choose a reason for hiding this comment

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

If you get this working and passing tests, then you have my blessing

@@ -30,8 +30,6 @@ jobs:
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4
with:
python-version: '3.8'
Copy link
Member

Choose a reason for hiding this comment

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

shall we increase this?
i guess you could argue not to change too much until we get it working but 3.8 🤯

Copy link
Member Author

Choose a reason for hiding this comment

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

Here the version actually doesn't matter, because it's just for running the HobbyTester Python script, and the actual deployment all happens in a remote DigitalOcean droplet

Copy link
Member

@pauldambra pauldambra left a comment

Choose a reason for hiding this comment

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

well, i will be happy to stop looking up the pip compile command every time i need it 😅 🚀

once CI is green we should smash this in

@Twixes
Copy link
Member Author

Twixes commented Mar 31, 2025

The two test failures are expected:

  1. Validate Django and CH migrations - this first installs PostHog as it is on master, now using uv sync, but master doesn't have a uv.lock yet. A chicken and egg problem that goes away with merging this
  2. Setup DO Hobby Instance and test - this hasn't been passing for a while due to unrelated issue in the hobby deploy (internal Slack thread)

@Twixes Twixes changed the title chore(dev): Move from requirements.txt to pyproject.toml chore(dev): Move from pip compile/install to uv sync Mar 31, 2025
@Twixes Twixes merged commit eb8b837 into master Mar 31, 2025
101 of 103 checks passed
@Twixes Twixes deleted the move-to-uv branch March 31, 2025 12:43
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.

3 participants