I used to think "portable CLI with dependencies" == Go binary. Turns out Python + uv now gives me a clean "single-file script that just runs" workflow. The trick: • Put deps inside the script (PEP inline metadata) • Add a shebang that calls uv • Optional: lock it for reproducibility Execute directly. uv creates the environment dynamically. Where this shines for me: AI agent tooling 🔧 I needed a Todoist API client for task automation. Instead of hunting for the perfect CLI, I had Claude generate a Python script with embedded dependencies. It tested everything autonomously - I didn't run a single command. Now it lives as a standalone executable next to my SKILL.md file. Small, self-contained, no project bootstrapping. I refused to use Python for small things because it always felt like "create a project + venv first." This finally makes it feel lightweight. Are you using uv scripts already? Any other Python QoL upgrades you've adopted? #Python #DevOps #uv #DeveloperExperience #Automation
Creating single executable is a feature of many runtimes, not specifically tied to a single language. Node.js has it too, and what you describe is essentially how cx_Freeze worked for Python since many years.
Go binaries are fully self-contained: you build once, and they run anywhere without downloading anything. Python + uv is nice for quick scripts, but it needs internet the first time to get dependencies. In a secure, offline environment like a bank, that kind of script would just not work. Go wins there.
I like the idea of specifying dependencies right in the script. Might be especially useful for a collection of small scripts. Looks very similar in nix, but not every Python package is available, so uv might save some headache.
Thank you for sharing this, I was not aware of uv and I also normally use virtualenvs.
Cool! Share some GitHub repo where you use this as Agent Skills 👀
fun is, nix can do that and bind not only python packages, but packages for whatever you want, including C libs, ruby, golang and any other resources, similar way.
uv seems very nice, for speed. Tried it a bit, with now this post, will start taking it seriously. Using pip mostly, and very fascinated with the capability of being able to distribute Pygame projects with a pyinstaller. I am in the early days. Still the external artefacts need to be as files, in same folder, but might be able to cabinetize them or something..
Thank you for sharing, Maciej Gajewski! It can solve many dependency problems with Python standalone scripts.
- uv scripts guide: https://docs.astral.sh/uv/guides/scripts/ - inline script metadata spec: https://packaging.python.org/en/latest/specifications/inline-script-metadata/