diff --git a/docs/guides/integration/fastapi.md b/docs/guides/integration/fastapi.md index 6693f46d3c6b4..eeebba5322d84 100644 --- a/docs/guides/integration/fastapi.md +++ b/docs/guides/integration/fastapi.md @@ -42,7 +42,7 @@ To use uv with this application, inside the `project` directory run: $ uv init --app ``` -This creates an [project with an application layout](../../concepts/projects/init.md#applications) +This creates a [project with an application layout](../../concepts/projects/init.md#applications) and a `pyproject.toml` file. Then, add a dependency on FastAPI: diff --git a/docs/guides/scripts.md b/docs/guides/scripts.md index 82818b5f2bef3..28ef0aef66cc4 100644 --- a/docs/guides/scripts.md +++ b/docs/guides/scripts.md @@ -351,6 +351,24 @@ PS> uv run --with PyQt5 example_pyqt.pyw ![Run Result](../assets/uv_gui_script_hello_world_pyqt.png){: style="height:50px;width:150px"} +## Setting a shebang + +You can use the following shebang (`#!`) line at the top of your script to have your system pick `uv` for running it: + +```python title="example.py" +#!/usr/bin/env -S uv run --script +# /// script +# dependencies = [] +# /// +``` + +You can then make the script executable and launch it without explicitly calling `uv`: + +```bash +chmod +x example.py +./example.py +``` + ## Next steps To learn more about `uv run`, see the [command reference](../reference/cli.md#uv-run).