Commit graph

51 commits

Author SHA1 Message Date
John Mumm
e9d5780369
Support transparent Python patch version upgrades (#13954)
> NOTE: The PRs that were merged into this feature branch have all been
independently reviewed. But it's also useful to see all of the changes
in their final form. I've added comments to significant changes
throughout the PR to aid discussion.

This PR introduces transparent Python version upgrades to uv, allowing
for a smoother experience when upgrading to new patch versions.
Previously, upgrading Python patch versions required manual updates to
each virtual environment. Now, virtual environments can transparently
upgrade to newer patch versions.

Due to significant changes in how uv installs and executes managed
Python executables, this functionality is initially available behind a
`--preview` flag. Once an installation has been made upgradeable through
`--preview`, subsequent operations (like `uv venv -p 3.10` or patch
upgrades) will work without requiring the flag again. This is
accomplished by checking for the existence of a minor version symlink
directory (or junction on Windows).

### Features

* New `uv python upgrade` command to upgrade installed Python versions
to the latest available patch release:
``` 
# Upgrade specific minor version 
uv python upgrade 3.12 --preview
# Upgrade all installed minor versions
uv python upgrade --preview
```
* Transparent upgrades also occur when installing newer patch versions: 
```
uv python install 3.10.8 --preview
# Automatically upgrades existing 3.10 environments
uv python install 3.10.18
```
* Support for transparently upgradeable Python `bin` installations via
`--preview` flag
```
uv python install 3.13 --preview
# Automatically upgrades the `bin` installation if there is a newer patch version available
uv python upgrade 3.13 --preview
```
* Virtual environments can still be tied to a patch version if desired
(ignoring patch upgrades):
```
uv venv -p 3.10.8
```

### Implementation

Transparent upgrades are implemented using:
* Minor version symlink directories (Unix) or junctions (Windows)
* On Windows, trampolines simulate paths with junctions
* Symlink directory naming follows Python build standalone format: e.g.,
`cpython-3.10-macos-aarch64-none`
* Upgrades are scoped to the minor version key (as represented in the
naming format: implementation-minor version+variant-os-arch-libc)
* If the context does not provide a patch version request and the
interpreter is from a managed CPython installation, the `Interpreter`
used by `uv python run` will use the full symlink directory executable
path when available, enabling transparently upgradeable environments
created with the `venv` module (`uv run python -m venv`)

New types:
* `PythonMinorVersionLink`: in a sense, the core type for this PR, this
is a representation of a minor version symlink directory (or junction on
Windows) that points to the highest installed managed CPython patch
version for a minor version key.
* `PythonInstallationMinorVersionKey`: provides a view into a
`PythonInstallationKey` that excludes the patch and prerelease. This is
used for grouping installations by minor version key (e.g., to find the
highest available patch installation for that minor version key) and for
minor version directory naming.

### Compatibility

* Supports virtual environments created with:
  * `uv venv`
* `uv run python -m venv` (using managed Python that was installed or
upgraded with `--preview`)
  * Virtual environments created within these environments
* Existing virtual environments from before these changes continue to
work but aren't transparently upgradeable without being recreated
* Supports both standard Python (`python3.10`) and freethreaded Python
(`python3.10t`)
* Support for transparently upgrades is currently only available for
managed CPython installations

Closes #7287
Closes #7325
Closes #7892
Closes #9031
Closes #12977

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2025-06-20 16:17:13 +02:00
renovate[bot]
4d104dd004
Update Rust crate windows to v0.61.3 (#14055) 2025-06-16 02:05:34 +00:00
samypr100
3483f1d8b3
fix: format uv-trampoline for 2024 edition (#13519)
## Summary

Follow on to https://github.com/astral-sh/uv/pull/13516

Ensure uv-trampoline is formatted after switching to 2024 edition.
2025-05-18 20:19:27 -04:00
Charlie Marsh
c5032aee80
Bump MSRV to 1.85 and Edition 2024 (#13516)
## Summary

Builds on https://github.com/astral-sh/uv/pull/11724.

Closes https://github.com/astral-sh/uv/issues/13476.
2025-05-18 19:38:43 -04:00
renovate[bot]
6402f98cbd
Update Rust crate windows to 0.61.0 (#13159)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [windows](https://redirect.github.com/microsoft/windows-rs) |
dependencies | minor | `0.59.0` -> `0.61.0` |

---

### Release Notes

<details>
<summary>microsoft/windows-rs (windows)</summary>

###
[`v0.61.0`](https://redirect.github.com/microsoft/windows-rs/releases/tag/0.61.0)

[Compare
Source](https://redirect.github.com/microsoft/windows-rs/compare/0.60.0...0.61.0)

Major crate updates:

-   `windows` 0.59.0
-   `windows-core` 0.59.0
    -   `windows-implement` 0.59.0
    -   `windows-interface` 0.59.0
-   `windows-targets` 0.53.0
    -   `windows_i686_msvc` 0.53.0
    -   `windows_x86_64_msvc` 0.53.0
    -   `windows_aarch64_msvc` 0.53.0
    -   `windows_i686_gnu` 0.53.0
    -   `windows_x86_64_gnu` 0.53.0
    -   `windows_i686_gnullvm` 0.53.0
    -   `windows_x86_64_gnullvm` 0.53.0
    -   `windows_aarch64_gnullvm` 0.53.0
-   `windows-bindgen` 0.59.0
-   `windows-registry` 0.4.0
-   `windows-result` 0.3.0
-   `windows-strings` 0.3.0
-   `cppwinrt` 0.2.0

Minor crate updates:

-   `windows-version` 0.1.2

Excluded:

-   `windows-sys` 0.59.0

Things to keep in mind:

- The tag/release names no longer map directly to the crate versions, so
to [find
samples](https://redirect.github.com/microsoft/windows-rs/tree/master/crates/samples)
for a particular release requires looking at [the
releases](https://redirect.github.com/microsoft/windows-rs/releases)
page and finding the release that most recently updated a particular
crate.

- The `windows-bindgen` crate includes the major code generation
overhaul that brings many improvements - be sure to check out the PR
description for more information. The resulting code gen depends on the
new version of `windows-core` and its dependencies, unless you include
the `--sys` option.
[#&#8203;3359](https://redirect.github.com/microsoft/windows-rs/issues/3359)

- The `cppwinrt` crate constitutes a major update due to streamlining
the error handling.
[#&#8203;3415](https://redirect.github.com/microsoft/windows-rs/issues/3415)

- The `windows-registry`, `windows-strings,` and `windows-result` crates
are also major version updates since they include small breaking
changes.

- The `windows-targets` crate finally receives a major version update,
the first in over a year. This is due to
[#&#8203;3359](https://redirect.github.com/microsoft/windows-rs/issues/3359)
and
[#&#8203;3342](https://redirect.github.com/microsoft/windows-rs/issues/3342)
potentially introducing breaking changes. Although unlikely, these
updates introduced sufficient changes that make it hard to ensure that
the `windows-targets` libs don't break existing code. As we're updating
`windows-targets` anyway, I took the liberty to bump the MSRV to 1.60 -
to match the latest version of `windows-sys` - and remove the old but
unused doc macro feature. Both remained for compatibility with very old
dependents of the `windows-targets` crate.

- The `windows-version` crate receives a minor update to update its
dependency on the `windows-targets` crate.

- Beyond these specifics, this update is the culmination of around 6
months worth of work on the `windows-rs` project. The biggest
improvements comes from the new code generation engine, but many other
improvements are now also available for production. This includes
support for many new lints, warnings, and suggestions provided by the
Rust toolchain; much smaller code gen thanks to deriving many more
traits; more efficient code gen; major improvements to WinRT type system
and implementation support; more robust and consistent error handling;
stock collection and async support; improved support for class
hierarchies; and much more!

In addition to "what's changed" below, check out what's changed for
notes for
[0.60.0](https://redirect.github.com/microsoft/windows-rs/releases/tag/0.60.0)
and
[0.59.0](https://redirect.github.com/microsoft/windows-rs/releases/tag/0.59.0)
for additional changes that roll up to the crates published as part of
this release.

#### What's Changed

- Remove improper_ctypes workaround by
[@&#8203;ChrisDenton](https://redirect.github.com/ChrisDenton) in
[https://github.com/microsoft/windows-rs/pull/3296](https://redirect.github.com/microsoft/windows-rs/pull/3296)
- Bump rollup from 2.79.1 to 2.79.2 in /web/features by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/microsoft/windows-rs/pull/3299](https://redirect.github.com/microsoft/windows-rs/pull/3299)
- Update jsonschema requirement from 0.20 to 0.21 by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/microsoft/windows-rs/pull/3301](https://redirect.github.com/microsoft/windows-rs/pull/3301)
- Address Rust nightly compiler warnings by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3311](https://redirect.github.com/microsoft/windows-rs/pull/3311)
- Update jsonschema requirement from 0.21 to 0.22 by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/microsoft/windows-rs/pull/3310](https://redirect.github.com/microsoft/windows-rs/pull/3310)
- Update workflows to ignore paths on pull request by
[@&#8203;riverar](https://redirect.github.com/riverar) in
[https://github.com/microsoft/windows-rs/pull/3312](https://redirect.github.com/microsoft/windows-rs/pull/3312)
- Fix remaining `std` references in `windows` and `windows-core` crates
for `no_std` builds by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3317](https://redirect.github.com/microsoft/windows-rs/pull/3317)
- Bump cookie and express in /web/features by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/microsoft/windows-rs/pull/3318](https://redirect.github.com/microsoft/windows-rs/pull/3318)
- Fix nested struct sort order by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3321](https://redirect.github.com/microsoft/windows-rs/pull/3321)
- Update jsonschema requirement from 0.22 to 0.23 by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/microsoft/windows-rs/pull/3323](https://redirect.github.com/microsoft/windows-rs/pull/3323)
- Add `unwrap` helper for `NTSTATUS` by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3324](https://redirect.github.com/microsoft/windows-rs/pull/3324)
- Bump http-proxy-middleware from 2.0.6 to 2.0.7 in /web/features by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/microsoft/windows-rs/pull/3331](https://redirect.github.com/microsoft/windows-rs/pull/3331)
- Remove "implement" feature by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3333](https://redirect.github.com/microsoft/windows-rs/pull/3333)
- Update web workflow by
[@&#8203;riverar](https://redirect.github.com/riverar) in
[https://github.com/microsoft/windows-rs/pull/3344](https://redirect.github.com/microsoft/windows-rs/pull/3344)
- Update Windows metadata by
[@&#8203;riverar](https://redirect.github.com/riverar) in
[https://github.com/microsoft/windows-rs/pull/3342](https://redirect.github.com/microsoft/windows-rs/pull/3342)
- Bump cross-spawn from 7.0.3 to 7.0.6 in /web/features by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/microsoft/windows-rs/pull/3347](https://redirect.github.com/microsoft/windows-rs/pull/3347)
- fix: remove use of std in windows-strings h! macro by
[@&#8203;vthib](https://redirect.github.com/vthib) in
[https://github.com/microsoft/windows-rs/pull/3356](https://redirect.github.com/microsoft/windows-rs/pull/3356)
- Major `windows-bindgen` update by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3359](https://redirect.github.com/microsoft/windows-rs/pull/3359)
- Harden reg-free class activation by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3365](https://redirect.github.com/microsoft/windows-rs/pull/3365)
- Simpler bindings generation by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3367](https://redirect.github.com/microsoft/windows-rs/pull/3367)
- `windows-bindgen` should generate `no_std` bindings by default by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3366](https://redirect.github.com/microsoft/windows-rs/pull/3366)
- Prefer optional over convertible parameters by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3368](https://redirect.github.com/microsoft/windows-rs/pull/3368)
- Remove unused extensions by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3369](https://redirect.github.com/microsoft/windows-rs/pull/3369)
- Simpler code generation by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3370](https://redirect.github.com/microsoft/windows-rs/pull/3370)
- Update dependencies by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3374](https://redirect.github.com/microsoft/windows-rs/pull/3374)
- Simpler code gen for Boolean parameters by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3373](https://redirect.github.com/microsoft/windows-rs/pull/3373)
- Remap `BOOLEAN` to `bool` by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3376](https://redirect.github.com/microsoft/windows-rs/pull/3376)
- Avoid generating `transmute` for input value type parameter bindings
by [@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3377](https://redirect.github.com/microsoft/windows-rs/pull/3377)
- Fix macro docs by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3378](https://redirect.github.com/microsoft/windows-rs/pull/3378)
- Streamline error handling in `windows-bindgen` by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3379](https://redirect.github.com/microsoft/windows-rs/pull/3379)
- Improve WinRT event representation and testing by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3382](https://redirect.github.com/microsoft/windows-rs/pull/3382)
- Use `track_caller` to make debugging `bindgen` build script errors
easier by [@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3383](https://redirect.github.com/microsoft/windows-rs/pull/3383)
- `windows-bindgen` now uses `Ref` and `OutRef` for COM interface traits
by [@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3386](https://redirect.github.com/microsoft/windows-rs/pull/3386)
- Add static event test/sample for WinRT by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3389](https://redirect.github.com/microsoft/windows-rs/pull/3389)
- Verify param direction by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3390](https://redirect.github.com/microsoft/windows-rs/pull/3390)
- Ensure external references to static factories are generated correctly
by [@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3392](https://redirect.github.com/microsoft/windows-rs/pull/3392)
- Update `windows-bindgen` to support `unsafe_op_in_unsafe_fn` by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3393](https://redirect.github.com/microsoft/windows-rs/pull/3393)
- Make `Ref` work with more than just interface types by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3394](https://redirect.github.com/microsoft/windows-rs/pull/3394)
- Add PR preview deployments to web workflow by
[@&#8203;riverar](https://redirect.github.com/riverar) in
[https://github.com/microsoft/windows-rs/pull/3395](https://redirect.github.com/microsoft/windows-rs/pull/3395)
- Adjust web workflow to use gh-pages branch by
[@&#8203;riverar](https://redirect.github.com/riverar) in
[https://github.com/microsoft/windows-rs/pull/3397](https://redirect.github.com/microsoft/windows-rs/pull/3397)
- Streamline CRA deps and webpack config by
[@&#8203;riverar](https://redirect.github.com/riverar) in
[https://github.com/microsoft/windows-rs/pull/3396](https://redirect.github.com/microsoft/windows-rs/pull/3396)
- Address nightly clippy warnings about operator precedence by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3414](https://redirect.github.com/microsoft/windows-rs/pull/3414)
- Detect unsupported array parameters by
[@&#8203;iancormac84](https://redirect.github.com/iancormac84) in
[https://github.com/microsoft/windows-rs/pull/3402](https://redirect.github.com/microsoft/windows-rs/pull/3402)
- `cppwinrt` should consistently panic on failure by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3415](https://redirect.github.com/microsoft/windows-rs/pull/3415)
- Shorten sample crate names by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3416](https://redirect.github.com/microsoft/windows-rs/pull/3416)
- Use `track_caller` to make debugging `cppwinrt` build script errors
easier by [@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3417](https://redirect.github.com/microsoft/windows-rs/pull/3417)
- Fix provenance in direct32 sample by
[@&#8203;ChrisDenton](https://redirect.github.com/ChrisDenton) in
[https://github.com/microsoft/windows-rs/pull/3419](https://redirect.github.com/microsoft/windows-rs/pull/3419)
- Update web workflow to use external origin by
[@&#8203;riverar](https://redirect.github.com/riverar) in
[https://github.com/microsoft/windows-rs/pull/3420](https://redirect.github.com/microsoft/windows-rs/pull/3420)
- Avoid `transmute` where possible by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3421](https://redirect.github.com/microsoft/windows-rs/pull/3421)
- Update GitHub Actions runners by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3423](https://redirect.github.com/microsoft/windows-rs/pull/3423)
- Improve feature search UX, add dark mode, and update deps by
[@&#8203;riverar](https://redirect.github.com/riverar) in
[https://github.com/microsoft/windows-rs/pull/3422](https://redirect.github.com/microsoft/windows-rs/pull/3422)
- Release 0.61.0 by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3418](https://redirect.github.com/microsoft/windows-rs/pull/3418)

#### New Contributors

- [@&#8203;iancormac84](https://redirect.github.com/iancormac84) made
their first contribution in
[https://github.com/microsoft/windows-rs/pull/3402](https://redirect.github.com/microsoft/windows-rs/pull/3402)

**Full Changelog**:
https://github.com/microsoft/windows-rs/compare/0.60.0...0.61.0

###
[`v0.60.0`](https://redirect.github.com/microsoft/windows-rs/releases/tag/0.60.0)

[Compare
Source](https://redirect.github.com/microsoft/windows-rs/compare/0.59.0...0.60.0)

This release includes an update to the
[windows-registry](https://crates.io/crates/windows-registry) and
[windows-strings](https://crates.io/crates/windows-strings) crates,
mainly to provide various improvements to registry support for
[rustup](https://redirect.github.com/rust-lang/rustup).

#### What's Changed

- Add precise registry types and allocation-free queries and updates by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3184](https://redirect.github.com/microsoft/windows-rs/pull/3184)
- Add registry `Value` to/from `HSTRING` conversion by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3190](https://redirect.github.com/microsoft/windows-rs/pull/3190)
- Replace `From<&str>` for `GUID` with `TryFrom<&str>` by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3193](https://redirect.github.com/microsoft/windows-rs/pull/3193)
- Remove uneeded feature dependencies by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3201](https://redirect.github.com/microsoft/windows-rs/pull/3201)
- docs: add root level documentation for all libraries by
[@&#8203;Nerixyz](https://redirect.github.com/Nerixyz) in
[https://github.com/microsoft/windows-rs/pull/3202](https://redirect.github.com/microsoft/windows-rs/pull/3202)
- Cleanup doc testing by
[@&#8203;Nerixyz](https://redirect.github.com/Nerixyz) in
[https://github.com/microsoft/windows-rs/pull/3205](https://redirect.github.com/microsoft/windows-rs/pull/3205)
- Revert cfg doc by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3206](https://redirect.github.com/microsoft/windows-rs/pull/3206)
- Remove workaround for "unused" private fields by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3207](https://redirect.github.com/microsoft/windows-rs/pull/3207)
- Immutable Event implementation by
[@&#8203;lifers](https://redirect.github.com/lifers) in
[https://github.com/microsoft/windows-rs/pull/3198](https://redirect.github.com/microsoft/windows-rs/pull/3198)
- Always treat warnings as errors by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3210](https://redirect.github.com/microsoft/windows-rs/pull/3210)
- Consistent allocation failure handling by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3209](https://redirect.github.com/microsoft/windows-rs/pull/3209)
- Improve class hierarchy support by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3212](https://redirect.github.com/microsoft/windows-rs/pull/3212)
- Consistent allocation failure for stock collections by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3216](https://redirect.github.com/microsoft/windows-rs/pull/3216)
- Consistent allocation failure for `windows-registry` by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3215](https://redirect.github.com/microsoft/windows-rs/pull/3215)
- Add default "std" feature for `windows-registry` crate by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3214](https://redirect.github.com/microsoft/windows-rs/pull/3214)
- Overhaul async and future support by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3213](https://redirect.github.com/microsoft/windows-rs/pull/3213)
- Addressing new nightly Clippy warning by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3222](https://redirect.github.com/microsoft/windows-rs/pull/3222)
- Add async `ready` support by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3221](https://redirect.github.com/microsoft/windows-rs/pull/3221)
- Bump micromatch from 4.0.5 to 4.0.8 in /web/features by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/microsoft/windows-rs/pull/3223](https://redirect.github.com/microsoft/windows-rs/pull/3223)
- Add file dialog sample by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3226](https://redirect.github.com/microsoft/windows-rs/pull/3226)
- Use relative path for extension by
[@&#8203;glandium](https://redirect.github.com/glandium) in
[https://github.com/microsoft/windows-rs/pull/3224](https://redirect.github.com/microsoft/windows-rs/pull/3224)
- Simplify trait bounds for interface implementations by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3227](https://redirect.github.com/microsoft/windows-rs/pull/3227)
- Remove unnecessary closure from generated code by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3228](https://redirect.github.com/microsoft/windows-rs/pull/3228)
- Bump webpack from 5.90.2 to 5.94.0 in /web/features by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/microsoft/windows-rs/pull/3236](https://redirect.github.com/microsoft/windows-rs/pull/3236)
- Add async `spawn` support by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3235](https://redirect.github.com/microsoft/windows-rs/pull/3235)
- Nightly Clippy warning about assumed lifetime by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3243](https://redirect.github.com/microsoft/windows-rs/pull/3243)
- Regenerate GNU libs by
[@&#8203;riverar](https://redirect.github.com/riverar) in
[https://github.com/microsoft/windows-rs/pull/3241](https://redirect.github.com/microsoft/windows-rs/pull/3241)
- Add support for composable constructors by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3246](https://redirect.github.com/microsoft/windows-rs/pull/3246)
- Use workspace dependencies where practical by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3248](https://redirect.github.com/microsoft/windows-rs/pull/3248)
- Add test folders by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3252](https://redirect.github.com/microsoft/windows-rs/pull/3252)
- Improve interop testing by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3253](https://redirect.github.com/microsoft/windows-rs/pull/3253)
- Avoid deriving `Eq` for structs containing floating point type
parameters by [@&#8203;kennykerr](https://redirect.github.com/kennykerr)
in
[https://github.com/microsoft/windows-rs/pull/3255](https://redirect.github.com/microsoft/windows-rs/pull/3255)
- Add test for composable type authoring support by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3259](https://redirect.github.com/microsoft/windows-rs/pull/3259)
- Factory cache statics don't need to be public by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3261](https://redirect.github.com/microsoft/windows-rs/pull/3261)
- Allow `noexcept` methods in a composable hierarchy by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3262](https://redirect.github.com/microsoft/windows-rs/pull/3262)
- Group more of the WinRT tests together by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3263](https://redirect.github.com/microsoft/windows-rs/pull/3263)
- Remove "riddle" and metadata generation by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3266](https://redirect.github.com/microsoft/windows-rs/pull/3266)
- Improvements to `windows-metadata` by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3268](https://redirect.github.com/microsoft/windows-rs/pull/3268)
- We can now derive `Eq` and `PartialEq` for structs containing
callbacks by [@&#8203;kennykerr](https://redirect.github.com/kennykerr)
in
[https://github.com/microsoft/windows-rs/pull/3270](https://redirect.github.com/microsoft/windows-rs/pull/3270)
- Simpler "retval" heuristic by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3271](https://redirect.github.com/microsoft/windows-rs/pull/3271)
- Test error handling for `windows-bindgen` crate by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3272](https://redirect.github.com/microsoft/windows-rs/pull/3272)
- Exclude `web` on most workflows by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3279](https://redirect.github.com/microsoft/windows-rs/pull/3279)
- Bump serve-static and express in /web/features by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/microsoft/windows-rs/pull/3274](https://redirect.github.com/microsoft/windows-rs/pull/3274)
- Update jsonschema requirement from 0.18 to 0.19 by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/microsoft/windows-rs/pull/3283](https://redirect.github.com/microsoft/windows-rs/pull/3283)
- Move `VARIANT` support to the `windows` crate by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3282](https://redirect.github.com/microsoft/windows-rs/pull/3282)
- Update `jsonschema` dependency by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3286](https://redirect.github.com/microsoft/windows-rs/pull/3286)
- Expand `raw-dylib` testing by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3287](https://redirect.github.com/microsoft/windows-rs/pull/3287)
- Fix for `cppwinrt` concurrency issue by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3289](https://redirect.github.com/microsoft/windows-rs/pull/3289)
- Address Rust nightly compiler warnings by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3292](https://redirect.github.com/microsoft/windows-rs/pull/3292)
- Add `Deref` implementation for `HSTRING` by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3291](https://redirect.github.com/microsoft/windows-rs/pull/3291)
- Release 0.60.0 by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3293](https://redirect.github.com/microsoft/windows-rs/pull/3293)

#### New Contributors

- [@&#8203;lifers](https://redirect.github.com/lifers) made their first
contribution in
[https://github.com/microsoft/windows-rs/pull/3198](https://redirect.github.com/microsoft/windows-rs/pull/3198)

**Full Changelog**:
https://github.com/microsoft/windows-rs/compare/0.59.0...0.60.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
Automerge - At any time (no schedule defined).

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

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

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

---

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

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/astral-sh/uv).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yNTcuMyIsInVwZGF0ZWRJblZlciI6IjM5LjI1Ny4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbnRlcm5hbCJdfQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: konstin <konstin@mailbox.org>
2025-04-28 13:36:29 +02:00
samypr100
878497a014
Upgrade Rust toolchain to 1.85 (#11720)
## Summary

* Upgrade the rust toolchain to 1.85.0. This does not increase the MSRV.
* Update windows trampoline to 1.86 nightly beta (previously in 1.85
nightly beta).

## Test Plan

Existing tests
2025-02-23 16:52:34 +01:00
Aria Desires
161eb42cb9
don't use the Cool popup-generating eprintln in trampoline for warnings (#11295)
Also I refactored the code a bit to centralize all the calls of
eprintln.

Fixes #10706

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2025-02-07 13:33:12 -05:00
samypr100
4b658c4ede
chore: update trampoline windows crate to 0.59.0 (#10524)
## Summary

* Closes https://github.com/astral-sh/uv/pull/10515
* Bumps Rust Nightly to 1.85 Beta
* Removes old dev dependencies

## Test Plan

Existing tests.
Note, binaries need to be rebuilt for integrity before merging.

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2025-01-14 08:54:19 -06:00
renovate[bot]
ed5a53f01b
Update Rust crate thiserror to v2.0.11 (#10511) 2025-01-11 12:29:03 -05:00
renovate[bot]
c329623770
Update Rust crate thiserror to v2.0.9 (#10112) 2024-12-23 08:48:06 -05:00
renovate[bot]
4008e313bf
Update Rust crate which to v7.0.1 (#10113) 2024-12-23 08:47:36 -05:00
renovate[bot]
9e33658ba9
Update Rust crate anyhow to v1.0.95 (#10102) 2024-12-23 00:49:18 +00:00
renovate[bot]
34281d96f1
Update Rust crate thiserror to v2.0.7 (#9926) 2024-12-15 20:12:08 -05:00
renovate[bot]
b17902da0f
Update Rust crate thiserror to v2.0.6 (#9727)
Some checks are pending
CI / integration test | github actions (push) Blocked by required conditions
CI / Determine changes (push) Waiting to run
CI / lint (push) Waiting to run
CI / cargo test | ubuntu (push) Blocked by required conditions
CI / cargo test | macos (push) Blocked by required conditions
CI / cargo test | windows (push) Blocked by required conditions
CI / check windows trampoline | aarch64 (push) Blocked by required conditions
CI / build binary | windows (push) Blocked by required conditions
CI / cargo build (msrv) (push) Blocked by required conditions
CI / build binary | freebsd (push) Blocked by required conditions
CI / ecosystem test | prefecthq/prefect (push) Blocked by required conditions
CI / ecosystem test | pallets/flask (push) Blocked by required conditions
CI / integration test | free-threaded on windows (push) Blocked by required conditions
CI / integration test | pypy on ubuntu (push) Blocked by required conditions
CI / integration test | pypy on windows (push) Blocked by required conditions
CI / integration test | graalpy on ubuntu (push) Blocked by required conditions
CI / integration test | graalpy on windows (push) Blocked by required conditions
CI / check system | python on opensuse (push) Blocked by required conditions
CI / check system | python on rocky linux 8 (push) Blocked by required conditions
CI / check system | python on rocky linux 9 (push) Blocked by required conditions
CI / check system | pypy on ubuntu (push) Blocked by required conditions
CI / check system | pyston (push) Blocked by required conditions
CI / check system | python3.13 on windows (push) Blocked by required conditions
CI / check system | python3.12 via chocolatey (push) Blocked by required conditions
CI / check system | python3.9 via pyenv (push) Blocked by required conditions
CI / check system | python3.13 (push) Blocked by required conditions
CI / check system | conda3.11 on linux (push) Blocked by required conditions
CI / check system | amazonlinux (push) Blocked by required conditions
CI / check system | embedded python3.10 on windows (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
2024-12-09 01:15:25 +00:00
renovate[bot]
56c112f3a1
Update Rust crate anyhow to v1.0.94 (#9726) 2024-12-09 01:13:50 +00:00
renovate[bot]
dae630ae50
Update Rust crate fs-err to v3 (#8625) 2024-11-19 15:09:00 +00:00
renovate[bot]
312ae12650
Update Rust crate thiserror to v2 (#9006) 2024-11-15 09:54:16 -06:00
renovate[bot]
ce14207e2e
Update Rust crate anyhow to v1.0.93 (#8996) 2024-11-11 02:13:34 +00:00
renovate[bot]
a052418dcd
Update Rust crate which to v7 (#8794)
Some checks are pending
CI / cargo test | windows (push) Blocked by required conditions
CI / check windows trampoline | aarch64 (push) Blocked by required conditions
CI / check windows trampoline | i686 (push) Blocked by required conditions
CI / check windows trampoline | x86_64 (push) Blocked by required conditions
CI / test windows trampoline | i686 (push) Blocked by required conditions
CI / test windows trampoline | x86_64 (push) Blocked by required conditions
CI / typos (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / build binary | linux (push) Blocked by required conditions
CI / build binary | macos aarch64 (push) Blocked by required conditions
CI / build binary | macos x86_64 (push) Blocked by required conditions
CI / build binary | windows (push) Blocked by required conditions
CI / build binary | freebsd (push) Blocked by required conditions
CI / ecosystem test | prefecthq/prefect (push) Blocked by required conditions
CI / ecosystem test | pallets/flask (push) Blocked by required conditions
CI / integration test | conda on ubuntu (push) Blocked by required conditions
CI / integration test | free-threaded on linux (push) Blocked by required conditions
CI / integration test | free-threaded on windows (push) Blocked by required conditions
CI / integration test | pypy on ubuntu (push) Blocked by required conditions
CI / integration test | pypy on windows (push) Blocked by required conditions
CI / integration test | graalpy on ubuntu (push) Blocked by required conditions
CI / integration test | graalpy on windows (push) Blocked by required conditions
CI / check system | python3.9 via pyenv (push) Blocked by required conditions
CI / check system | python3.13 (push) Blocked by required conditions
CI / check system | conda3.11 on linux (push) Blocked by required conditions
CI / check system | conda3.8 on linux (push) Blocked by required conditions
CI / check system | conda3.11 on macos (push) Blocked by required conditions
CI / check system | conda3.8 on macos (push) Blocked by required conditions
CI / check system | embedded python3.10 on windows (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
2024-11-03 21:15:17 -05:00
renovate[bot]
15d003a65f
Update Rust crate thiserror to v1.0.67 (#8790) 2024-11-03 21:14:54 -05:00
renovate[bot]
a0cbf5d32b
Update Rust crate anyhow to v1.0.92 (#8787) 2024-11-03 21:14:31 -05:00
Zanie Blue
c335dc5e5d
Add a trampoline variant that just executes python (#8637)
Currently, our trampoline is used to convert `<command> [args]` to
`python <command> [args]` for script entrypoints installed into virtual
environments. For #8458, it'd be nice to convert a shim `python3.12
[args]` to `python [args]`. Here, we modify the trampolines to support
this use-case.

The only change we really need here is to avoid injecting `<command>`
into the child process. We change the "magic number" at the end of the
trampoline executables from `UVUV` to `UVSC` and `UVPY` which define
"script" and "python" variants to the trampoline. We then omit the
`<command>` injection in the latter case. We also omit writing the zip
script payload.

To support construction of the new variant, a new
`uv-trampoline-builder` crate is introduced — this avoids requirements
on `uv-install-wheel` in future work. I also use `uv-trampoline-builder`
to consolidate some of the test setup for `uv-trampoline`.

There should be no backwards compatibility concerns, since trampolines
are fully self-referential.

I rebased to fix the commits at the end, as this took many iterations to
get working via CI. This should roughly be reviewable by commit if you
prefer.
2024-10-29 09:21:15 -05:00
renovate[bot]
be92a2bbef
Update Rust crate thiserror to v1.0.65 (#8618) 2024-10-28 01:06:22 +00:00
renovate[bot]
0a83f957fb
Update Rust crate anyhow to v1.0.91 (#8612) 2024-10-27 20:56:33 -04:00
renovate[bot]
159b664f95
Update Rust crate anyhow to v1.0.90 (#8395) 2024-10-21 00:10:22 +00:00
Amos Wenger
715f28fd39
chore: Move all integration tests to a single binary (#8093)
As per
https://matklad.github.io/2021/02/27/delete-cargo-integration-tests.html

Before that, there were 91 separate integration tests binary.

(As discussed on Discord — I've done the `uv` crate, there's still a few
more commits coming before this is mergeable, and I want to see how it
performs in CI and locally).
2024-10-11 16:41:35 +02:00
renovate[bot]
ab2bba285e
Update Rust crate thiserror to v1.0.64 (#7630) 2024-09-22 22:33:03 -04:00
renovate[bot]
400543133f
Update Rust crate anyhow to v1.0.89 (#7628) 2024-09-22 21:01:24 -04:00
Charlie Marsh
c87ce7aaf8
Run cargo upgrade (#7448)
Co-authored-by: konstin <konstin@mailbox.org>
2024-09-17 12:39:58 +02:00
samypr100
66699def2e
fix: adjust close_handles pointer offsets to match distlib cleanup_fds (#6955)
## Summary

Resolves issues mentioned in comments
* https://github.com/astral-sh/uv/issues/6699#issuecomment-2322515962
* https://github.com/astral-sh/uv/issues/6866#issuecomment-2322785906

Further investigation on the comments revealed that the pointer
arithmethic being performed in `let handle_start = unsafe {
crt_magic.offset(1 + handle_count) };` from [posy
trampoline](dda22e6f90/src/trampolines/windows-trampolines/posy-trampoline/src/bounce.rs (L146))
had some slight errors. Since `crt_magic` was a `*const u32`, doing an
offset by `1 + handle_count` would offset by too much, with some
possible out of bounds reads or attempts to call CloseHandle on garbage.

We needed to offset differently since we want to offset by
`handle_count` bytes after the initial offset as seen in
[launcher.c](888c48b568/PC/launcher.c (L578)).
Similarly, we needed to skip the first 3 handles, otherwise we'd still
be attempting to close standard I/O handles of the parent (in this case
the shell from `busybox.exe sh -l`).

I also added a few extra checks available from `launcher.c` which checks
if the handle value is `-2` just to match the distlib implementation
more closely and minimize differences.

## Test Plan

Manually compiled distlib's launcher with additional logging and
replaced `Lib/site-packages/pip/_vendor/distlib/t64.exe` with the
compiled one to log pointers. As a result, I was able to verify the
retrieved handle memory addresses in this function actually match in
both uv and distlib's implementation from within busybox.exe nested
shell where this behavior can be observed and manually tested.

I was also able to confirm this fixes the issues mentioned in the
comments, at least with busybox's shell, but I assume this would fix the
case with cmake.

## Open areas

`launcher.c` also [checks the
size](888c48b568/PC/launcher.c (L573-L576))
of `cbReserved2` before retrieving `handle_start` which this function
currently doesn't do. If we wanted to, we could add the additional check
here as well, but I wasn't fully sure why it wasn't added in the first
place. Thoughts?

```rust
// Verify the buffer is large enough
if si.cbReserved2 < (size_of::<u32>() as isize + handle_count + size_of::<HANDLE>() as isize * handle_count) as u16 {
    return;
}
```

---------

Co-authored-by: konstin <konstin@mailbox.org>
2024-09-04 13:31:57 +02:00
samypr100
8674968a17
fix: adjust trampoline close_handles invalid to be safer (#6792)
## Summary

Closes https://github.com/astral-sh/uv/issues/6699

On cases like the ones described in
https://github.com/astral-sh/uv/issues/6699, `lpReserved2` somehow seems
to report multiple file descriptors that were not tied to any valid
handles. The previous implementation was faulting as it would try to
dereference these invalid handles. This change moves to using `HANDLE`
directly and check if its is_invalid instead before attempting to close
them.

## Test Plan

Manually tested and verified using `busybox-w32` like described in the
issue.

---------

Co-authored-by: konstin <konstin@mailbox.org>
2024-08-30 08:55:27 +00:00
Charlie Marsh
0dc74f619c
Remove path-absolutize dependency (#6589)
## Summary

This is now in the standard library.
2024-08-25 12:01:07 +00:00
renovate[bot]
8a48f755d1
Update Rust crate which to v6.0.3 (#6193) 2024-08-19 02:31:05 +00:00
renovate[bot]
5d4ff4341e
Update Rust crate dunce to v1.0.5 (#6019) 2024-08-12 01:25:55 +00:00
renovate[bot]
8cd624f26e
Update Rust crate assert_cmd to v2.0.16 (#6017) 2024-08-12 01:23:46 +00:00
samypr100
2cd63f06dc
feat: more rust in trampoline (#5750)
## Summary

This is an experimental PR to replace more unsafe calls with more rust
while still trying to keep the binary size small enough. These changes
roughly increase the size of the trampolines to about 40kb~. This is a
alternate PR to https://github.com/astral-sh/uv/pull/5751.

The primary changes here include
* Switch to use rust path components for ease of path management
* Leverage `std::process::exit` for process exit and cleanup
* Use `std::io::Error::last_os_error` for IO Errors to remove
`FormatMessage` complexity
* Use `std::env::current_exe` to get the current executable instead of
`GetModuleFileNameA`

## Test Plan

Added one more existing test case to trampoline tests.
Still need to verify dunce::canonicalize is desired or not on
find_python_exe.

---------

Co-authored-by: konstin <konstin@mailbox.org>
2024-08-07 08:19:38 +00:00
renovate[bot]
77141464fe
Update Rust crate which to v6.0.2 (#5779) 2024-08-05 01:08:55 +00:00
konsti
db371560bc
Use prettier to format the documentation (#5708)
To enforce the 100 character line limit in markdown files introduced in
https://github.com/astral-sh/uv/pull/5635, and to automate the
formatting of markdown files, i've added prettier and formatted our
markdown files with it.

I've excluded the changelog and the generated references documentation
from this for having too many changes, but we can also include them.

I'm not particular on which style we use. My main motivations are
(major) not having to reflow markdown files myself anymore and (minor)
consistence between all markdown files. I've chosen prettier for similar
reason as we chose black, it's a single good style that's automated and
shared in the community. I do prefer prettier's style of not breaking
inside of a link name though.

This PR is in two parts, the first adds prettier to CI and documents
using it, while the second actually formats the docs. When merge
conflicts arise, we can drop the last commit and regenerate it with `npx
prettier --prose-wrap always --write BENCHMARKS.md CONTRIBUTING.md
README.md STYLE.md docs/*.md docs/concepts/**/*.md docs/guides/**/*.md
docs/pip/**/*.md`.

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-08-02 08:58:31 -05:00
Charlie Marsh
24859bd3ee
Upgrade to Rust 1.80.0 (#5472) 2024-07-27 01:49:47 +00:00
samypr100
166fe85bb7
feat: fix uv-trampoline renovate issues (#5204)
## Summary

1. Fixes errors from https://github.com/astral-sh/uv/pull/4878
2. More cleanup. Removed the need for `MaybeUninit` and `SizeOf`
helpers. Renamed main entrypoint to expected default in windows
`mainCRTStartup` to avoid re-declaring /ENTRY in build.rs.
3. Adds a small basic test harness that >>on windows<< will generate
both types of launchers and run them. I've had been using this locally
to test changes and edge cases, but it might be useful for others. It's
based on core parts of install-wheel-rs.

## Test Plan

Tested locally on a couple of script/gui apps.

---------

Co-authored-by: konsti <konstin@mailbox.org>
2024-07-23 10:12:28 +02:00
Charlie Marsh
ed9b820815
Remove trailing period from user-facing messages (#5218)
## Summary

Per #5209, we only show periods in messages when the message itself
spans more than a single sentence.
2024-07-19 10:43:49 -04:00
konsti
1a31938626
Update windows binaries, again (#4864)
https://github.com/astral-sh/uv/pull/4850#issuecomment-2212557050
2024-07-07 18:58:22 -04:00
konsti
7117359ca9
Update trampolines (#4850)
Follow-up to https://github.com/astral-sh/uv/pull/4722
2024-07-06 21:06:48 +00:00
samypr100
eee90a340c
feat: re-enable std in uv-trampoline (#4722)
## Summary

Partially closes #1917

This PR picks up on some of the great work from #1864 and opted to keep
`panic_immediate_abort` (for size reasons). I split the PR in different
isolated commits in case we want to separate/cherry-pick them out.

1. The first commit ports mostly all std changes from that PR into this
PR. Binary sizes stayed the same ~16kb.
2. The second commit migrates our existing usage of windows-sys to
windows for a safer ffi calls with Results!. It also changes all large
unsafe blocks to be isolated to the actual unsafe calls, and switches
some areas to use std such as getenv port ( which seemed buggy! ) from
launcher.c. In addition, this also adds more error checking in order to
match some missing assertions from distlib's launcher.c. Note, due to
the additional .text data, the binary sizes increased to ~20.5kb, but we
can cut back on some of the added error msgs as needed.
3. The third commit switches to using xwin for building on all 3
supported trampoline targets for sanity, and adds a CI bloat check for
core::fmt and panic as a precaution. Sadly, this will invalidate the
xwin cache on the first run.

## Test Plan

Most changes were tested on a couple of local GUI apps and console apps,
also tested some of the error states manually by using SetLastError at
different points in the code and/or passing in invalid handles.

I'm not sure how far we can get with migrating some of the other calls
without increasing binary size substantially. An initial attempt at
using std::path didn't seem so bad size wise when I tried it (~1k). On
other cases, such as std::process::exit added ~10k to the total binary
size.

---------

Co-authored-by: konstin <konstin@mailbox.org>
2024-07-06 20:38:45 +00:00
konsti
f92447772e
Support x86 windows (#3873)
Add trampolines for x86 windows.

Closes https://github.com/astral-sh/uv/issues/3660.
2024-05-28 16:07:39 +00:00
Charlie Marsh
d912c37539
Add instructions for building and updating uv-trampolines (#3731) 2024-05-21 22:49:14 -04:00
Ofek Lev
82820d0f4c
Allow relative Python executable paths in Windows trampoline (#3717)
## Summary

This is a prerequisite for https://github.com/astral-sh/uv/issues/3669

## Test Plan

Download one of the standalone distributions on Windows then use its
Python to run the following script and then run the scripts it creates
(only pip):

```python
from __future__ import annotations

import sys
import sysconfig
from contextlib import closing
from importlib.metadata import entry_points
from io import BytesIO
from os.path import relpath
from pathlib import Path
from tempfile import TemporaryDirectory
from zipfile import ZIP_DEFLATED, ZipFile, ZipInfo

# Change this line to your real path
LAUNCHERS_DIR = Path('C:\\Users\\ofek\\Desktop\\code\\uv\\crates\\uv-trampoline\\target\\x86_64-pc-windows-msvc\\release')
SCRIPT_TEMPLATE = """\
#!{executable}
# -*- coding: utf-8 -*-
import re
import sys
from {module} import {import_name}
if __name__ == "__main__":
    sys.argv[0] = re.sub(r"(-script\\.pyw|\\.exe)?$", "", sys.argv[0])
    sys.exit({function}())
"""


def select_entry_points(ep, group):
    return ep.select(group=group) if sys.version_info[:2] >= (3, 10) else ep.get(group, [])


def main():
    interpreters_dir = Path(sys.executable).parent
    scripts_dir = Path(sysconfig.get_path('scripts'))

    ep = entry_points()
    for group, interpreter_name, launcher_name in (
        ('console_scripts', 'python.exe', 'uv-trampoline-console.exe'),
        ('gui_scripts', 'pythonw.exe', 'uv-trampoline-gui.exe'),
    ):
        interpreter = interpreters_dir / interpreter_name
        relative_interpreter_path = relpath(interpreter, scripts_dir)
        launcher_data = (LAUNCHERS_DIR / launcher_name).read_bytes()

        for script in select_entry_points(ep, group):
            # https://github.com/astral-sh/uv/tree/main/crates/uv-trampoline#how-do-you-use-it
            with closing(BytesIO()) as buf:
                # Launcher
                buf.write(launcher_data)

                # Zipped script
                with TemporaryDirectory() as td:
                    zip_path = Path(td) / 'script.zip'
                    with ZipFile(zip_path, 'w') as zf:
                        # Ensure reproducibility
                        zip_info = ZipInfo('__main__.py', (2020, 2, 2, 0, 0, 0))
                        zip_info.external_attr = (0o644 & 0xFFFF) << 16

                        module, _, attrs = script.value.partition(':')
                        contents = SCRIPT_TEMPLATE.format(
                            executable=relative_interpreter_path,
                            module=module,
                            import_name=attrs.split('.')[0],
                            function=attrs
                        )
                        zf.writestr(zip_info, contents, compress_type=ZIP_DEFLATED)

                    buf.write(zip_path.read_bytes())

                # Interpreter path
                interpreter_path = relative_interpreter_path.encode('utf-8')
                buf.write(interpreter_path)

                # Interpreter path length
                interpreter_path_length = len(interpreter_path).to_bytes(4, 'little')
                buf.write(interpreter_path_length)

                # Magic number
                buf.write(b'UVUV')

                script_data = buf.getvalue()

            script_path = scripts_dir / f'{script.name}.exe'
            script_path.write_bytes(script_data)


if __name__ == '__main__':
    main()
```
2024-05-21 21:53:15 -04:00
konsti
2375008cc1
Use c-string literals and update trampolines (#2590)
Rust 1.77 has stabilized c-string literals (`c"<string>"`):
https://doc.rust-lang.org/nightly/edition-guide/rust-2021/c-string-literals.html.
This PR replaces the usages of the custom c-string literal macro in the
trampoline with the new syntax.
2024-03-21 15:36:00 +00:00
Micha Reiser
12a96ad422
Win Trampoline: Use Python executable path encoded in binary (#1803) 2024-02-22 16:10:02 +01:00
Micha Reiser
b296c04a67
Add CMD support (#1523)
## Sumamry

This PR adds the `activation.bat`, `deactivation.bat` and `pyenv.bat`
files to add support for using uv from CMD.

This PR further fixes an issue with our trampoline implementation where
calling an executable like `black` failed:

```
(venv) C:\Users\Micha\astral\test>where black
C:\Users\Micha\astral\test\.venv\Scripts\black.exe

(venv) C:\Users\Micha\astral\test>black
C:\Users\Micha\AppData\Local\Programs\Python\Python312\python.exe: can't open file 'C:\\Users\\Micha\\astral\\test\\black': [Errno 2] No such file or directory
```

The issue was that CMD doesn't extend `black` to its full path before
passing it to the trampoline and our trampoline generated the command
`<python> black` instead of `<python> .venv/Scripts/black`, and Python
can't find `black` in the project directory.

This PR fixes this by using the full executable name (that we already
parsed out to discover the Python version). This adds one complication,
we need to preserve the arguments without repeating the executable name
that is the first argument.
One option is to use
[`CommandLineToArgvW`](https://learn.microsoft.com/de-de/windows/win32/api/shellapi/nf-shellapi-commandlinetoargvw)
and then serialize the arguments 1.. to a string again. I decided
against that. Win32 API calls are easy to get wrong. That's why I
implemented the parsing rules specified in
[`CommandLineToArgvW`](https://learn.microsoft.com/de-de/windows/win32/api/shellapi/nf-shellapi-commandlinetoargvw)
to skip the first argument.

Fixes https://github.com/astral-sh/uv/issues/1471

## Test Plan


bdb537b6-97c8-4f7e-bb4a-3a614eb5e0f6

Powershell continues to work


6c806477-a7c6-4047-9ffc-5ed91c6f1c84

I haven't been able to test the aarch binaries.
2024-02-17 16:47:40 -05:00