cookiecutter / cookiecutter-django

Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly.
https://cookiecutter-django.readthedocs.io
BSD 3-Clause "New" or "Revised" License
12.14k stars 2.91k forks source link

Use Astral's uv for pip installation in Docker + CI #4915

Open Andrew-Chen-Wang opened 8 months ago

Andrew-Chen-Wang commented 8 months ago

Description

Use uv to pip install requirements in Docker and CI

Rationale

Haven't seen something resolve and install as quickly as uv before. At my firm, we saw 80% performance gains replacing poetry. For cookiecutter-django, uv pip install -r requirements/local.txt installed in ~2 seconds.

luzfcb commented 8 months ago

Is uv marked as stable?

Andrew-Chen-Wang commented 8 months ago

Still marked in beta, but cookiecutter-django doesn't use any advanced features like local package URLs. It's fairly stable from the resolution (like poetry resolution) and pip installation of packages. Haven't noticed any packages any issues. Also, I ran the packages here and didn't have any problems installing local packages.

foarsitter commented 8 months ago

We need an abstraction layer for the packagemanager. I did some experimenting with a custom extension. This way we can implement poetry and uv alongside pip.

jobs:
  include:
    - name: "Linter"
      before_script:
        - {{ "ruff"|install(cookiecutter)}}

What do you think?

Andrew-Chen-Wang commented 8 months ago

Sounds right. I can help make the abstraction since I think uv compiling a lock file will be useful like poetry lock. I do think that the lock file would have to generated as a post gen hook

But if you mean abstracting as custom Python scripts, I'd disagree. I think we'd want to let users use the package managing tools' CLI directly