Commit graph

319 commits

Author SHA1 Message Date
konsti
3a7db17147
Build backend: Add source tree -> source dist -> wheel tests (#9091)
A first milestone: source tree -> source dist -> wheel -> install works.
This PR adds a test for this.

There's obviously a lot still missing, including basics such as the
Readme inclusion.
2024-11-14 19:15:32 +00:00
konsti
926660aea0
Publish: Ignore non-matching files (#8986)
Fixes #8944
2024-11-13 12:58:28 +01:00
konsti
874aa29b57
Pin publish test to 3.12 (#8951)
Some checks are pending
CI / integration test | determine publish changes (push) Blocked by required conditions
CI / integration test | uv publish (push) Blocked by required conditions
CI / check cache | ubuntu (push) Blocked by required conditions
CI / check cache | macos aarch64 (push) Blocked by required conditions
CI / check system | python on debian (push) Blocked by required conditions
CI / check system | python on fedora (push) Blocked by required conditions
CI / check system | pypy on ubuntu (push) Blocked by required conditions
CI / check system | alpine (push) Blocked by required conditions
CI / check system | python on macos aarch64 (push) Blocked by required conditions
CI / check system | homebrew python on macos aarch64 (push) Blocked by required conditions
CI / check system | python on macos x86_64 (push) Blocked by required conditions
CI / check system | python3.10 on windows (push) Blocked by required conditions
CI / check system | python3.10 on windows x86 (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 | conda3.8 on linux (push) Blocked by required conditions
CI / check system | conda3.11 on macos (push) Blocked by required conditions
CI / check system | python on ubuntu (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 | embedded python3.10 on windows (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
CI / check system | conda3.8 on macos (push) Blocked by required conditions
CI / check system | conda3.11 on windows (push) Blocked by required conditions
CI / check system | conda3.8 on windows (push) Blocked by required conditions
CI / check system | amazonlinux (push) Blocked by required conditions
The bump to 3.13 broke the test
2024-11-10 15:43:47 +01:00
konsti
f29634bbaa
Wait longer for index updates in publish test (#8950)
Increasing the timeout for
3272289743
2024-11-08 16:49:38 +00:00
Eric Mark Martin
c49c7bdf97 Implement PEP 440-compliant local version semantics (#8797)
Implement a full working version of local version semantics. The (AFAIA)
major move towards this was implemented in #2430. This added support
such that the version specifier `torch==2.1.0+cpu` would install
`torch@2.1.0+cpu` and consider `torch@2.1.0+cpu` a valid way to satisfy
the requirement `torch==2.1.0` in further dependency resolution.

In this feature, we more fully support local version semantics. Namely,
we now allow `torch==2.1.0` to install `torch@2.1.0+cpu` regardless of
whether `torch@2.1.0` (no local tag) actually exists.

We do this by adding an internal-only `Max` value to local versions that
compare greater to all other local versions. Then we can translate
`torch==2.1.0` into bounds: greater than 2.1.0 with no local tag and
less than 2.1.0 with the `Max` local tag.

Depends on https://github.com/astral-sh/packse/pull/227.
2024-11-07 14:29:54 -06:00
Charlie Marsh
f8ec7975c8
Update Packse snapshots (#8795)
## Summary

The diff here is challenging because it looks like some tests got
reordered.
2024-11-04 16:17:43 -05:00
konsti
fd6b6aca0f
Fix indentation level in test publish script (#8785) 2024-11-03 22:42:00 +01:00
konsti
b2afcf2f2c
Retrying parsing in test_publish.py (#8784) 2024-11-03 20:56:19 +00:00
konsti
f5a7d70642
Check error case for skip existing (#8631) 2024-10-31 15:37:30 +00:00
konsti
082259493e
Skip existing, second iteration: Check the index before uploading (#8531)
Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-10-31 16:23:12 +01:00
Zanie Blue
f533fe8d8b
Use shared client for publish tests and increase read timeout (#8538)
Attempts to address the read timeout case in
https://github.com/astral-sh/uv/issues/8418
2024-10-24 14:24:57 -05:00
konsti
a7bb3a767c
Add URL context to publish test script (#8289)
For #8288
2024-10-17 14:31:23 +00:00
konsti
4e282efd39
Add cloudsmith to publish testing (#8261) 2024-10-17 14:52:19 +02:00
konsti
e0a2bc92cd
Reuse packages in test publish script (#8257) 2024-10-17 11:44:19 +02:00
samypr100
01c44af3c3
chore: unify all env vars used (#8151)
## Summary

This PR declares and documents all environment variables that are used
in one way or another in `uv`, either internally, or externally, or
transitively under a common struct.

I think over time as uv has grown there's been many environment
variables introduced. Its harder to know which ones exists, which ones
are missing, what they're used for, or where are they used across the
code. The docs only documents a handful of them, for others you'd have
to dive into the code and inspect across crates to know which crates
they're used on or where they're relevant.

This PR is a starting attempt to unify them, make it easier to discover
which ones we have, and maybe unlock future posibilities in automating
generating documentation for them.

I think we can split out into multiple structs later to better organize,
but given the high influx of PR's and possibly new environment variables
introduced/re-used, it would be hard to try to organize them all now
into their proper namespaced struct while this is all happening given
merge conflicts and/or keeping up to date.

I don't think this has any impact on performance as they all should
still be inlined, although it may affect local build times on changes to
the environment vars as more crates would likely need a rebuild. Lastly,
some of them are declared but not used in the code, for example those in
`build.rs`. I left them declared because I still think it's useful to at
least have a reference.

Did I miss any? Are their initial docs cohesive?

Note, `uv-static` is a terrible name for a new crate, thoughts? Others
considered `uv-vars`, `uv-consts`.

## Test Plan

Existing tests
2024-10-14 16:48:13 -05:00
konsti
e6c6426094
Add bad backtracking test cases for (#8171) 2024-10-14 20:54:08 +00:00
konsti
0c5d05d9e1
Don't run publish tests from fork (#8168)
Only the astral-sh/uv repository has the secrets.

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2024-10-14 16:46:41 -04: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
konsti
1e6c64074d
Add codeberg integration test for uv publish (#8043) 2024-10-09 15:02:26 +02:00
sobolevn
56521937b7
Add shellcheck CI (#7888)
<!--
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

I started learning `uv` by inspecting the source code.
I've noticed that your shell scripts are very good! Which is rare!

## Test Plan

I propose to add `shellcheck` to the CI.
It is a great tool to help finding bugs and style issues in shell code.

Techincal details:
- This CI job will only run when any `.sh` files are changed (or the job
definition file)
- It takes just several seconds even on local machine:
```
» time shellcheck -S style **/*.sh
shellcheck -S style **/*.sh  0.02s user 0.05s system 61% cpu 0.123 total
```

- It is easy to use, for example: I just fixed the single problem you
had in your code with `# shellcheck disable=SC1091`
- I am using this tool for around 8 years now and didn't have any
issues. Examples:
ca899f3b69/.github/workflows/test.yml (L22-L27)
and
https://github.com/wemake-services/wemake-django-template/blob/master/.github/workflows/shellcheck.yml

But, I understand that build / lint tools are very subjective. So, feel
free to close :)
2024-10-08 13:58:00 -05:00
konsti
d7feaadcbf
Reduce file reading boilerplace in tests (#7832) 2024-10-01 15:39:59 +02:00
Trevor Manz
df45b9ac25
Pin rich==13.7.1 for --exclude-newer in tests (#7713)
Fixes broken test in #6375

Tested here with:

```sh
cargo run run --exclude-newer=2024-03-25T00:00:00Z scripts/uv-run-remote-script-test.py CI
```
2024-09-26 11:54:50 -04:00
Trevor Manz
7a8f4f93cc
Check in test script for uv run <url> (#7708)
Merge before #6375 (see
https://github.com/astral-sh/uv/pull/6375#discussion_r1776975298)

This is testing a couple of things at once, and I'm happy to strip back
to something more simple (i.e., "just" printing).
However, I figured it would be useful to ensure that the PEP 723
metadata correctly works as well as that
additional arguments are correctly forwarded to the Python program.

cc: @burntsushi
2024-09-26 11:00:33 -04:00
konsti
c4c5378c0b
Add build backend scaffolding (#7662) 2024-09-24 19:23:17 +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
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
b05217e624
Show verbose output during system install in test (#7304)
We do this for the other installs and it is helpful for debugging

This is missing in
3001185524
2024-09-11 14:31:51 -05:00
konsti
316f683071
Update packse (#7002)
Add additional tests for https://github.com/astral-sh/uv/pull/6959 and
https://github.com/astral-sh/uv/pull/6961
2024-09-05 08:14:34 +00:00
Zanie Blue
1e89d3e44f
Remove VIRTUAL_ENV from project commmands by default (#6976)
And use test context helpers for commands consistently.

Needed for https://github.com/astral-sh/uv/pull/6864
2024-09-03 14:11:23 -05:00
Zanie Blue
35a0896d58
Remove the preview changelog (#6259)
I'll link to the old file in Git from the release changelog for 0.3.0
2024-08-20 16:47:46 +00:00
Charlie Marsh
5ddd84683c
Update BENCHMARKS.md (#6258) 2024-08-20 16:42:57 +00:00
konsti
422730d516
Benchmarks: Add extras to poetry (#6247)
Previously, we had dropped extras from the requirements when converting
to poetry, skewing the results towards poetry for the
`apache-airflow[all]` benchmark.
2024-08-20 14:41:07 +02:00
Charlie Marsh
29179570a1
Use sets rather than vectors for lockfile requirements (#6107)
## Summary

Ensures that `--locked` is robust to reordering and duplicates.
2024-08-15 13:00:35 +00:00
Charlie Marsh
6333823236
Change the definition of --locked to require satisfaction check (#6102)
## Summary

This PR changes the definition of `--locked` from:

> Produces the same `Lock`

To:

> Passes `Lock::satisfies`

This is a subtle but important difference. Previous, if
`Lock::satisfies` failed, we would run a resolution, then do
`existing_lock == lock`. If the two weren't equal, and `--locked` was
specified, we'd throw an error.

The equality check is hard to get right. For example, it means that we
can't ship #6076 without changing our marker representation, since the
deserialized lockfile "loses" some of the internal marker state that
gets accumulated during resolution.

The downside of this change is that there could be scenarios in which
`uv lock --locked` fails even though the lockfile would actually work
and the exact TOML would be unchanged. But... I think it's ok if
`--locked` fails after the user modifies something?
2024-08-15 08:17:28 -04:00
Charlie Marsh
7b67b5a328
Strip SHA when constructing package source (#6097)
## Summary

Similar to #5805, but applies the normalization earlier so that
`--locked` passes for URLs that contain fragments.
2024-08-14 20:12:32 -04:00
Charlie Marsh
e3f345ce09
Validate lockfile (rather than re-resolve) in uv lock (#6091)
## Summary

Historically, in order to "resolve from a lockfile", we've taken the
lockfile, used it to pre-populate the in-memory metadata index, then run
a resolution. If the resolution didn't match our existing resolution, we
re-resolved from scratch.

This was an appealing approach because (in theory) it didn't require any
dedicated logic beyond pre-populating the index. However, it's proven to
be _really_ hard to get right, because it's a stricter requirement than
we need. We just need the current lockfile to _satisfy_ the requirements
provided by the user. We don't actually need a second resolution to
produce the exact same result. And it's not uncommon that this second
resolution differs, because we seed it with preferences, which
fundamentally changes its course. We've worked hard to minimize those
"instabilities", but they're still present.

The approach here is intended to be much simpler. Instead of resolving
from the lockfile, we just check if the current resolution satisfies the
state of the workspace. Specifically, we check if the lockfile (1)
contains all the relevant members, and (2) matches the metadata for all
dependencies, recursively. (We skip registry dependencies, assuming that
they're immutable.)

This may actually be too conservative, since we can have resolutions
that satisfy the requirements, even if the requirements have changed
slightly. But we want to bias towards correctness for now.

My hope is that this scheme will be more performant, simpler, and more
robust.

Closes https://github.com/astral-sh/uv/issues/6063.
2024-08-14 20:00:15 -04:00
Charlie Marsh
1bbb05dca7
Invalidate uv.lock if registry sources are removed (#6026)
## Summary

Now, if you resolve against a registry, then swap it out for another, we
won't reuse the lockfile. (If you don't provide any registry
configuration, then we won't enforce this, so that `uv lock --index-url
foo` and `uv lock` is stable.)

Closes https://github.com/astral-sh/uv/issues/5920.
2024-08-13 23:42:04 +00:00
konsti
1e6b021506
Update packse to 0.3.34 (#5954)
Preparation for #5905
2024-08-09 09:04:17 +00:00
konsti
4038c9a6af
Rename distribution to packages in lockfile (#5861)
Currently, the entry for a package+version+source table is called
`distribution`. That is incorrect, the `sdist` and `wheel` fields inside
of that table are distributions, the table itself is for a package. We
also align ourselves closer with PEP 751.

I went through `lock.rs` and renamed all occurrences of "distribution"
that actually referred to a "package".

This change invalidates all existing lockfiles.

Bikeshedding: Do we call it `package` or `packages`? See also
https://github.com/python/peps/pull/3877

`package` is nice because it looks like a header:

```toml
[[package]]
name = "anyio"
version = "4.3.0"
source = { registry = "https://pypi.org/simple" }
dependencies = [
    { name = "idna" },
    { name = "sniffio" },
]
sdist = { url = "3970183622/anyio-4.3.0.tar.gz", hash = "sha256:f75253795a87df48568485fd18cdd2a3fa5c4f7c5be8e5e36637733fce06fed6", size = 159642 }
wheels = [
    { url = "2f20c40b45/anyio-4.3.0-py3-none-any.whl", hash = "sha256:048e05d0f6caeed70d731f3db756d35dcc1f35747c8c403364a8332c630441b8", size = 85584 },
]
```

`packages` is nice because the field is not a single entry, but a list.

2/3 for https://github.com/astral-sh/uv/issues/4893

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2024-08-08 11:25:06 -04:00
konsti
ae6b59365f
Only textwrap json packse scenarios with packse 0.3.32 (#5810)
Companion change to https://github.com/astral-sh/packse/pull/205 to
correctly format lock scenario doc comments.

Updates packse to 0.3.32.
2024-08-08 15:49:50 +02:00
Charlie Marsh
0f63173400
Add --python argument to benchmark script (#5844)
## Summary

Makes it easy to benchmark on different Python versions. Used this for
transformers, where some projects don't support Python 3.12.
2024-08-06 21:45:46 -04:00
Charlie Marsh
f3cc8e4790
Minor improvements to benchmarking setup (#5843) 2024-08-06 23:47:45 +00:00
Charlie Marsh
097aa929b7
Skip files when detecting workspace members (#5735)
## Summary

Closes https://github.com/astral-sh/uv/issues/5724.
Closes https://github.com/astral-sh/uv/issues/5725.
2024-08-02 19:44:43 +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
7efed62798
Add a dedicated error for members with mismatched Python requirements (#5695)
## Summary

Gives you a nice error message if you attempt to sync with, e.g., `-p
3.8` when that version is supported by at least one workspace member,
but your project's minimum requirement is `>=3.12`

Closes https://github.com/astral-sh/uv/issues/5662.
2024-08-01 21:37:13 +00:00
konsti
9a1a2118e1
Add transformers pyproject.toml to test requirements (#5657)
This `pyproject.toml`, translated from
0e4a1c3401/setup.py,
has found a number of bugs in blue jay, so i'm adding it to uv as a
development test case. (The file is too large to make it a test by
itself.)
2024-08-01 13:25:20 +02:00
konsti
2247b0f540
Check idempotence in packse lock scenarios (#5485)
Add tests for the instabilities fix.

Part of
https://github.com/astral-sh/uv/issues/5180#issuecomment-2247696198

Closes #5180
2024-07-31 15:39:16 +00:00
Charlie Marsh
5d727cb0af
Deprecate the --isolated flag (#5466)
## Summary

This PR deprecates the `--isolated` flag. The treatment varies across
the APIs:

- For non-preview APIs, we warn but treat it as equivalent to
`--no-config`.
- For preview APIs, we warn and ignore it, with two exceptions...
- For `tool run` and `run` specifically, we don't even warn, because we
can't differentiate the command-specific `--isolated` from the global
`--isolated`.
2024-07-30 22:40:38 +00:00
Zanie Blue
8545ae2312
Rename more use of "lock file" to "lockfile" (#5629) 2024-07-30 19:09:43 +00:00