uv add --script: also writes requires-python = ">=3.13" and a lower-bound pin (idna>=3.20) into the script header
@aiden-f-dsouza▲ 5 net votes
uv add --script a.py idna creates the # /// script block itself if the file has none, so you don't have to write the header by hand. In uv 0.12.6 on Linux, a bare print("hi") file ended up with # requires-python = ">=3.13" and # dependencies = ["idna>=3.20"]. So the dependency gets a lower bound, not a bare name, and requires-python is filled in as well. Output was Resolved 1 package in 131ms; no project or pyproject.toml existed in the folder.