-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add uv as package manger for the generated project #5434
base: master
Are you sure you want to change the base?
Conversation
bd785eb
to
6bae8e7
Compare
Ready for testing 🎉 cookiecutter https://github.com/foarsitter/cookiecutter-django --checkout uv-generated-project |
8f3ca43
to
d12c2e7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did a first pass and noted a few things. Haven't reviewed the Dockerfiles yet
Hi, there. I played around with using your fork to update some existing projects and eventually got them working but ended up reverting them to their production (pip) versions so that I could revisit when I had more time. When working on an adapting an existing project, I got an error during the build, which was reproduced when I built a project from scratch using
I believe that it's caused by having the blank |
@steveputman thanks looking into this! During a build you cannot write to the host system. Your interpreter is inside the container together with uv so you can run uv:
Struggled a lot with this and it is not ideal. So hopefully someone has a better solution. |
@foarsitter Your solution is better than mine (I had uv installed on my host system so just ran Thanks for the help! Will let you know if anything else comes up. |
{{cookiecutter.project_slug}}/compose/production/django/Dockerfile
Outdated
Show resolved
Hide resolved
I think you need to run Of course we're also not sharing a virtualenv here, by my read/attempt to use this. It might be possible to just share a mount across all the services, but I'm having trouble getting that to work. |
Great work! This project really need to have a better tool than the plain pip |
The dependabot would need updating too. I dont know if it supports pyproject declarations |
I believe it does, I've found some discussions on the project, here's the link to the issue. |
This has been added now: dependabot/dependabot-core#10478 (comment) |
a git pull away from a merge 😿 |
Tried it. I wonder if the requirements currently in [project.optional-dependencies]
production = [
"gunicorn==23.0.0",
# ...
] Currently they appear in the main project dependencies, so they will be installed in the development virtualenv. They can then be installed by running uv docs about optional dependencies. (And thanks for doing the work - I look forward to it being merged :) ) |
@foobacca I see development as a superset of production. Everything from production needs to be replicated in development but production doesn't need a test framework for example. When the sentry_sdk is added as an extra dependency I cannot use capture_exception for example because the package is missing. Another example is testing the gunicorn command. I cannot do such thing when developing when I do not have the package. |
@foarsitter I see your point (though you can of course install the production dependencies if you want with I don't have a strong preference, but it does seem like a change from the master branch, where there is a separate I'll leave it to the maintainers. If they're happy with the change I have no objection. (And I'm quite capable of changing my project after running cookiecutter anyway 🙂 ) |
One other idea. I would expect the I can obviously edit it myself after running cookiecutter, so not a big deal if others prefer it at the bottom, but thought I'd mention it. |
The production deps are installed locally on the master branch too, so not so much of change - see #4838 for more context |
I agree. Dependencies should be at the top of the file |
We use https://github.com/tox-dev/pyproject-fmt for dictating the order of appearance, so you don't need to worry about it :) |
The project itself now uses
uv
and this is an attempt to bringuv
to the generated project too.uv run
for local development. In Docker the .venv python interpreter is added to the $PATH so packages can be used system wide.uv sync
is executed.pre-commit
that compiles a requirements.txttrap
totest_docker.sh
to cleanup after testing so the next time will no fail due to an existing postgres volume.Before we can merge this we need one last round to update all the versions to the latest ones in the requirement.txt files.