It’s been fun to see all the uv examples lately on this sub, so thought I’d share another one.
For those who aren’t familiar, uv is a fast, easy to use package manager for Python. But it’s a lot more than a pip replacement. Because uv can interpret PEP 723 metadata, it behaves kind of like npm, where you have self-contained, runnable scripts. This combines nicely with Coiled, a UX-focused cloud compute platform. You can declare script-specific dependencies with uv add –script and specify runtime config with inline # COILED comments.
Your script might end up looking something like:
# COILED container ghcr.io/astral-sh/uv:debian-slim # COILED region us-east-2 # /// script # requires-python = « >=3.12 » # dependencies = [ # « pandas », # « pyarrow », # « s3fs », # ] # ///
And you can run that script on the cloud with:
uvx coiled batch run uv run my-script.py
Compare that to something like AWS Lambda or AWS Batch, where you’d typically need to:
Package your script and dependencies into a ZIP file or build a Docker image Configure IAM roles, triggers, and permissions Handle versioning, logging, or hardware constraints
Here’s the full video walkthrough: https://www.youtube.com/watch?v=0qeH132K4Go
submitted by /u/dask-jeeves to r/Python
[link] [comments]
Laisser un commentaire