Requirements.txt or uv.lock?

I have a very simple Python project which uses uv as the dependency manager. When I add packages to the project pyproject.toml and uv.lock are updated.

I can then create a requirements.txt file by running:

uv pip compile pyproject.toml -o requirements.txt

which only requires pyproject.toml to be present. So given that can I leave uv.lock and requirements.txt out of the repository or should my repository contain all three files?

The requirements.txt can be generated by the end user using a one line script.

pyproject.toml is the standard location for your project metadata including dependencies. You do not need requirements.txt. uv.lock should be committed to your version control. The uv docs explain this better than I can, so I’ll encourage you to give it a read: Structure and files | uv

2 Likes

Thank you very much.

That was very handy.

1 Like