Skip to content

[docs] Add shebang section for scripts#11553

Merged
zanieb merged 10 commits intoastral-sh:mainfrom
sa-:main
Apr 16, 2025
Merged

[docs] Add shebang section for scripts#11553
zanieb merged 10 commits intoastral-sh:mainfrom
sa-:main

Conversation

@sa-
Copy link
Contributor

@sa- sa- commented Feb 16, 2025

Summary

Documentation only. Adds a section in scripts.md about running uv scripts with a shebang line

Test Plan

n/a

@sa- sa- changed the title [docs] Add shebang sectiong for scripts [docs] Add shebang section for scripts Feb 16, 2025
@zanieb zanieb self-assigned this Feb 16, 2025
@sa-
Copy link
Contributor Author

sa- commented Feb 17, 2025

CI now passes :)

@c14n
Copy link

c14n commented Feb 19, 2025

While these changes are now formally correct, they are unfortunately factually incorrect.

The proper shebang line should be

#!/usr/bin/env -S uv run --script

The use of the -S flag for env is required due to the way spaces are handled in shebang lines. The example given in the patch will simply not work. For details, refer to

  1. https://www.gnu.org/software/coreutils/env
  2. «Use in shell-scripts» on https://man.freebsd.org/cgi/man.cgi?env

The use of the --script flag for uv is required to prevent infinite recursion, as seen in #11220.

Moreover, if the latter flag is used, the extension of the script can be chosen arbitrarily, or even omitted; it does not have to be .py.

@sa-
Copy link
Contributor Author

sa- commented Feb 20, 2025

@c14n Thanks for taking the time, I've incorporated your feedback

@c14n
Copy link

c14n commented Feb 20, 2025

Notice that I am not a maintainer, so the following are just the observations of some random passer-by.


There are still some issues with this pull request, chief of which being that the changes do not mesh well with the surrounding material.

This is due to the fact that you do not adhere to the style guide, and do not try to match the structure of the surrounding material.

Notice how every section on this page of the documentation adheres to this pattern:

This is an brief introductory paragraph that explains what you can expect
to accomplish by following the advice in this section. After the colon 
terminating this sentence, we give you example code:

```python title="example.py"
# Here is the code that is absolutely necessary to illustrate the point, 
# and no more. 
```

```console
$ command-to-run-the-example-must-have-dollar-sign-before
Output. Does not start with a dollar sign.
```

Do you see how focused and concise that approach is?

My advice: Read the style guide and try to match the form of the existing material. (This also applies to commit messages.)


There are also some issues with the contents of the patch. I'll add inline comments to point those out.


```
chmod +x do-thing
```
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be explained this explicitly? According to the style guide, guides

May assume basic knowledge of the domain.

so it should be enough to mention that a script should have its execute bit set in the introduction.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about this for an introductory paragraph:

On Unix-like systems, you can turn your script into a standalone executable by setting its execute
bit with `chmod +x standalone.py` and adding a shebang interpreter directive at the start of your
script:

```python title="standalone.py"
#!/usr/bin/env -S uv run --script

print("Hello, standalone!")
```

@EliteTK
Copy link
Contributor

EliteTK commented Feb 28, 2025

env -S is not portable. Please consider at least mentioning this in the documentation.

@c14n
Copy link

c14n commented Feb 28, 2025

Seeing that FreeBSD, coreutils, and OS X have supported for env -S for at least five years, I'd also argue that it is portable enough for all practical purposes.

Moreover, the style guide indicates that guides

  1. Should not enumerate all possibilities.

and in particular

  1. May generally ignore platform-specific behavior.

So I don't think this needs to be mentioned.

@EliteTK
Copy link
Contributor

EliteTK commented Feb 28, 2025

I think those points in the style guide don't seem entirely relevant here given the entire point it using env is portability between systems.

If anything, env -S is the platform specific behavior.

While I am glad env -S works for your limited set of purposes, there are many places where env -S doesn't work. The following is a list of cases that I know of:

  • Busybox (common in containers)
  • Toybox (used on android but can be used just like busybox)
  • OpenBSD (where I most commonly encounter this problem)
  • NetBSD (ditto)
  • Solaris (and OpenIndiana)

I think it would be best to consider some addition to uv which makes it possible to not need -S. (e.g. a uv-run symlink)

In the meanwhile I feel like the docs should, when recommending an approach to solving a portability problem (which this is), at least mention in passing that the solution is itself non-portable.

@zanieb
Copy link
Member

zanieb commented Feb 28, 2025

It seems dubious that we'll introduce another entry point to uv specifically for shebangs.

I think it's reasonable for the guide to focus on major platforms, i.e., Ubuntu, macOS, Windows. It's also fine to say that before the example. Is there a viable alternative on those distributions?

Long-term, we need to split some of the scripts guide into a concept document so we can cover things like this in-depth without adding complexity for beginners.

@EliteTK
Copy link
Contributor

EliteTK commented Feb 28, 2025

Regarding alternatives for different operating systems and linux environments that don't use GNU coreutils and would also work on systems with coreutils:

You can put a script in your path, called uv-run for lack of a better name, with the contents:

#!/bin/sh
exec uv run --script "$@"

Then you can use this from a shebang like #!/usr/bin/env uv-run. The downside is that now alongside with installing UV, you need to install this wrapper on any system where you want this style of "works out of the box" python scripts to work. (This is why, if uv wants to lean into this "easy shebang solution to all your python woes", a dedicated uv-run would be beneficial.)

I would also agree that this alternative requires too much explanation to be documented by these docs. But, if the argument is that these kinds of details are too much for these "beginner" oriented docs then I question if it's even appropriate to document the solution in this PR either.

The selling point of this style of script which has been made when presenting uv as useful in this context (as something which can be executed from the shebang) is that you can put this at the top of a shell script and distribute the shell script across various people or contexts and that it will just work. But the reality is that there are caveats like I outlined above. You can say that OpenBSD, NetBSD, and Solaris are niche use-cases and I agree for the most part but a lot of people do use containers and are likely to run into the env -S issue in those cases. (Although let me be clear, I really like this use-case and that's why I would love to see it supported explicitly by uv without needing a wrapper script for it to be portable.)

And at the end of the day, regardless of what direction the project wants to take on this topic or this PR, all I was hoping for with my first comment was some note either at the top or the bottom to say: "Note: -S is a GNU extension, and this may introduce portability concerns for your use-cases." or something to that effect. I wasn't trying to suggest that there needs to be some long-form discussion of -S and alternatives. There is already information on that topic on the internet (and if there isn't, I would put it on my blog rather than asking for such unrelated information to be included in the uv docs).

@zanieb
Copy link
Member

zanieb commented Feb 28, 2025

Thanks for the thorough response, appreciate it.

@c14n
Copy link

c14n commented Mar 2, 2025

I choose to believe that users can generally be trusted to consult the page «Using uv in Docker» rather than «Running scripts» when attempting to containerize their software. Therefore, I think it's appropriate to restrict the guidance provided on the latter page to the use cases that do not involve containerization.

I also think that the official docs should only provide guidance on how to use the software for platforms for which they also provide installation instructions. At time of writing, the Unix-likes that are supported in that sense are only macOS and Linux, both of which support env -S in the most common setups.

The introduction of a wrapper script to facilitate running scripts on platforms that fail to implement env -S should probably be discussed in a separate feature request. We should probably wait with this PR until a definite decision on that topic has been made.

Personally, I doubt that the introduction of such a wrapper is particularily useful for containerization, seeing that adding one to your image is a four-liner:

COPY --chmod=755 <<EOF /usr/bin/envess
#!/bin/sh
exec uv run --script "$@"
EOF

Finally, guides should strive to provide solutions. Even if it were a good idea to include documentation for unsupported platforms, I would object to a note that reads

Note: -S is a GNU extension, and this may introduce portability concerns for your use-cases.

How does that help the reader of the guide accomplish their goal, should they be on a system that does not support that flag? (Also FreeBSD introduced -S over a decade before coreutils, hence the support in macOS. So why single GNU out?)

@EliteTK
Copy link
Contributor

EliteTK commented Mar 3, 2025

I choose to believe that users can generally be trusted to consult the page «Using uv in Docker» rather than «Running scripts» when attempting to containerize their software. Therefore, I think it's appropriate to restrict the guidance provided on the latter page to the use cases that do not involve containerization.

Containerising software is not the situation I was thinking of when I suggested people would run into this limitation of -S. One of the primary goals of using #!/usr/bin/env is to have working one-off scripts without needing to modify the shebang for every environment. This goal is partially defeated when needing to use -S since it means your one-off scripts now stop working in some environments. This problem isn't solved by reading the documentation on containerisation.

I also think that the official docs should only provide guidance on how to use the software for platforms for which they also provide installation instructions. At time of writing, the Unix-likes that are supported in that sense are only macOS and Linux, both of which support env -S in the most common setups.

I came across the docs without ever seeing or reading the installation section. I think it's likely people will come across the page on using uv in scripts directly from search engines (which is how I came across the documentation for uv run in the first place). From what I can tell, the docs so far would for the most part work on any system on which you've successfully managed to install uv (which is likely any system with a working pip and rust installation). If this one page is going to rely on this assumption that you've installed it on a system where env supports -S then I don't see a good reason why it's harmful to just mention that in passing rather than saying "unix like" which is a very broad term and is inaccurate.

The introduction of a wrapper script to facilitate running scripts on platforms that fail to implement env -S should probably be discussed in a separate feature request. We should probably wait with this PR until a definite decision on that topic has been made.

Personally, I doubt that the introduction of such a wrapper is particularily useful for containerization, seeing that adding one to your image is a four-liner:

COPY --chmod=755 <<EOF /usr/bin/envess
#!/bin/sh
exec uv run --script "$@"
EOF

I was answering a question, I explicitly said I wasn't suggesting it be included in any part of these docs. But worth clarifying that I wasn't thinking of dockerfiles as the main case where people would encounter this issue. More-so any situation where one might either enter the container to run a one-off script. The obvious workaround is to just do uv run --script <script> but presumably one of the goals of the shebang was to avoid that.

Finally, guides should strive to provide solutions. Even if it were a good idea to include documentation for unsupported platforms, I would object to a note that reads

Note: -S is a GNU extension, and this may introduce portability concerns for your use-cases.

How does that help the reader of the guide accomplish their goal, should they be on a system that does not support that flag? (Also FreeBSD introduced -S over a decade before coreutils, hence the support in macOS. So why single GNU out?)

I was mainly trying to keep it short, and I didn't realise it originated in FreeBSD but I can see that you are in fact right. So maybe it's best to just say it's a common extension which is not supported on all environments.

Either way, yes, guides should guide people to solutions but it's also important for guides to be up-front about the limitations of the solutions. In this case it's easy to assume, especially given the surrounding wording, that if you use #!/usr/bin/env -S uv run --script that you will get a script which can be ran on any environment where uv is installed. I think it would be helpful to dispel this potential misunderstanding with some note, the exact wording isn't important to me.

@zanieb
Copy link
Member

zanieb commented Mar 17, 2025

I'll try to get this in this week.

@hyperknot
Copy link

I also come here to say that please embrace the uv shebang. This is currently the best way to work with Python scripts, yet it's totally unofficial / you have to ask on Discord level hidden.

I recommend the following:

  1. Please agree on an official uv shebang line. Just in this thread there are quite a few alternatives. I'm personally using
#!/usr/bin/env -S uv run
  1. Advertise it everywhere, in the FAQ, in the uv init scripts, etc.

  2. Modify ruff EXE003 rule to allow this.


Also, please don't limit the 99.999% of developers's use case, just because there is an incompatibility with Busybox, Toybox, OpenBSD, NetBSD or Solaris. Those users with exotic environments can use any other shebang line, the important thing would be to make development experience smooth for the majority of users.

@sa-
Copy link
Contributor Author

sa- commented Mar 19, 2025

CI failing looks unrelated

@sa-
Copy link
Contributor Author

sa- commented Apr 5, 2025

Could someone please retrigger the CI pipeline? My PR has nothing to do with the GraalPy error

@zanieb
Copy link
Member

zanieb commented Apr 16, 2025

Thanks for your patience here!

@zanieb zanieb enabled auto-merge (squash) April 16, 2025 15:10
@zanieb zanieb added the documentation Improvements or additions to documentation label Apr 16, 2025
@zanieb zanieb merged commit d9243ce into astral-sh:main Apr 16, 2025
75 of 76 checks passed
@hyperknot
Copy link

Thanks for merging this. I just wanted to ask one Q: the other day I run into that if I make a project with uv init, I need to have the shebang without --script, or otherwise it cannot find the local lib folders.

I mean the ones where I put init.py and utility functions, etc. I use this in pyproj:

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["lib"]

So for the script files in projects it has to be without --script. For the script files outside of projects, like self-contained ones with

# /// script
# requires-python = ">=3.13"
# dependencies = [
#     "requests",
# ]
# ///

these scripts absolutely need --script.

Either this needs to be fixed in uv, or the documentation should mention this. Of course, it'd be best if we could get rid of --script altogether.

@zanieb
Copy link
Member

zanieb commented Apr 16, 2025

--script is needed because without it we use .py to sniff if uv run is given a script. The documentation uses --script, what do you want to change here?

@zanieb
Copy link
Member

zanieb commented Apr 16, 2025

Ah I see

So for the script files in projects it has to be without --script.

I can add a note about that.

@zanieb
Copy link
Member

zanieb commented Apr 16, 2025

I don't know if this is true? in a project which has httpx as a dependency...

❯ cat example
#!/usr/bin/env -S uv run --script

import httpx

print(httpx.get("https://example.com"))
❯ uv run --script example
Installed 8 packages in 8ms
<Response [200 OK]>

@hyperknot
Copy link

I mean importing from my own utility library. But I tried it today and I cannot reproduce it, but yesterday I run into it.
Once I run into it again, I'll try to make a minimal repro case and post it here.

tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Apr 26, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [astral-sh/uv](https://github.com/astral-sh/uv) | patch | `0.6.11` -> `0.6.16` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>astral-sh/uv (astral-sh/uv)</summary>

### [`v0.6.16`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#0616)

[Compare Source](astral-sh/uv@0.6.15...0.6.16)

##### Bug fixes

-   Revert "Properly handle authentication for 302 redirect URLs" ([#&#8203;13041](astral-sh/uv#13041))

### [`v0.6.15`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#0615)

[Compare Source](astral-sh/uv@0.6.14...0.6.15)

This release includes preliminary support for the `pylock.toml` file format, as standardized in [PEP 751](https://peps.python.org/pep-0751/). `pylock.toml` is an alternative resolution output format intended to replace `requirements.txt` (e.g., in the context of `uv pip compile`, whereby a "locked" `requirements.txt` file is generated from a set of input requirements). `pylock.toml` is standardized and tool-agnostic, such that in the future, `pylock.toml` files generated by uv could be installed by other tools, and vice versa.

As of this release, `pylock.toml` is supported in the following commands:

-   To export a `uv.lock` to the `pylock.toml` format, run: `uv export -o pylock.toml`
-   To generate a `pylock.toml` file from a set of requirements, run: `uv pip compile -o pylock.toml -r requirements.in`
-   To install from a `pylock.toml` file, run: `uv pip sync pylock.toml` or `uv pip install -r pylock.toml`

##### Enhancements

-   Add PEP 751 support to `uv pip compile` ([#&#8203;13019](astral-sh/uv#13019))
-   Add `uv export` support for PEP 751 ([#&#8203;12955](astral-sh/uv#12955))
-   Accept `requirements.txt` (verbatim) as a format on the CLI ([#&#8203;12957](astral-sh/uv#12957))
-   Add `UV_NO_EDITABLE` environment variable to set `--no-editable` on all invocations ([#&#8203;12773](astral-sh/uv#12773))
-   Add `pylock.toml` to `uv pip install` and `uv pip sync` ([#&#8203;12992](astral-sh/uv#12992))
-   Add a brief sleep before sending `SIGINT` to child processes ([#&#8203;13018](astral-sh/uv#13018))
-   Add upload time to `uv.lock` ([#&#8203;12968](astral-sh/uv#12968))
-   Allow updating Git sources by name ([#&#8203;12897](astral-sh/uv#12897))
-   Cache `which git` in `uv init` ([#&#8203;12893](astral-sh/uv#12893))
-   Enable `--dry-run` with `--locked` / `--frozen` for `uv sync` ([#&#8203;12778](astral-sh/uv#12778))
-   Infer output type in `uv export` ([#&#8203;12958](astral-sh/uv#12958))
-   Make `uv init` resilient against broken git ([#&#8203;12895](astral-sh/uv#12895))
-   Respect build constraints for `uv run --with` dependencies ([#&#8203;12882](astral-sh/uv#12882))
-   Split UV_INDEX on all whitespace ([#&#8203;12820](astral-sh/uv#12820))
-   Support build constraints in `uv tool` and PEP723 scripts. ([#&#8203;12842](astral-sh/uv#12842))
-   Use suffix from `uvx` binary when searching for uv binary ([#&#8203;12923](astral-sh/uv#12923))
-   Update version formatting to use cyan color ([#&#8203;12943](astral-sh/uv#12943))
-   Add debug logs for version file search ([#&#8203;12951](astral-sh/uv#12951))
-   Fix `SourceNotAllowed` error message during Python discovery ([#&#8203;13012](astral-sh/uv#13012))
-   Obfuscate password in credentials debug messages ([#&#8203;12944](astral-sh/uv#12944))
-   Obfuscate possible tokens in URL logs ([#&#8203;12969](astral-sh/uv#12969))
-   Validate that PEP 751 entries don't include multiple sources ([#&#8203;12993](astral-sh/uv#12993))

##### Preview features

-   Build backend: Add reference docs and schema ([#&#8203;12803](astral-sh/uv#12803))

##### Bug fixes

-   Align supported `config-settings` with example in docs ([#&#8203;12947](astral-sh/uv#12947))
-   Ensure virtual environment is compatible with interpreter on sync ([#&#8203;12884](astral-sh/uv#12884))
-   Fix `PythonDownloadRequest` parsing for partial keys ([#&#8203;12925](astral-sh/uv#12925))
-   Fix pre-release exclusive comparison operator in `uv-pep440` ([#&#8203;12836](astral-sh/uv#12836))
-   Forward additional signals to the child process in `uv run` ([#&#8203;13017](astral-sh/uv#13017))
-   Omit PEP 751 version for source trees ([#&#8203;13030](astral-sh/uv#13030))
-   Patch `CC` and `CCX` entries in sysconfig for cross-compiled `aarch64` Python distributions ([#&#8203;12239](astral-sh/uv#12239))
-   Properly handle authentication for HTTP 302 redirect URLs ([#&#8203;12920](astral-sh/uv#12920))
-   Set 4MB stack size for all threads, introduce `UV_STACK_SIZE` ([#&#8203;12839](astral-sh/uv#12839))
-   Show PyPy downloads during `uv python list` ([#&#8203;12915](astral-sh/uv#12915))
-   Add `subdirectory` to Direct URL for local directories ([#&#8203;12971](astral-sh/uv#12971))
-   Prefer stable releases over pre-releases in `uv python install` ([#&#8203;12194](astral-sh/uv#12194))
-   Write requested Python variant to pin file in `uv init` ([#&#8203;12870](astral-sh/uv#12870))

##### Documentation

-   Fix CLI reference with code block ([#&#8203;12807](astral-sh/uv#12807))
-   Fix lockfile note ([#&#8203;12793](astral-sh/uv#12793))
-   Fix typo in a reference ([#&#8203;12858](astral-sh/uv#12858))
-   Improve docs for `uv python list --only-downloads` and `--only-installed` ([#&#8203;12916](astral-sh/uv#12916))
-   Update note on lack of musl distributions to ARM-only ([#&#8203;12825](astral-sh/uv#12825))
-   Add section on shebangs for scripts ([#&#8203;11553](astral-sh/uv#11553))
-   Display aliases for long and short args in the CLI reference ([#&#8203;12824](astral-sh/uv#12824))
-   Fix highlight line in explicit index documentation ([#&#8203;12887](astral-sh/uv#12887))
-   Add explicit source (matching PyTorch guide) ([#&#8203;12844](astral-sh/uv#12844))
-   Fix link to issue ([#&#8203;12823](astral-sh/uv#12823))
-   Fix grammatical error in FastAPI guide ([#&#8203;12908](astral-sh/uv#12908))
-   Add `--locked` to `uv sync` in GitHub Actions guide ([#&#8203;12819](astral-sh/uv#12819))
-   Improve formatting for `"all"` `default-groups` setting documentation ([#&#8203;12963](astral-sh/uv#12963))
-   Replace `--frozen` with `--locked` in Docker integration guide ([#&#8203;12818](astral-sh/uv#12818))

### [`v0.6.14`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#0614)

[Compare Source](astral-sh/uv@0.6.13...0.6.14)

##### Python versions

The following Python versions have been added:

-   CPython 3.13.3
-   CPython 3.12.10
-   CPython 3.11.12
-   CPython 3.10.17
-   CPython 3.9.22

See the [`python-build-standalone` release notes](https://github.com/astral-sh/python-build-standalone/releases/tag/20250409) for more details.

##### Enhancements

-   Add `uv-build` and `uv_build` aliases to `uv init --build-backend` ([#&#8203;12776](astral-sh/uv#12776))
-   Emit dedicated error message for Conda `environment.yml` files ([#&#8203;12669](astral-sh/uv#12669))

##### Preview features

-   Build backend: Check module dir exists for sdist build ([#&#8203;12779](astral-sh/uv#12779))
-   Build backend: Fix sdist with long directories ([#&#8203;12764](astral-sh/uv#12764))

##### Performance

-   Avoid querying GitHub on repeated install invocations ([#&#8203;12767](astral-sh/uv#12767))

##### Bug fixes

-   Error when `tool.uv.sources` is set in system-level configuration file ([#&#8203;12757](astral-sh/uv#12757))
-   Split workspace members onto their own lines in `uv init` ([#&#8203;12756](astral-sh/uv#12756))

##### Documentation

-   Add lockfile note about PEP 751 ([#&#8203;12732](astral-sh/uv#12732))
-   Extend the reference documentation for `uv pip sync` ([#&#8203;12683](astral-sh/uv#12683))
-   Fix mismatched pip interface header / nav titles ([#&#8203;12640](astral-sh/uv#12640))

### [`v0.6.13`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#0613)

[Compare Source](astral-sh/uv@0.6.12...0.6.13)

##### Enhancements

-   Add `--show-version` to `uv python find` ([#&#8203;12376](astral-sh/uv#12376))
-   Remove `--no-config` warning from `uv pip compile` and `uv pip sync` ([#&#8203;12642](astral-sh/uv#12642))
-   Skip repeated directories in `PATH` when searching for Python interpreters ([#&#8203;12367](astral-sh/uv#12367))
-   Unset `SCRIPT_PATH` in relocatable activation script ([#&#8203;12672](astral-sh/uv#12672))
-   Add `UV_PYTHON_DOWNLOADS_JSON_URL` to set custom managed python sources ([#&#8203;10939](astral-sh/uv#10939))
-   Reject `pyproject.toml` files in `uv pip compile -o` ([#&#8203;12673](astral-sh/uv#12673))
-   Respect the `--offline` flag for Git operations ([#&#8203;12619](astral-sh/uv#12619))

##### Bug fixes

-   Warn instead of error if CRC appears to be missing ([#&#8203;12722](astral-sh/uv#12722))
-   Avoid infinite loop in `uv export` with conflicts ([#&#8203;12726](astral-sh/uv#12726))

##### Rust API

-   Update MSRV to 1.84 ([#&#8203;12670](astral-sh/uv#12670))

### [`v0.6.12`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#0612)

[Compare Source](astral-sh/uv@0.6.11...0.6.12)

##### Enhancements

-   Report the queried executable path in `uv python list` ([#&#8203;12628](astral-sh/uv#12628))
-   Improve archive unpack error messages ([#&#8203;12627](astral-sh/uv#12627))

##### Bug fixes

-   Respect `authenticate` when using `explicit = true` ([#&#8203;12631](astral-sh/uv#12631))
-   Normalize extra and group names in `uv add` and `uv remove` ([#&#8203;12586](astral-sh/uv#12586))
-   Enforce CRC-32 checks when unpacking archives ([#&#8203;12623](astral-sh/uv#12623))
-   Fix parsing of `python-platform` in settings files ([#&#8203;12592](astral-sh/uv#12592))

##### Documentation

-   Add note about `uv build` to `package = false` ([#&#8203;12608](astral-sh/uv#12608))
-   Add index fallback note to `authenticate = always` documentation ([#&#8203;12498](astral-sh/uv#12498))
-   Fix invalid 'kind' reference in flat index docs ([#&#8203;12583](astral-sh/uv#12583))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yNTEuMCIsInVwZGF0ZWRJblZlciI6IjM5LjI1My41IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Apr 29, 2025
## 0.6.17

### Preview features

- Add PyTorch v2.7.0 to GPU backend ([#13072](astral-sh/uv#13072))

### Bug fixes

- Avoid panic for invalid Python versions ([#13077](astral-sh/uv#13077))
- Block scripts from overwriting `python` ([#13051](astral-sh/uv#13051))
- Check distribution names to handle invalid redirects ([#12917](astral-sh/uv#12917))
- Check for mismatched package and distribution names on resolver thread ([#13088](astral-sh/uv#13088))
- Fix panic with invalid last character in PEP 508 name ([#13105](astral-sh/uv#13105))
- Reject `requires-python` even if not listed on the index page ([#13086](astral-sh/uv#13086))

## 0.6.16

### Bug fixes

- Revert "Properly handle authentication for 302 redirect URLs" ([#13041](astral-sh/uv#13041))

## 0.6.15

This release includes preliminary support for the `pylock.toml` file format, as standardized in [PEP 751](https://peps.python.org/pep-0751/). `pylock.toml` is an alternative resolution output format intended to replace `requirements.txt` (e.g., in the context of `uv pip compile`, whereby a "locked" `requirements.txt` file is generated from a set of input requirements). `pylock.toml` is standardized and tool-agnostic, such that in the future, `pylock.toml` files generated by uv could be installed by other tools, and vice versa.

As of this release, `pylock.toml` is supported in the following commands:

- To export a `uv.lock` to the `pylock.toml` format, run: `uv export -o pylock.toml`
- To generate a `pylock.toml` file from a set of requirements, run: `uv pip compile -o pylock.toml -r requirements.in`
- To install from a `pylock.toml` file, run: `uv pip sync pylock.toml` or `uv pip install -r pylock.toml`

### Enhancements

- Add PEP 751 support to `uv pip compile` ([#13019](astral-sh/uv#13019))
- Add `uv export` support for PEP 751 ([#12955](astral-sh/uv#12955))
- Accept `requirements.txt` (verbatim) as a format on the CLI ([#12957](astral-sh/uv#12957))
- Add `UV_NO_EDITABLE` environment variable to set `--no-editable` on all invocations ([#12773](astral-sh/uv#12773))
- Add `pylock.toml` to `uv pip install` and `uv pip sync` ([#12992](astral-sh/uv#12992))
- Add a brief sleep before sending `SIGINT` to child processes ([#13018](astral-sh/uv#13018))
- Add upload time to `uv.lock` ([#12968](astral-sh/uv#12968))
- Allow updating Git sources by name ([#12897](astral-sh/uv#12897))
- Cache `which git` in `uv init` ([#12893](astral-sh/uv#12893))
- Enable `--dry-run` with `--locked` / `--frozen` for `uv sync` ([#12778](astral-sh/uv#12778))
- Infer output type in `uv export` ([#12958](astral-sh/uv#12958))
- Make `uv init` resilient against broken git ([#12895](astral-sh/uv#12895))
- Respect build constraints for `uv run --with` dependencies ([#12882](astral-sh/uv#12882))
- Split UV_INDEX on all whitespace ([#12820](astral-sh/uv#12820))
- Support build constraints in `uv tool` and PEP723 scripts. ([#12842](astral-sh/uv#12842))
- Use suffix from `uvx` binary when searching for uv binary ([#12923](astral-sh/uv#12923))
- Update version formatting to use cyan color ([#12943](astral-sh/uv#12943))
- Add debug logs for version file search ([#12951](astral-sh/uv#12951))
- Fix `SourceNotAllowed` error message during Python discovery ([#13012](astral-sh/uv#13012))
- Obfuscate password in credentials debug messages ([#12944](astral-sh/uv#12944))
- Obfuscate possible tokens in URL logs ([#12969](astral-sh/uv#12969))
- Validate that PEP 751 entries don't include multiple sources ([#12993](astral-sh/uv#12993))

### Preview features

- Build backend: Add reference docs and schema ([#12803](astral-sh/uv#12803))

### Bug fixes

- Align supported `config-settings` with example in docs ([#12947](astral-sh/uv#12947))
- Ensure virtual environment is compatible with interpreter on sync ([#12884](astral-sh/uv#12884))
- Fix `PythonDownloadRequest` parsing for partial keys ([#12925](astral-sh/uv#12925))
- Fix pre-release exclusive comparison operator in `uv-pep440` ([#12836](astral-sh/uv#12836))
- Forward additional signals to the child process in `uv run` ([#13017](astral-sh/uv#13017))
- Omit PEP 751 version for source trees ([#13030](astral-sh/uv#13030))
- Patch `CC` and `CCX` entries in sysconfig for cross-compiled `aarch64` Python distributions ([#12239](astral-sh/uv#12239))
- Properly handle authentication for HTTP 302 redirect URLs ([#12920](astral-sh/uv#12920))
- Set 4MB stack size for all threads, introduce `UV_STACK_SIZE` ([#12839](astral-sh/uv#12839))
- Show PyPy downloads during `uv python list` ([#12915](astral-sh/uv#12915))
- Add `subdirectory` to Direct URL for local directories ([#12971](astral-sh/uv#12971))
- Prefer stable releases over pre-releases in `uv python install` ([#12194](astral-sh/uv#12194))
- Write requested Python variant to pin file in `uv init` ([#12870](astral-sh/uv#12870))

### Documentation

- Fix CLI reference with code block ([#12807](astral-sh/uv#12807))
- Fix lockfile note ([#12793](astral-sh/uv#12793))
- Fix typo in a reference ([#12858](astral-sh/uv#12858))
- Improve docs for `uv python list --only-downloads` and `--only-installed` ([#12916](astral-sh/uv#12916))
- Update note on lack of musl distributions to ARM-only ([#12825](astral-sh/uv#12825))
- Add section on shebangs for scripts ([#11553](astral-sh/uv#11553))
- Display aliases for long and short args in the CLI reference ([#12824](astral-sh/uv#12824))
- Fix highlight line in explicit index documentation ([#12887](astral-sh/uv#12887))
- Add explicit source (matching PyTorch guide) ([#12844](astral-sh/uv#12844))
- Fix link to issue ([#12823](astral-sh/uv#12823))
- Fix grammatical error in FastAPI guide ([#12908](astral-sh/uv#12908))
- Add `--locked` to `uv sync` in GitHub Actions guide ([#12819](astral-sh/uv#12819))
- Improve formatting for `"all"` `default-groups` setting documentation ([#12963](astral-sh/uv#12963))
- Replace `--frozen` with `--locked` in Docker integration guide ([#12818](astral-sh/uv#12818))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants