File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -403,6 +403,25 @@ The proper [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) line for Pyth
403403# !/usr/bin/env python3
404404```
405405
406+ If your script has external dependencies hosted on PyPI, add
407+ [ PEP 723 Inline script metadata] ( https://peps.python.org/pep-0723/ ) and a ` uv run ` shebang line
408+ to allow easy execution on macOS and Linux.
409+
410+ ``` py
411+ # !/usr/bin/env -S uv run --script
412+ # /// script
413+ # requires-python = ">=3.13"
414+ # dependencies = [
415+ # "httpx>=0.28.1",
416+ # ]
417+ # ///
418+
419+ import httpx
420+ print (httpx.get(" https://example.com" ).text)
421+ ```
422+
423+ On Windows, remove the ` -S ` from the shebang and execute the script using the ` py ` launcher.
424+
406425## Package Dependency Tree
407426
408427` uv tree ` is a command for listing installed packages in the form of a dependency tree. For large
You can’t perform that action at this time.
0 commit comments