Article will go live on April 2, 2025 08:00 UTC.
Excited about this one!
Article will go live on April 2, 2025 08:00 UTC.
Excited about this one!
- https://thisdavej.com/share-python-scripts-like-a-pro-uv-and-pep-723-for-easy-deployment/
Sharing single-file Python scripts with external dependencies is now easy thanks to uv and PEP 723, which enable embedding dependency metadata directly within scripts. This approach eliminates the need for complex setup tools like requirements.txt or package managers, making script distribution and execution seamless and simplifying deployment while maintaining flexibility and efficiency.
I'm in love with uv. Seriously, the tool is small yet packs a punch with features.
I'm writing an article for Fedora Magazine about the cool things you can do with uv, here is the source code (with the article in markdown) for your enjoyment:
https://github.com/josevnz/tutorials/tree/main/docs/Enhancing_Your_Python_Workflow_with_UV_on_Fedora
Exploring UV: self-contained Python scripts made easy
https://hleb.dev/post/exploring-uv/
"Share Python Scripts Like a Pro: uv and PEP 723 for Easy Deployment"
https://thisdavej.com/share-python-scripts-like-a-pro-uv-and-pep-723-for-easy-deployment/
Single file #python scripts with inline dependency meta data - #uv ftw
https://thisdavej.com/share-python-scripts-like-a-pro-uv-and-pep-723-for-easy-deployment/
Using uv and PEP 723 for Self-Contained Python Scripts
https://thisdavej.com/share-python-scripts-like-a-pro-uv-and-pep-723-for-easy-deployment/
#QR codes mit #Python und #uv generieren:
uvx --from qrcode --with pillow qr "https://example.com/?utm_source=print&utm_medium=flyer&utm_campaign=qr-march25" > example-qr-print-flyer-march25.png
Pythonの開発用適当ツールの作成・実行はuvを使うのがオススメ
https://qiita.com/ssc-ksaitou/items/9da75058489ebe8c2009?utm_campaign=popular_items&utm_medium=feed&utm_source=popular_items
Porównajmy backendy #PEP517 dla paczek napisanych w samym Pythonie:
#flit-core: 51 KiB archiwum źródłowe, bez zależności, instaluje się 0,05 s, ~150 KiB po zainstalowaniu, działa wszedzie
#UvBuild: 300 KiB archiwum, wymaga ~250 zależności crate (54 MiB pobierania, ~600 MiB w .cargo), buduje się 1 min 20 s (na 12-wątkowym procesorze), 4,2 MiB po zainstalowaniu, wspiera kilkanaście platform
I oczywiście, że flit-core ma szerszą funkcjonalność. Ale jestem przekonany, że gdzieś ktoś potrzebuje zaoszczędzić te kilka milisekund budowania paczek Pythona.
Let's compare #PEP517 backends for pure #Python packages:
#flit-core: 51 KiB sdist, no dependencies, 0.05 s to install, ~150 KiB after installing
#UvBuild: 300 KiB sdist, requires ~250 crates (54 MiB download, ~600 MiB .cargo directory), 1 min 20 s to install (on a 12-thread system), 4.2 MiB after installing
And yes, you guessed right, flit-core has more functionality. But I'm sure that there are performance-critical wheel building workflows that will benefit from these few milliseconds shaved off wheel building time.
un article du blog "bite code" (que je vous recommande de suivre ou de fouiller - plein de choses intéressantes sur les #tests aussi, par exemple) sur un retour d'expérience sur https://github.com/astral-sh/uv, le gestionnaire de projet #Python de @charliermarsh, après un an d'utilisation de #uv dans différents contextes : https://www.bitecode.dev/p/a-year-of-uv-pros-cons-and-should
> A year of uv: pros, cons, and should you migrate
> Yes, probably.
À suivre : un billet dédié à ses conseils d'utilisation de uv.
My current pondering is whether we should go with `uv run --offline` invocations in our docker images with the idea of improving efficiency (don't generate internet traffic) and stability (don't rely on anything external).
Edit: removed "builds"
Clarification: When we *use* a docker image, by calling the internals with `uv run --offline` we'll _just_ invoke our Python tool, and prevent uv from checking / installing packages.
Have just found one of our work Docker container images was missing a call to `uv sync` to install Python package dependencies.
We didn't see any problems because all calls we do are wrapped in `uv run`, but this meant that every time we were using the container image, it was first taking about 0.25s to install the 67 package dependencies.
Again - 0.25s isn't great overhead, and really it's not a speed problem. The image is a validator and takes about that long to validate a file.
BUT...
@morgunkorn the last 3 look like #UV #BumpMaps, don't they?
Cc: @fuchsiii