astral-uv:zb/range-and

Last commit made on 2024-01-10
Get this branch:
git clone -b zb/range-and https://git.launchpad.net/astral-uv

Branch merges

Branch information

Name:
zb/range-and
Repository:
lp:astral-uv

Recent commits

68abd0d... by Zanie <email address hidden>

Display "and" instead of "," in bound intersections

d47eecc... by Zanie Blue <email address hidden>

Only write to rust cache in CI from main branch (#874)

Each cache entry is ~1 GB of our allotted 10 GB for the repository which
is quite a bit. We're probably losing cache entries all the time since
we add an entry per commit per pull request.

Saving the cache takes ~3 minutes
([example](https://github.com/astral-sh/puffin/actions/runs/7479909295/job/20358124969)),
it's probably just slowing down CI. It's ~25% of our test runtime and
~50% of our clippy runtime.

811332e... by Zanie Blue <email address hidden>

Improve handling of "full" version ranges (#868)

Reduces the number of implementation branches handling `Range:full`,
deferring it to `PackageRange`.
Improves some user-facing messages, e.g. saying `all versions of
<package>` instead of `<package>*`.
Changes the member names of the `PackageRangeKind` enum — they were not
very clear.

a65c55f... by Zanie Blue <email address hidden>

Say "cannot be used" and "must be used" instead of "forbidden" and "mandatory" (#867)

Closes #858

845ba68... by Zanie Blue <email address hidden>

Improve formatting of incompatible terms when there are two items (#866)

93d3093... by Zanie Blue <email address hidden>

Improve formatting of package ranges in error messages (#864)

Closes #810
Closes https://github.com/astral-sh/puffin/issues/812
Requires https://github.com/zanieb/pubgrub/pull/19 and
https://github.com/zanieb/pubgrub/pull/18

- Always pair package ranges with names e.g. `... of a matching a<1.0`
instead of `... of a matching <1.0`
- Split range segments onto multiple lines when not a singleton as
suggested in
[#850](https://github.com/astral-sh/puffin/pull/850#discussion_r1446419610)
- Improve formatting when ranges are split across multiple lines e.g. by
avoiding extra spaces and improving wording

Note review will require expanding the hidden files as there are
significant changes to the report formatter and snapshots.

Bear with me here as these are definitely not perfect still.

The following changes build on top of this independently for further
improvements:
- #868
- #867
- #866
- #871

4d8bfd7... by konstin

Split source dist error type into error and kind (#872)

It's a better, less redundant error type. It will come in handy when
adding a second parse function.

6993f87... by bojanserafimov <email address hidden>

Commit compiled requirement test files (#869)

fbb57b2... by Charlie Marsh <email address hidden>

Add `--seed` flag to `venv` to allow seed package environments (#865)

## Summary

Installs the seed packages you get with `virtualenv`, but opt-in rather
than opt-out.

Closes https://github.com/astral-sh/puffin/issues/852.

## Test Plan

```
❯ ./scripts/benchmarks/venv.sh
+ hyperfine --runs 20 --warmup 3 --prepare 'rm -rf .venv' './target/release/puffin venv' --prepare 'rm -rf .venv' 'virtualenv --without-pip .venv' --prepare 'rm -rf .venv' 'python -m venv --without-pip .venv'
Benchmark 1: ./target/release/puffin venv
  Time (mean ± σ): 4.6 ms ± 0.2 ms [User: 2.4 ms, System: 3.6 ms]
  Range (min … max): 4.3 ms … 4.9 ms 20 runs

  Warning: Command took less than 5 ms to complete. Note that the results might be inaccurate because hyperfine can not calibrate the shell startup time much more precise than this limit. You can try to use the `-N`/`--shell=none` option to disable the shell completely.

Benchmark 2: virtualenv --without-pip .venv
  Time (mean ± σ): 73.3 ms ± 0.3 ms [User: 57.4 ms, System: 14.2 ms]
  Range (min … max): 72.8 ms … 74.0 ms 20 runs

Benchmark 3: python -m venv --without-pip .venv
  Time (mean ± σ): 22.5 ms ± 0.3 ms [User: 17.0 ms, System: 4.9 ms]
  Range (min … max): 22.0 ms … 23.2 ms 20 runs

Summary
  './target/release/puffin venv' ran
    4.92 ± 0.20 times faster than 'python -m venv --without-pip .venv'
   16.00 ± 0.63 times faster than 'virtualenv --without-pip .venv'
+ hyperfine --runs 20 --warmup 3 --prepare 'rm -rf .venv' './target/release/puffin venv --seed' --prepare 'rm -rf .venv' 'virtualenv .venv' --prepare 'rm -rf .venv' 'python -m venv .venv'
Benchmark 1: ./target/release/puffin venv --seed
  Time (mean ± σ): 20.2 ms ± 0.4 ms [User: 8.6 ms, System: 15.7 ms]
  Range (min … max): 19.7 ms … 21.2 ms 20 runs

Benchmark 2: virtualenv .venv
  Time (mean ± σ): 135.1 ms ± 2.4 ms [User: 66.7 ms, System: 65.7 ms]
  Range (min … max): 133.2 ms … 142.8 ms 20 runs

Benchmark 3: python -m venv .venv
  Time (mean ± σ): 1.656 s ± 0.014 s [User: 1.447 s, System: 0.186 s]
  Range (min … max): 1.641 s … 1.697 s 20 runs

Summary
  './target/release/puffin venv --seed' ran
    6.67 ± 0.17 times faster than 'virtualenv .venv'
   81.79 ± 1.70 times faster than 'python -m venv .venv'
```

55f2be7... by Charlie Marsh <email address hidden>

Default to PEP 517-based builds (#843)

## Summary

Our current setup uses the legacy `setup.py`-based builds if a
`pyproject.toml` file isn't present. This matches pip's behavior.
However, `pypa/build` uses PEP 517-based builds in such cases, and it
looks like pip plans to make that the default
(https://github.com/pypa/pip/issues/9175), with the limiting factor
being performance issues related to isolated builds.

This is now the default behavior, but the `--legacy-setup-py` flag
allows users to opt-in to using `setup.py` directly for distributions
that lack a `pyproject.toml`.