Commit Graph

119 Commits

Author SHA1 Message Date
sobolevn ff1a896dd0
Ignore `UV_CACHE_DIR` in `help` tests (#7895) 2024-10-04 09:41:25 -05:00
samypr100 c708cc82fa
chore(ci): bump macos-12 intel runner to macos-13 intel runner (#7877)
## Summary

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

This is not breaking since `MACOSX_DEPLOYMENT_TARGET` will stay the same
(currently defaulting to 10.12) so a
`uv-x.y.z-py3-none-macosx_10_12_x86_64.whl` will still be built
2024-10-03 13:00:58 +01:00
Charlie Marsh 14507a1793
Add `uv-` prefix to all internal crates (#7853)
## Summary

Brings more consistency to the repo and ensures that all crates
automatically show up in `--verbose` logging.
2024-10-01 20:15:32 -04:00
konsti da328379c1
Don't show deploy notification when we don't need to (#7665) 2024-09-24 19:42:13 +02:00
konsti 205bf8cabe
Implement trusted publishing (#7548)
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2024-09-24 16:07:20 +00:00
konsti 1995d20298
Add `uv publish`: Basic upload with username/password or keyring (#7475)
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2024-09-24 15:33:06 +00:00
Bas Schoenmaeckers 77c2496f47
Allow creating venv with free-threaded python builds (#7431)
<!--
Thank you for contributing to uv! To help us out with reviewing, please
consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

closes #4828

First iteration for an implementation. I need to add more tests but
wanted your opinion on the implementation first.

<!-- What's the purpose of the change? What does it do, and why? -->

## Test Plan
Currently tested using the following command but will add tests shortly:

```console
D:\repo\uv> cargo run venv -p 3.13t && .venv\Scripts\python.exe
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.52s
     Running `target\debug\uv.exe venv -p 3.13t`
Using Python 3.13.0rc1 interpreter at: C:\Users\bschoen\AppData\Local\Programs\Python\Python313\python3.13t.exe
Creating virtualenv at: .venv
Activate with: .venv\Scripts\activate
Python 3.13.0rc1 experimental free-threading build (tags/v3.13.0rc1:e4a3e78, Jul 31 2024, 21:06:58) [MSC v.1940 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> 
```

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-09-23 17:36:16 -05:00
Zanie Blue 398f13824e
Add integration test for `UV_PROJECT_ENVIRONMENT` (#7591)
[Example](https://github.com/astral-sh/uv/actions/runs/10963662204/job/30445673572?pr=7591)

Test for #7585
2024-09-20 14:03:42 -05:00
bluss 7a25a82fc9
Move uvx shell completion to uvx --generate-shell-completion (#7511)
## Summary

Because a problem was found with Powershell and combining the generated
completion scripts for uv and uvx, let's try separating uv and uvx
command completion scripts.

The generated powershell script template can be seen in clap_complete
source, and it starts with `using` directives, which makes it impossible
(apparently) to concatenate two of those script outputs.

As a side effect, this is available under `uv tool run
--generate-shell-completion` too.

Fixes #7482

## Test Plan

- `eval "$(cargo run --bin uvx -- --generate-shell-completion bash)"`
- Test Powershell
2024-09-20 01:27:25 +00:00
konsti 4fdf5fc73f
Use a single lint task in CI (#7540) 2024-09-19 13:32:08 +02:00
Zanie Blue 4611412757
Allow Python pre-releases to be used if they are first on the `PATH` (#7470)
Closes https://github.com/astral-sh/uv/issues/7469
2024-09-18 10:19:10 -05:00
Charlie Marsh c87ce7aaf8
Run `cargo upgrade` (#7448)
Co-authored-by: konstin <konstin@mailbox.org>
2024-09-17 12:39:58 +02:00
Zanie Blue f22e5ef69a
Avoid selecting prerelease Python installations without opt-in (#7300)
Similar to our semantics for packages with pre-release versions.

We will not use prerelease versions unless there are only prerelease
versions available, a specific version is requested,
or the prerelease version is found in a reasonable source (active
environment, explicit path, etc. but not `PATH`).

For example, `uv python install 3.13 && uv run python --version` will no
longer use `3.13.0rc2` unless that is the only Python version available,
`--python 3.13` is used, or that's the Python version that is present in
`.venv`.
2024-09-11 15:49:33 -05:00
Zanie Blue ebd73d83f8
Allow explicitly requesting an system interpreter version in `check_system_python` (#7306)
Needed for #7300
2024-09-11 19:41:42 +00:00
Zanie Blue d7ec546e71
Add Python 3.13 system test for Linux (#7302)
Previously we only had coverage on Windows

e.g. for more test coverage in cases like
https://github.com/astral-sh/uv/pull/7300#discussion_r1755343870

I picked Linux over macOS because the 3.13 prereleases are not available
via HomeBrew?
2024-09-11 14:25:09 -05:00
Ibraheem Ahmed 4f03d204df
Run benchmarks with `--profile profiling` (#5927)
## Summary

The CodSpeed flamegraphs are currently useless after
https://github.com/astral-sh/uv/pull/5745.
2024-09-10 14:25:53 -04:00
renovate[bot] ea0a0db7a7
Update fedora Docker tag to v42 (#6924) 2024-09-02 14:01:51 -04:00
Mathieu Kniewallner fe5f085299
chore: run `cargo dev generate-all` on CI and locally (#6899)
## Summary

Noticed that running `cargo dev generate-all` on `main` produced changes
and saw that that the command is not run on the CI nor as a pre-commit
hook.

Not sure if having the command running as a pre-commit hook is something
we want, so I can remove it if you prefer. I find that nice to have as
it's probably easy to forget to run it, especially for new contributors
(and it will only run if there are changes in `uv_cli` or `uv_settings`
crates).

## Test Plan

- Added `cargo dev generate-all --mode check` on the CI, which produced
[this failing
job](https://github.com/astral-sh/uv/actions/runs/10648055597/job/29516699393)
- Ran `cargo dev generate-all` locally and committed the changes, which
produced [this succeeding
job](https://github.com/astral-sh/uv/actions/runs/10648076910/job/29516744942)
2024-08-31 19:03:53 -04:00
Amos Wenger 3e207da3bc
ci(windows): Introduce setup-dev-drive.ps1, maximize dev drive usage (#6858)
As suggested by @samypr100 on #6680:
https://github.com/astral-sh/uv/pull/6680#issuecomment-2313607984

## Summary

Instead of using `UV_INTERNAL__TEST_DIR`, it simply exports `TEMP` when
running Windows jobs.

## Test Plan

I'm going to run this manually under ProcMon on my Windows machine and
see where uv writes temp files, hopefully to the dev drive and not
`%(LOCAL)APPDATA%` or something.

I'm going to commit a dummy code change and look at build time changes
in CI.
2024-08-30 08:54:25 -04:00
Zanie Blue c730530b4e
Add timeouts to all of the CI jobs (#6769)
Noticed
https://github.com/astral-sh/uv/actions/runs/10601946253/job/29382920849?pr=6767
hung. This seems like best practice.
2024-08-28 18:57:22 +00:00
Zanie Blue b9d027b67a
Use `uvx` for Python linting in CI (#6771) 2024-08-28 13:54:34 -05:00
Amos Wenger 2c5cc62106
ci: Make Windows tests ~27% faster by putting temp folder in dev drive (#6680)
## Summary

This PR makes `cargo test | windows` faster in CI.

### Before

![Windows tests take
5m44s](https://github.com/user-attachments/assets/8dd9c619-9b7b-4ebd-a027-56e7967b6d34)

### After

![Windows tests take
5m12s](https://github.com/user-attachments/assets/7702fdba-3034-4db8-b211-85207a1feffa)

## Also

This PR disables the `brotli` feature of `async-compression` since it's
not strictly needed, but this has little to do with the improvements
(it's still less code to build).

This PR introduces additional code in uv tool uninstall to ignore errors
(that only seem to happen on ReFS, ie. on Dev Drives) akin to "the thing
we're trying to delete cannot be deleted because it's already being
deleted".

If `raw_os_error` was stable we could do u32 matching instead of that
`.to_string().contains()` abomination.
2024-08-27 15:25:05 -05:00
Zanie Blue 6d38d42b41
Always run both public and private documentation checks (#6707)
Avoiding failures like https://github.com/astral-sh/uv/pull/6705

Context in https://github.com/astral-sh/uv/pull/6099

## Test plan

Even though I opened the pull request, the public build was still
tested.
2024-08-27 17:35:43 +00:00
renovate[bot] b68406bb56
Update tj-actions/changed-files action to v45 (#6632) 2024-08-25 22:12:03 -04:00
Zanie Blue f9348a6ea3
Run tests when `docs/reference` generated files change (#6551)
Short-term fix for https://github.com/astral-sh/uv/issues/6352
2024-08-23 17:35:53 -05:00
Andrew Gallant b9ff03d73c ci: increase dev drive size
For working around linked errors:
https://github.com/astral-sh/uv/actions/runs/10371457087/job/28711821180?pr=5887
2024-08-13 08:35:46 -07:00
Ibraheem Ahmed ddb82a01c8
Add basic universal benchmarks to CI (#5938)
## Summary

Resolves https://github.com/astral-sh/uv/issues/4921.
2024-08-09 12:52:28 -04:00
Zanie Blue e9dd4876b8
Skip git tests on Windows (#5891)
Might be pushing it on test coverage, but these are some of our slowest
tests we might get a significant speedup here.

Part of #5713
2024-08-08 10:37:24 -05:00
Zanie Blue 7523673f39
Setup Rust after restoring the cache (#5892)
This saves about 10-20s

Part of #5713
2024-08-07 16:33:12 -05:00
Zanie Blue 858d75d0af
Use a larger runner for Linux test jobs (#5883)
From 8 to 16 cores, 32 to 64 GB RAM for a 2x per minute cost increase.

As in:

- #5874 
- #5873
2024-08-07 18:39:31 +00:00
Zanie Blue c77f213acd
Use a larger runner for macOS test jobs (#5874)
From 3 to 6 (+8 GPU) cores, 7 to 14 GB ram.

Related:
- https://github.com/astral-sh/uv/pull/5873
2024-08-07 12:32:08 -05:00
Zanie Blue 8dad1ac2d4
Use a larger runner for Windows test jobs (#5873)
From 8 to 16 cores, 32 to 64 GB ram. Testing on Windows first because
it's the bottleneck.

Previously tested in #2515 to no effect, maybe better now that we have a
development drive?
2024-08-07 12:31:59 -05: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
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
Zanie Blue c558d70690
Install Python versions with previous uv release (#5717)
Part of https://github.com/astral-sh/uv/issues/5713

Shaves 50s or ~25% off the Ubuntu test run. Maybe 30s or 8% off macOS.
Windows already uses the GitHub distributions.

Note this is some of our only test coverage for Python version installs,
we may want to add separate coverage to compensate.
2024-08-01 18:59:28 -05:00
renovate[bot] 8f378ec2c9
Update CodSpeedHQ/action action to v3 (#5549)
=
2024-07-29 10:03:04 -04:00
konsti 2452314f20
Add exclude-newer to benches case priming (#5554)
Uses the same cutoff that the benchmark itself uses
2024-07-29 13:48:38 +02:00
konsti 78be9a6a6b
Add trampoline tests to CI (#5331)
Add the tests added in #5204 to CI. The crate is not part of the
workspace (it requires nightly) and is windows only, so we have to test
it separately.

---------

Co-authored-by: samypr100 <3933065+samypr100@users.noreply.github.com>
2024-07-29 11:43:50 +02:00
Jo 7ddf67a72b
Add PyPy finder (#5337)
## Summary

This PR adds PyPy finder and adds PyPy to uv managed Python versions.

## Test Plan

```console
$ cargo run -- python install
```
2024-07-23 14:58:04 -05:00
Jo 43084249ee
Add mypy type check for uv-python scripts (#5332)
## Summary

Per https://github.com/astral-sh/uv/pull/4853#issuecomment-2212505407

> If we're going to aim for full type coverage, we should probably
follow this by adding type checking in CI too otherwise it seems too
easy for it to become out of date.
2024-07-23 09:14:05 -05:00
Zanie Blue 6492f1a897
A bundle of documentation changes (#5239)
I just need to iterate on everything and we're not doing a lot of
reviews anyway.

Closes #5234 
Closes #5191
2024-07-22 17:15:11 +00:00
Tim Felgentreff 24a0268675
Add GraalPy support (#5141)
<!--
Thank you for contributing to uv! To help us out with reviewing, please
consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

Currently, `uv` refuses to install anything on GraalPy. This is
currently blocking GraalPy testing with cibuildwheel, since manylinux
includes both `uv` and `graalpy` (but doesn't test with `uv`), whereas
cibuildwheel defaults to `uv`. See e.g.
https://github.com/pypa/cibuildwheel/actions/runs/9956369360/job/27506182952?pr=1538
where it gives
```
      + python -m build /project/sample_proj --wheel --outdir=/tmp/cibuildwheel/built_wheel --installer=uv
  * Creating isolated environment: venv+uv...
  * Using external uv from /usr/local/bin/uv
  * Installing packages in isolated environment:
    - setuptools >= 40.8.0
  > /usr/local/bin/uv pip install "setuptools >= 40.8.0"
  < error: Unknown implementation: `graalpy`
```

## Test Plan

I simply based the GraalPy support on PyPy and added some small tests.
I'm open to discussing how to test this. GraalPy is available for
manylinux images and with setup-python, so we should be able to add
tests against it to the CI. I locally confirmed by installing `uv` into
a GraalPy venv and then trying things like `uv pip install Pillow` and
testing those extensions.
2024-07-18 19:28:28 -05:00
Charlie Marsh f74235bb56
Validate docs in CI (#5158)
## Summary

Closes https://github.com/astral-sh/uv/issues/5155.
2024-07-17 14:14:04 -04:00
Silvano Cerza 0b106908aa
Add job to test PyPy venv creation on Windows (#5079)
## Summary

This PR adds a new job to test that PyPy venvs are correctly created on
Windows and they contain all the expected binaries.

## Test Plan

Just let CI run.
2024-07-15 16:20:19 -05:00
Silvano Cerza c2ef825d7b
Add `pypy` executables when calling `uv venv` (#5047)
## Summary

Should fix #2092.

This PR changes `uv venv` so it also creates symlinks to `pypy` on Unix
and copies executables on Windows when creating a new environment using
PyPy.

I found a bit of discrepancy between creation of a venv using `python`
and `uv`, as using `python` brings all the executables with it. While
`uv` brings only those without any version number, at least on Windows.
The behaviour is different on Unix as we take the versioned symlinks
too.

Some examples below.

`python -m venv` generates the following `Scripts` folder.
```
Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         7/14/2024     15:41           2031 activate
-a----         7/14/2024     15:41           1029 activate.bat
-a----         7/14/2024     15:41           9033 Activate.ps1
-a----         7/14/2024     15:41            393 deactivate.bat
-a----         7/14/2024     15:40          27648 libffi-8.dll
-a----         7/14/2024     15:41       44290560 libpypy3.10-c.dll
-a----         7/14/2024     15:41         108424 pip.exe
-a----         7/14/2024     15:41         108424 pip3.10.exe
-a----         7/14/2024     15:41         108424 pip3.exe
-a----         7/14/2024     15:41          79360 pypy.exe
-a----         7/14/2024     15:41          79360 pypy3.10.exe
-a----         7/14/2024     15:41          79360 pypy3.10w.exe
-a----         7/14/2024     15:41          79360 pypy3.exe
-a----         7/14/2024     15:41          79360 pypyw.exe
-a----         7/14/2024     15:41          79360 python.exe
-a----         7/14/2024     15:41          79360 python3.10.exe
-a----         7/14/2024     15:41          79360 python3.exe
-a----         7/14/2024     15:41          79360 pythonw.exe
```

`uv venv` instead generates this. 
```
-a----         7/14/2024     16:27           3360 activate
-a----         7/14/2024     16:27           2251 activate.bat
-a----         7/14/2024     16:27           2627 activate.csh
-a----         7/14/2024     16:27           4191 activate.fish
-a----         7/14/2024     16:27           3875 activate.nu
-a----         7/14/2024     16:27           2766 activate.ps1
-a----         7/14/2024     16:27           2378 activate_this.py
-a----         7/14/2024     16:27           1728 deactivate.bat
-a----         7/13/2024     19:19          27648 libffi-8.dll
-a----         7/13/2024     19:19       44290560 libpypy3.10-c.dll
-a----         7/14/2024     16:27           1215 pydoc.bat
-a----         7/13/2024     19:19          79360 pypy.exe
-a----         7/13/2024     19:19          79360 pypyw.exe
-a----         7/13/2024     19:19          79360 python.exe
-a----         7/13/2024     19:19          79360 pythonw.exe
```

## Test Plan

To verify the correct behaviour:

1. Download and install PyPy from [official
website](https://www.pypy.org/download.html)
2. Call `uv venv -p <path_to_pypy_>`
3. Run `.\.venv\Scripts\activate` on Windows or
`./.venv/Scripts/activate` on Unix
4. Run `pypy`

I thought of writing some automated tests but I couldn't rely on `uv
python install` command to install PyPy as it's not in the list of
installable Python builds.
2024-07-15 13:28:31 -05:00
Zanie Blue 09ae7a93d1
Add integration test for PyPy (#5048) 2024-07-15 11:11:51 -05:00
Charlie Marsh b629ab89c5
Set absolute URLs prior to uploading to PyPI (#5038)
## Summary

Closes https://github.com/astral-sh/uv/issues/5030.
2024-07-13 17:29:21 +00:00
Jo 4bdcec9622
Fix Fedora system test (#5034)
Seems like the latest
[`fedora:41`](https://hub.docker.com/layers/library/fedora/rawhide/images/sha256-c037a87094660ceda037ee319b17f59559241d2a3580d1d0f414e72b0a8f3827?context=explore)
(pushed at Jul 12, 2024 at 22:05 UTC) docker image has removed the
`python3` package, causing our current [CI
failure](https://github.com/astral-sh/uv/actions/runs/9917708846/job/27401528178).
2024-07-13 10:25:03 -05:00
Ibraheem Ahmed a4e9b63d5b
Fix benchmarks CI job (#5023) 2024-07-12 17:57:12 -04:00
Ibraheem Ahmed aff9c9bd91
Switch to Current-Thread Tokio Runtime (#4934)
## Summary

Move completely off tokio's multi-threaded runtime. We've slowly been
making changes to be smarter about scheduling in various places instead
of depending on tokio's general purpose work-stealing, notably
https://github.com/astral-sh/uv/pull/3627 and
https://github.com/astral-sh/uv/pull/4004. We now no longer benefit from
the multi-threaded runtime, as we run on all I/O on the main thread.
There's one remaining instance of `block_in_place` that can be swapped
for `rayon::spawn`.

This change is a small performance improvement due to removing some
unnecessary overhead of the multi-threaded runtime (e.g. spawning
threads), but nothing major. It also removes some noise from profiles.

## Test Plan

```
Benchmark 1: ./target/profiling/uv (resolve-warm)
  Time (mean ± σ):      14.9 ms ±   0.3 ms    [User: 3.0 ms, System: 17.3 ms]
  Range (min … max):    14.1 ms …  15.8 ms    169 runs
 
Benchmark 2: ./target/profiling/baseline (resolve-warm)
  Time (mean ± σ):      16.1 ms ±   0.3 ms    [User: 3.9 ms, System: 18.7 ms]
  Range (min … max):    15.1 ms …  17.3 ms    162 runs
 
Summary
  ./target/profiling/uv (resolve-warm) ran
    1.08 ± 0.03 times faster than ./target/profiling/baseline (resolve-warm)
```
2024-07-09 18:21:16 -04:00