Commit graph

319 commits

Author SHA1 Message Date
konsti
194904b340
Redact packse version in snapshots follow-up (#5563)
I thought i had this included in #5483 but i had it on the wrong branch.
2024-07-29 15:22:20 +00:00
konsti
0f87d174b9
Redact packse version in snapshots (#5483)
Every packse version update is currently causing a huge diff (the size
of the `lock_scenarios.rs` diff in this PR). By redacting the version
from the snapshots, we will only have the actual change in the diff and
not the redundant version change noise.

The second commit moves all remaining packse url arg values to
`common/mod.rs`, which acts as a single source of truth for the packse
version.
2024-07-29 17:04:46 +02:00
Charlie Marsh
a5866f44c4
Add a no-op resolution benchmark (#5558) 2024-07-29 10:37:12 -04:00
Charlie Marsh
3626d08cca
Enable benchmarking of uv tool and pipx (#5531)
## Summary

Closes https://github.com/astral-sh/uv/issues/5263.
2024-07-28 23:27:14 +00:00
Charlie Marsh
44a77a04d0
Move bench directory to benchmark (#5529)
## Summary

Removes the legacy `benchmark` directory (we'll always have it in Git)
and renames `bench` to `benchmark` for clarity. Fixes a variety of
commands and references.
2024-07-28 22:03:52 +00:00
Charlie Marsh
9732922929
Migrate benchmark setup to uv (#5526) 2024-07-28 21:37:57 +00:00
Charlie Marsh
efbc9fb78d
Add support for benchmarking uv sync and uv lock (#5524)
## Summary

This PR adds support for `uv lock` and `uv sync` in the standardized
benchmarks script.

Part of: https://github.com/astral-sh/uv/issues/5263.

## Test Plan

For example:

```sh
python scripts/bench/__main__.py --uv-project --benchmark resolve-cold ./scripts/requirements/trio.in --verbose
```
2024-07-28 21:09:08 +00:00
Ahmed Ilyas
e8d7c0cb58
Editable installs for uv tool (#5454)
## Summary

Resolves #5436. 

## Test Plan

`cargo test` 

```console
❯ ./target/debug/uv tool install -e ~/black
warning: `uv tool install` is experimental and may change without warning
Resolved 6 packages in 894ms
   Built black @ file:///Users/ahmedilyas/black
Prepared 1 package in 468ms
Installed 6 packages in 6ms
 + black==24.4.3.dev23+g7e2afc9 (from file:///Users/ahmedilyas/black)
 + click==8.1.7
 + mypy-extensions==1.0.0
 + packaging==24.1
 + pathspec==0.12.1
 + platformdirs==4.2.2
Installed 2 executables: black, blackd
```

venv has the `.pth` files.
```console
❯ eza /Users/ahmedilyas/Library/Application\ Support/uv/tools/black/lib/python3.12/site-packages/
_black.pth       _virtualenv.py                         click                  mypy_extensions-1.0.0.dist-info  packaging                 pathspec                   platformdirs
_virtualenv.pth  black-24.4.3.dev23+g7e2afc9.dist-info  click-8.1.7.dist-info  mypy_extensions.py               packaging-24.1.dist-info  pathspec-0.12.1.dist-info  platformdirs-4.2.2.dist-info
```

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2024-07-26 16:30:15 -04:00
konsti
f1eda3590b
Update to packse 0.3.31 (#5441)
Update packse to 0.3.31, adding the instability scenarios.
2024-07-26 15:39:29 +00:00
Zanie Blue
42e76e2545
Prefer "lockfile" to "lock file" (#5427)
Closes https://github.com/astral-sh/uv/issues/5415
2024-07-25 09:22:36 -05:00
Charlie Marsh
f992532f78
Fix benchmark image in documentation (#5102) 2024-07-16 13:54:06 +00:00
Andrew Gallant
b6ad41fd8e scenarios: bump to packse 0.3.30 2024-07-15 10:09:01 -07:00
Charlie Marsh
b5f0e0729e
Use versioned bages when uploading to PyPI (#5039) 2024-07-13 18:12:45 +00: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
Charlie Marsh
6a6168ec78
Update SchemaStore script (#5024)
## Summary

Small mistakes I noticed while running.

## Test Plan

`python scripts/update_schemastore.py`
2024-07-12 17:49:38 -04:00
Charlie Marsh
a4417eba4a
Enable projects to opt-out of workspace management (#4565)
## Summary

You can now add `managed = false` under `[tool.uv]` in a
`pyproject.toml` to explicitly opt out of the project and workspace
APIs.

If a project sets `managed = false`, we will (1) _not_ discover it as a
workspace root, and (2) _not_ discover it as a workspace member (similar
to using `exclude` in the workspace parent).

Closes https://github.com/astral-sh/uv/issues/4551.
2024-07-01 16:17:43 -04:00
Charlie Marsh
41f051db3b
Remove exclude newer methods on test context (#4535)
## Summary

Closes https://github.com/astral-sh/uv/issues/4531.
2024-06-25 23:45:35 +00:00
konsti
e6103dcab1
Deduplicate test command creation (#4512)
This PR refactors the command creation in the test suite to remove the
duplication.

**1)** We add the same set of test stubbing args to almost any uv
invocation in the tests:

```rust
command
    .arg("--cache-dir")
    .arg(self.cache_dir.path())
    .env("VIRTUAL_ENV", self.venv.as_os_str())
    .env("UV_NO_WRAP", "1")
    .env("HOME", self.home_dir.as_os_str())
    .env("UV_TOOLCHAIN_DIR", "")
    .env("UV_TEST_PYTHON_PATH", &self.python_path())
    .current_dir(self.temp_dir.path());

if cfg!(all(windows, debug_assertions)) {
    // TODO(konstin): Reduce stack usage in debug mode enough that the tests pass with the
    // default windows stack of 1MB
    command.env("UV_STACK_SIZE", (8 * 1024 * 1024).to_string());
}
```

Centralizing these into a `TestContext::add_shared_args` method removes
them from everywhere.

**2)** Prefix all `TextContext` methods of the pip interface with
`pip_`. This is now necessary due to `uv sync` vs. `uv pip sync`.

**3)** Move command creation in the various test files into dedicated
functions or methods to avoid repeating the arguments. Except for error
message tests, there should be at most one `Command::new(get_bin())`
call per test file. `EXCLUDE_NEWER` is exclusively used in
`TestContext`.

---

I'm considering adding a `TestCommand` on top of these changes (in
another PR) that holds a reference to the `TextContext`, has
`add_shared_args` as a method and uses `Fn(Self) -> Self` instead of
`Fn(&mut Self) -> Self` for methods to improved chaining.
2024-06-25 22:06:54 +00:00
Andrew Gallant
10c950a551 scenarios: bump to packse 0.3.29 2024-06-20 07:21:45 -04:00
Zanie Blue
549d7dfe37
Add test case for wheel installation with different path (#4396)
Regression test for #4391 / https://github.com/astral-sh/uv/pull/4393
2024-06-19 09:39:55 -05:00
Zanie Blue
0b0a0472ad
Request Python 3.12 in the release script (#4384)
Otherwise, if another version is active we fail because Rooster requires
3.12
2024-06-18 10:44:42 -05:00
Andrew Gallant
bb40d13603 scenarios: bump to packse 0.3.27 2024-06-17 09:30:37 -04:00
Andrew Gallant
eea1bf9bf2 scenarios: bump to packse 0.3.26 2024-06-17 09:30:37 -04:00
Markus Hofbauer
9647eed697
Rename README to README.md (#4315)
Make use of GitHub's markdown rendering

<!--
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

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

## Test Plan

<!-- How was it tested? -->
2024-06-13 16:43:11 -05:00
Zanie Blue
434aef0325
Move the preview changelog so the GitHub Release shows stable changes (#4290) 2024-06-12 21:49:12 +00:00
Zanie Blue
d963a0f085
Improve local testing docs for packse (#4279) 2024-06-12 13:19:10 -05:00
Andrew Gallant
910168a219 scenarios: bump packse to 0.3.24 2024-06-12 13:30:47 -04:00
Andrew Gallant
1e282da04a scripts/scenarios: add requires-python to packse lock test template
packse has the ability to specify a project wide Requires-Python
constraint, but our lock template wasn't forwarding this to the
corresponding pyproject.toml. This update makes that happen.
2024-06-12 13:30:47 -04:00
Zanie Blue
daee30aeb1
Add changelog for preview changes (#4251)
I tweaked rooster to allow sections to be overridden from the CLI so we
can generate a separate preview changelog

See https://github.com/zanieb/rooster/pull/43 for the rooster changes
needed

I tested `./scripts/release.sh` as well.
2024-06-11 19:16:29 -04:00
Andrew Gallant
c46fa74e65
make universal resolver fork only when markers are disjoint (#4135)
The basic idea here is to make it so forking can only ever result in a
resolution that, for a particular marker environment, will only install
at most one version of a package. We can guarantee this by ensuring we
only fork on conflicting dependency specifications only when their
corresponding markers are completely disjoint. If they aren't, then
resolution _must_ find a single version of the package in the
intersection of the two dependency specifications.

A test for this case has been added to packse here:
https://github.com/astral-sh/packse/pull/182. Previously, that test
would result in a resolution with two different unconditional versions
of the same package. With this change, resolution fails (as it should).

A commit-by-commit review should be helpful here, since the first commit
is a refactor to make the second commit a bit more digestible.
2024-06-07 23:40:55 +00:00
Charlie Marsh
e5f95186de
Default to current Python minor if Requires-Python is absent (#4070)
## Summary

If `Requires-Python` is omitted in `uv lock` or `uv run`, we now warn
and default to `>=` the current minor version.

Closes https://github.com/astral-sh/uv/issues/4050.
2024-06-05 20:45:50 +00:00
Andrew Gallant
42b584c668 scripts/scenarios: update packse to 0.3.17 2024-06-04 14:24:59 -04:00
Andrew Gallant
7b736fc238 scripts/scenarios: update 'generate.py' to handle universal tests
This commit adds a template and does some light surgery on `generate.py`
to make use of that template. In particular, the universal tests require
using the "workspace"-aware version of `uv`, so we can't use the
existing `uv pip {compile,install}` tests.
2024-06-04 14:24:59 -04:00
Andrew Gallant
459966a132
uv/tests: update packse tests (#4015)
This is just the result of running

    ./scripts/sync_scenarios.sh

From the root of the `uv` repository.

When I initially ran this, it produced some tests with snapshots that
weren't being updated. It turned out this was because the tests weren't
running, as they were gated behind the `python-patch` feature. In this
commit, we add `python-patch` to our `cargo insta` command, which should
update all relevant snapshots.

There are still some superfluous updates as a result of a spell checker
being run on generated files, but
2024-06-04 13:56:20 -04:00
konsti
da7d5549a3
Don't copy gitignored files in workspace tests (#4012)
The workspace test directories can be used both in tests and directly
for developing/debugging. In the latter, we shouldn't copy the venv and
the lockfile when running tests. Using the ignore crate over manual
recursion we exclude those files.
2024-06-04 12:58:07 +00:00
Charlie Marsh
1fc6a59707
Remove special-casing for editable requirements (#3869)
## Summary

There are a few behavior changes in here:

- We now enforce `--require-hashes` for editables, like pip. So if you
use `--require-hashes` with an editable requirement, we'll reject it. I
could change this if it seems off.
- We now treat source tree requirements, editable or not (e.g., both `-e
./black` and `./black`) as if `--refresh` is always enabled. This
doesn't mean that we _always_ rebuild them; but if you pass
`--reinstall`, then yes, we always rebuild them. I think this is an
improvement and is close to how editables work today.

Closes #3844.

Closes #2695.
2024-05-28 15:49:34 +00:00
konsti
a89e146107
Initial workspace support (#3705)
Add workspace support when using `-r <path>/pyproject.toml` or `-e
<path>` in the pip interface. It is limited to all-editable
static-metadata workspaces, and tests only include a single main
workspace, ignoring path dependencies in another workspace. This can be
considered the MVP for workspace support: You can create a workspace,
you can install from it, but some options and conveniences are still
missing. I'll file follow-up tickets (support in lockfiles, support path
deps in other workspace, #3625)

There is also support in `uv run`, but we need
https://github.com/astral-sh/uv/issues/3700 first to properly support
using different current projects in the bluejay interface, currently the
resolution and therefore the lockfile depends on the current project.
I'd do this change first (it's big enough already), then #3700, and then
add workspace support properly to bluejay.

Fixes #3404
2024-05-28 07:41:53 +00:00
Ibraheem Ahmed
0d2f3fc4e4
Add airflow benchmark (#3643)
## Summary

This seems to be one of the most consistent benchmark cases we have in
terms of standard deviation:
```
➜  hyperfine "target/profiling/main pip compile scripts/requirements/airflow.in" --runs 200
Benchmark 1: target/profiling/main pip compile scripts/requirements/airflow.in
  Time (mean ± σ):     292.6 ms ±   6.6 ms    [User: 414.1 ms, System: 194.2 ms]
  Range (min … max):   282.7 ms … 320.1 ms    200 runs
```

For smaller benchmarks, scispacy and dtlssocket seem to be a bit more
consistent than our current jupyter benchmark, but it hasn't given us
any problems so I'll leave it for now.
2024-05-23 13:25:54 -04:00
Zanie Blue
5cd3af8ab4
Use uv tool run for release script (#3764)
Dogfooding!
2024-05-22 16:31:13 -05:00
Charlie Marsh
472ab144d5
Remove maturin_editable test (#3718)
## Summary

I personally think this isn't worth continuing to maintain.
2024-05-22 11:10:04 +02:00
Zanie Blue
dfd6ccf0f9
Move maturin test coverage into CI (#3714)
This test can take over 60s to run, which is too much for a unit test.
We'll run it in a separate CI job to retain coverage.
2024-05-21 19:17:48 +00:00
konsti
2ffd453003
Discover workspaces without using them in resolution (#3585)
Add minimal support for workspace discovery, only used for determining
paths in the bluejay commands.

We can now discover the workspace structure, namely that the
`pyproject.toml` of a package belongs to a workspace `pyproject.toml`
with members and exclusion. The globbing logic is inspired by cargo. We
don't resolve `workspace = true` metadata declarations yet.
2024-05-21 17:17:26 +00:00
Charlie Marsh
7c6632114b
Improve JSON Schema and add export script (#3461)
## Summary

A few errors I noticed after generating the schema.
2024-05-08 16:15:16 +00:00
konsti
2af80c28a8
Add apache airflow test case (#3278)
I like using airflow as a complex resolution test case. The second
requirement is the missing bound to enforce a successful resolution.
2024-04-26 14:17:09 +00:00
Charlie Marsh
413859768d
Replace Twisted with an empty bz2 package (#3258)
## Summary

This is just an empty package taken from packse, rezipped with `tar -cjf
bz2-1.0.0.tar.bz2 bz2-1.0.0`.
2024-04-25 03:45:23 +00:00
konsti
005b76770e
Update BUILD_VENDOR_LINKS_URL from packse version (#3246)
Make `generate.py` update the packse version used in
`BUILD_VENDOR_LINKS_URL`.

Closes #3245
2024-04-24 17:54:38 +02:00
Zanie Blue
691b7d26a0
Upgrade packse to 0.3.15 (#3244)
Includes https://github.com/astral-sh/packse/pull/179 for #3225

```
uv pip compile scripts/scenarios/requirements.in -o scripts/scenarios/requirements.txt --refresh-package packse --upgrade
cargo dev fetch-python
source .env
./scripts/sync_scenarios.sh
```
2024-04-24 10:54:03 -05:00
renovate[bot]
04eaee7e19
Update Rust crate pyo3 to 0.21.0 (#2911) 2024-04-22 18:27:22 +00:00
Charlie Marsh
41b29b2dc4
Add support for embedded Python on Windows (#3161)
## Summary

References:
-
cad550030a/src/virtualenv/create/via_global_ref/builtin/cpython/cpython3.py (L58-L68)
- https://github.com/pypa/virtualenv/pull/2353
- https://github.com/pypa/virtualenv/issues/2368

Closes https://github.com/astral-sh/uv/issues/1656.
2024-04-22 13:34:27 -04:00
Charlie Marsh
5ca5d7da67
Add test for avoiding irrelevant extras (#3107)
## Summary

This PR adds a test that currently leads to an error, but should
successfully resolve as of https://github.com/astral-sh/uv/pull/3100.

The core idea is that if we have a pinned package, we shouldn't try to
build other versions of that package if we have an unconstrained variant
with an extra.
2024-04-19 00:47:27 +00:00