惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Y
Y Combinator Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
V2EX
博客园 - 三生石上(FineUI控件)
Hugging Face - Blog
Hugging Face - Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
罗磊的独立博客
博客园_首页
量子位
雷峰网
雷峰网
GbyAI
GbyAI
小众软件
小众软件
酷 壳 – CoolShell
酷 壳 – CoolShell
D
DataBreaches.Net
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The Cloudflare Blog
IT之家
IT之家
WordPress大学
WordPress大学
人人都是产品经理
人人都是产品经理
Apple Machine Learning Research
Apple Machine Learning Research
P
Proofpoint News Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 聂微东

LWN.net comments

blocking algif_aead side effects? tcmalloc's weird hack [LWN.net] Fixed? [LWN.net] mpd [LWN.net] Userspace AX.25 [LWN.net] RIP [LWN.net] My two cents... [LWN.net] pipx [LWN.net] Tragedy [LWN.net] A young man destined for glory [LWN.net] And 'less' won't let you search [LWN.net] A great loss [LWN.net] Sad and shocking news [LWN.net] Easy migration from Clementine [LWN.net] Sad coincidence [LWN.net] GNOME is actually usable thanks to Seth et al [LWN.net] Sad news :( [LWN.net] armhf supports preempt_rt [LWN.net] MusicBrainz accurracy [LWN.net] On open source maintainership [LWN.net] Let's stop here [LWN.net] Not a new thing [LWN.net] uv is indeed great pgmoneta Some comments on this on a Postgres blog feed [LWN.net] going to Debian [LWN.net] Upgrading 64-bit-capable systems to 64-bit kernels? [LWN.net] Free Software foundations Maintainers can wait for code review but not for publish review? A reasonably extreme point of view [LWN.net]
uv [LWN.net]
champtar · 2026-04-28 · via LWN.net comments

uv

Posted Apr 28, 2026 2:45 UTC (Tue) by champtar (subscriber, #128673)
Parent article: pip 26.1 released

I really recommend trying out uv, a simple 'uv run ...' makes sure you run in a venv with the right dependencies, it's blazing fast, has a shared cache, and can even manage python version.


to post comments

uv is indeed great

Posted Apr 28, 2026 8:01 UTC (Tue) by cyperpunks (subscriber, #39406) [Link] (3 responses)

Indeed, and with inline script metadata, for example:
#! /usr/bin/python3

# /// script
# requires-python = ">=3.12"
# dependencies = [
#   "rich-argparse",
# ]
# ///

from rich_argparse import RichHelpFormatter
import sys
...
bash $ uv run myscript.py
Can also go one step further with a shebang trick and do:
bash$ cat myscript 
#! /usr/bin/env uv run myscript

# /// script
# requires-python = ">=3.12"
# dependencies = [
#   "rich-argparse",
# ]
# ///

from rich_argparse import RichHelpFormatter
import sys
...
bash$ chmod 0755 myscript
bash$ ./myscript

uv is indeed great

Posted Apr 28, 2026 14:14 UTC (Tue) by mathstuf (subscriber, #69389) [Link]

uv is indeed great

Posted Apr 28, 2026 14:24 UTC (Tue) by geofft (subscriber, #59789) [Link]

The env trick is great but that isn't quite the syntax. It should be
#!/usr/bin/env -S uv run --script
You need env -S to split arguments on Linux (macOS's kernel splits at all spaces but Linux and most other UNIXes only split at the first space), you shouldn't pass the name of the script in the shebang, and you need --script both to allow you to leave off the .py extension and to make sure you are not loading the environment from a Python project that happens to contain your working directory.

uv has an example in the docs giving this shebang.

Note that this is a standardized feature and uv isn't the only tool that supports it. pipx, a sibling project to pip, also supports it, though uv is going to be a lot faster. (pip itself is just an installer, not a script runner. pip 26.0 does support installing into an existing environment by parsing this metadata with pip install --requirements-from-script, but for actually running, they consider this out of scope and suggest using pipx or uv.)

pipx

Posted Apr 29, 2026 17:44 UTC (Wed) by tamasrepus (subscriber, #33205) [Link]

FYI, inline script data parsing is not limited to uv. You can use pipx (which I prefer, since it's packaged in Debian and makes it easy to copy around these now "standalone" scripts to Debian systems):

#!/usr/bin/env -S pipx run --path

Implemented in: pypa/pipx issue #913