An exciting aspect of kicking off a fresh new project is that you get the opportunity to try not just one, but as many new technologies as you wish.
Recently, we embarked on a new Python web project for a client, built on Google Cloud Run Functions (with HTTP triggers) — a new technology for our arsenal. This served as an opportunity to not stop there, but also give a go at uv
, a novel package manager for Python, built by Astral and written in Rust, which brings tremendous performance benefits.
Turned out though that as of this time (January 2025), in order to package and deploy a project to Google Cloud Run Functions the old-school requirements.txt
file with the dependency list is required. This looked like an issue initially, since uv
keeps dependencies as declared by the user in pyproject.toml
, while consulting the automatically generated uv.lock
file, for the complete dependency tree resolved as flat dependencies.
Thankfully, the team behind uv
had already done the work for such use cases. After just a bit of searching, we found out that uv
comes with the built-in uv export --format requirements-txt
command, allowing to export all dependencies of the project in a flat requirements.txt
file. Eventually, all we had to do is:
- Add
requirements.txt
in.gitignore
, to keep the resolved dependency tree checked out only inuv.lock
. - Run
uv export --format requirements-txt --locked > requirements.txt
in our CI/CD, before the deployment command to generate arequirements.txt
file based on the dependency tree inuv.lock
Finally, both uv
and Google Cloud Run Functions are beasts on their own, so we will dedicate at least one blog article to each one of these technologies soon.
Stay tuned with LOGIC
Get notified when an article lands on the LOGIC blog.