Commit graph

4903 commits

Author SHA1 Message Date
Zanie Blue
a988ebe6e7
Add script support to feature highlights in index (#6251) 2024-08-20 09:08:13 -05:00
Charlie Marsh
81a50dcb08
Add 32-bit Windows target (#6252)
## Summary

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

## Test Plan

```
❯ cargo run pip install sqlalchemy --python-platform i686-pc-windows-msvc --verbose --no-cache --reinstall
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.16s
     Running `target/debug/uv pip install sqlalchemy --python-platform i686-pc-windows-msvc --verbose --no-cache --reinstall`
DEBUG uv 0.2.37
DEBUG Searching for Python interpreter in system path
DEBUG Found `cpython-3.12.3-macos-aarch64-none` at `/Users/crmarsh/workspace/uv/.venv/bin/python3` (virtual environment)
DEBUG Using Python 3.12.3 environment at .venv/bin/python3
DEBUG Acquired lock for `.venv`
DEBUG Using request timeout of 30s
DEBUG Solving with installed Python version: 3.12.3
DEBUG Adding direct dependency: sqlalchemy*
DEBUG No cache entry for: https://pypi.org/simple/sqlalchemy/
WARN Skipping file for sqlalchemy: SQLAlchemy-0.1.1-py2.4.egg
WARN Skipping file for sqlalchemy: SQLAlchemy-0.1.2-py2.4.egg
WARN Skipping file for sqlalchemy: SQLAlchemy-0.1.3-py2.4.egg
WARN Skipping file for sqlalchemy: SQLAlchemy-0.1.4-py2.4.egg
DEBUG Searching for a compatible version of sqlalchemy (*)
DEBUG Selecting: sqlalchemy==2.0.32 [compatible] (SQLAlchemy-2.0.32-cp312-cp312-win32.whl)
DEBUG No cache entry for: 973e0bbf2b/SQLAlchemy-2.0.32-cp312-cp312-win32.whl.metadata
DEBUG Adding transitive dependency for sqlalchemy==2.0.32: typing-extensions>=4.6.0
DEBUG No cache entry for: https://pypi.org/simple/typing-extensions/
DEBUG Searching for a compatible version of typing-extensions (>=4.6.0)
DEBUG Selecting: typing-extensions==4.12.2 [compatible] (typing_extensions-4.12.2-py3-none-any.whl)
DEBUG No cache entry for: ad63fc0248/typing_extensions-4.12.2-py3-none-any.whl.metadata
DEBUG Tried 2 versions: sqlalchemy 1, typing-extensions 1
DEBUG Split specific environment resolution took 0.390s
Resolved 2 packages in 391ms
DEBUG Must revalidate requirement: sqlalchemy
DEBUG Must revalidate requirement: typing-extensions
DEBUG Unnecessary package: markupsafe==2.1.5
DEBUG Unnecessary package: filelock==3.15.4
DEBUG Unnecessary package: fsspec==2024.6.1
DEBUG Unnecessary package: jinja2==3.1.4
DEBUG Unnecessary package: mpmath==1.3.0
DEBUG Unnecessary package: networkx==3.3
DEBUG Unnecessary package: setuptools==72.2.0
DEBUG Unnecessary package: sympy==1.13.2
DEBUG Unnecessary package: torch==2.4.0
DEBUG No cache entry for: 973e0bbf2b/SQLAlchemy-2.0.32-cp312-cp312-win32.whl
DEBUG No cache entry for: ad63fc0248/typing_extensions-4.12.2-py3-none-any.whl
Prepared 2 packages in 150ms
DEBUG Uninstalled sqlalchemy (275 files, 25 directories)
DEBUG Uninstalled typing-extensions (7 files, 1 directory)
```
2024-08-20 14:06:25 +00:00
Charlie Marsh
3395d24959
Allow user to constrain supported lock environments (#6210)
## Summary

The strategy here is: if the user provides supported environments, we
use those as the initial forks when resolving. As a result, we never add
or explore branches that are disjoint with the supported environments.
(If the supported environments change, we ignore the lockfile entirely,
so we don't have to worry about any interactions between supported
environments and the preference forks.)

Closes https://github.com/astral-sh/uv/issues/6184.
2024-08-20 13:28:04 +00:00
Charlie Marsh
d02c202eb2
Rename environment-markers to resolution-markers (#6240)
## Summary

I probably won't land https://github.com/astral-sh/uv/pull/6210 for the
release, but I do want to make one breaking change to prep for it:
renaming `environment-markers` to `resolution-markers` (or
`solution-markers`?) so that it's delineated from the user-defined
markers in that PR.
2024-08-20 09:14:55 -04: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
Zanie Blue
6dc05a3598
Attempt to fix nav in production documentation (#6238)
My deployment to production does not properly render the nav, as it does
locally, e.g.:

<img width="602" alt="Screenshot 2024-08-19 at 6 58 45 PM"
src="https://github.com/user-attachments/assets/32c93ad5-5a36-4843-a835-41431de962dc">
2024-08-19 19:03:16 -05:00
Andrew Gallant
c14e30ad09 pep508: fix doc test
Indented blocks in Markdown are treated as code blocks, and rustdoc
treats all unadorned code blocks as Rust doctests. Since this wasn't
intended as a doctest and isn't valid Rust, it makes `cargo test --doc`
fail. We fix this by using an explicit code block labeled as `text`.
2024-08-19 16:29:20 -07:00
Zanie Blue
4b501a1393
Address feedback for Docker integration guide (#6235) 2024-08-19 22:52:39 +00:00
Zanie Blue
fac2cb8aac
Update Docker guide for projects (#6217)
Closes https://github.com/astral-sh/uv/issues/5371
2024-08-19 17:47:48 -05:00
Zanie Blue
298725fd02
Improvements to the Docker installation guide (#6216) 2024-08-19 17:47:25 -05:00
Zanie Blue
39c3c01f0c
Use uv add --script in guide (#6215) 2024-08-19 17:47:17 -05:00
Mathieu Kniewallner
a1f98e240a
docs(integration): show pinned version example on GH Actions (#6234)
## Summary

Suggestion from
https://github.com/astral-sh/uv/pull/6216#discussion_r1722204667.

I did not think of a clean way to avoid repetition, so tried to use tabs
for the platforms to only show the pin recommendation in one additional
block.

![Screenshot from 2024-08-19
23-54-36](https://github.com/user-attachments/assets/8a870c68-da60-460a-8bda-4afb72d16b86)

## Test Plan

Local run of the documentation.
2024-08-19 17:12:11 -05:00
Zanie Blue
5b74754140
Add output when uv add and uv remove update scripts (#6231)
Closes https://github.com/astral-sh/uv/issues/6214
2024-08-19 21:29:33 +00:00
Zanie Blue
e5bebe06b6
Document the uv.pip section semantics (#6225)
Explains semantics for `[uv.pip]` settings.
2024-08-19 21:26:09 +00:00
Zanie Blue
c703917d99
Document the cache directory (#6229) 2024-08-19 15:51:45 -05:00
Zanie Blue
cc8fbedd37
Document the tools directory (#6228)
As in https://github.com/astral-sh/uv/pull/6227
2024-08-19 19:46:19 +00:00
Zanie Blue
b7c9ad981d
Document the Python installation directory (#6227) 2024-08-19 19:42:36 +00:00
Zanie Blue
ea3db275a9
Link to persistent configuration options in Python versions document (#6226) 2024-08-19 19:22:58 +00:00
Zanie Blue
923dc13617
Link to the projects concept from the dependencies concept (#6224) 2024-08-19 14:22:27 -05:00
Zanie Blue
5c2781c42a
Fix messages for unavailable packages when range is plural (#6221)
Not in love with the implementation, but it seems like the easiest path
forward for now.
2024-08-19 19:07:07 +00:00
Charlie Marsh
865e9e0626
Make some edits to the workspace concept documentation (#6223) 2024-08-19 18:57:31 +00:00
Zanie Blue
6500f7110a
Change "any of" to "all of" in error messages (#6222) 2024-08-19 18:43:07 +00:00
Zanie Blue
f6f2c5b79e
Collapse redundant dependency clauses enumerating available versions (#6160)
In https://github.com/astral-sh/uv/issues/5046, we show the tautological
proof:

```
  ╰─▶ Because colabfold[alphafold]==1.5.5 depends on jax>=0.4.20 and only the following versions of jax are available:
          jax<=0.4.20
          jax==0.4.21
          jax==0.4.22
          jax==0.4.23
          jax==0.4.24
          jax==0.4.25
          jax==0.4.26
          jax==0.4.27
          jax==0.4.28
          jax==0.4.29
          jax==0.4.30
          jax==0.4.31
      we can conclude that colabfold[alphafold]==1.5.5 depends on jax>=0.4.20.
      And because jax>=0.4.20 depends on numpy>=1.26.0, we can conclude that colabfold[alphafold]==1.5.5 depends on numpy>=1.26.0.
      (1)
```

This is a part of the error tree because the statement
`colabfold[alphafold]==1.5.5 depends on jax>=0.4.20` is actually a
simplification of `colabfold[alphafold]==1.5.5 depends on
jax>=0.4.20,<0.5.0` and the no versions clause is a proof of that
simplification.

Without simplification, the clause looks like:

```
  ╰─▶ Because colabfold[alphafold]==1.5.5 depends on jax>=0.4.20,<0.5.0 and only the following versions of jax are available:
          jax<=0.4.20
          jax==0.4.21
          jax==0.4.22
          jax==0.4.23
          jax==0.4.24
          jax==0.4.25
          jax==0.4.26
          jax==0.4.27
          jax==0.4.28
          jax==0.4.29
          jax==0.4.30
          jax==0.4.31
      we can conclude that colabfold[alphafold]==1.5.5 depends on one of:
          jax==0.4.20
          jax==0.4.21
          jax==0.4.22
          jax==0.4.23
          jax==0.4.24
          jax==0.4.25
          jax==0.4.26
          jax==0.4.27
          jax==0.4.28
          jax==0.4.29
          jax==0.4.30
          jax==0.4.31
      And because jax>=0.4.20 depends on numpy>=1.26.0, we can conclude that colabfold[alphafold]==1.5.5 depends on numpy>=1.26.0.
```

I don't think we have a great way to avoid performing the simplification
of the range conditionally and it makes the error simpler to just jump
straight to `colabfold[alphafold]==1.5.5 depends on jax>=0.4.20`.

The derivation for this clause looks like:

```
          jax==0.4.20 | ==0.4.21 | ==0.4.22 | ==0.4.23 | ==0.4.24 | ==0.4.25 | ==0.4.26 | ==0.4.27 | ==0.4.28 | ==0.4.29 | ==0.4.30 | ==0.4.31 depends on numpy>=1.26.0
            no versions of jax>0.4.20, <0.4.21 | >0.4.21, <0.4.22 | >0.4.22, <0.4.23 | >0.4.23, <0.4.24 | >0.4.24, <0.4.25 | >0.4.25, <0.4.26 | >0.4.26, <0.4.27 | >0.4.27, <0.4.28 | >0.4.28, <0.4.29 | >0.4.29, <0.4.30 | >0.4.30, <0.4.31 | >0.4.31, <0.5.0
            colabfold[alphafold]==1.5.5 depends on jax>=0.4.20, <0.5.0
```

So it looks like we can take trees of this form and drop the "no
versions" clause _if_ the ranges are compatible[*]. See [this
comment](https://github.com/astral-sh/uv/pull/6160#discussion_r1720280922)
for a simpler explanation.

With this pull request, the clause simplifies to

```
╰─▶ Because colabfold[alphafold]==1.5.5 depends on jax>=0.4.20 and jax>=0.4.20 depends on numpy>=1.26.0,
     we can conclude that colabfold[alphafold]==1.5.5 depends on numpy>=1.26.0. (1)
```

Unfortunately, this doesn't change any snapshots in our test suite so
I'm uncertain if the strategy generalizes. In some incorrect iterations
of this logic, the snapshots did reveal my mistakes.

[*] "if the ranges are compatible" includes a bit of hand-waving. I'm
not 100% sure if I've chosen the correct range heuristic here.
2024-08-19 18:02:02 +00:00
Zanie Blue
df2ebf74d0
Document yanked packages caveat during sync (#6219)
Closes https://github.com/astral-sh/uv/issues/5928
2024-08-19 12:52:52 -05:00
konsti
c410d0d0db
Install ca-certificates in docker and use pipefail (#6208)
A dockerfile using `ubuntu` instead of `python` as base image currently
silently fails to install.

```dockerfile
FROM ubuntu
RUN apt-get update && apt-get install -y curl --no-install-recommends
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
RUN uv --version
```

```console
$ docker buildx build --progress plain --no-cache .
[...]
#6 [3/4] RUN curl -LsSf https://astral.sh/uv/install.sh | sh
#6 0.144 curl: (77) error setting certificate file: /etc/ssl/certs/ca-certificates.crt
#6 DONE 0.2s

#7 [4/4] RUN uv --version
#7 0.113 /bin/sh: 1: uv: not found
#7 ERROR: process "/bin/sh -c uv --version" did not complete successfully: exit code: 127
```

There's two underlying problems: Pipefail, and missing
`ca-certificates`.

In most shells, the source of a pipe erroring doesn't fail the entire
command, so `curl -LsSf https://astral.sh/uv/install.sh | sh` passes
even if the curl part fails. In bash, you can prefix the command with
`set -o pipefail &&` to change this behavior. But in the `ubuntu` docker
container, dash is the default shell, not bash. dash doesn't have a
pipefail option (in the version in ubuntu), so the [best
practice](https://docs.docker.com/build/building/best-practices/#using-pipes)
is `RUN ["/bin/bash", "-c", "set -o pipefail && curl -LsSf
https://astral.sh/uv/install.sh | sh"]`. That's not very readable, so
i'm going for `RUN curl -LsSf https://astral.sh/uv/install.sh >
/tmp/uv-installer.sh && sh /tmp/uv-installer.sh && rm
/tmp/uv-installer.sh` instead.

```dockerfile
FROM ubuntu
RUN apt-get update && apt-get install -y curl --no-install-recommends
RUN curl -LsSf https://astral.sh/uv/install.sh > /tmp/uv-installer.sh && sh /tmp/uv-installer.sh && rm /tmp/uv-installer.sh \
RUN uv --version
```

```console
$ docker buildx build --progress plain --no-cache .
[...]
#6 [3/3] RUN curl -LsSf https://astral.sh/uv/install.sh > /tmp/uv-installer.sh && sh /tmp/uv-installer.sh && rm /tmp/uv-installer.sh RUN uv --version
#6 0.179 curl: (77) error setting certificate file: /etc/ssl/certs/ca-certificates.crt
#6 ERROR: process "/bin/sh -c curl -LsSf https://astral.sh/uv/install.sh > /tmp/uv-installer.sh && sh /tmp/uv-installer.sh && rm /tmp/uv-installer.sh RUN uv --version" did not complete successfully: exit code: 77
```

The source for this error is `ca-certificates` missing, which is a
recommended package. We need to drop `--no-install-recommends` and the
installation passes again.
2024-08-19 12:14:23 -05:00
Charlie Marsh
a4aef29164
Warn when --upgrade is passed to tool run (#6140)
## Summary

Passing `--upgrade` to `tool run` is confusing, because it doesn't
upgrade the installed tool. It just causes us to use an isolated tool
environment, which seems wrong.
2024-08-19 17:08:39 +00:00
Charlie Marsh
c80a831438
Add support for package@latest in tool run (#6138)
## Summary

`@latest` will ignore any installed tools and force a cache refresh.

Closes https://github.com/astral-sh/uv/issues/5807.
2024-08-19 16:58:36 +00:00
Zanie Blue
c817f41951
Document the effect of ordering on package priority (#6211)
Closes https://github.com/astral-sh/uv/issues/6209
Closes https://github.com/astral-sh/uv/issues/5474
2024-08-19 11:53:28 -05:00
Zanie Blue
6bc8639ce8
Allow customizing the tool install directory with UV_TOOL_BIN_DIR (#6207)
Requested in #6067
2024-08-19 15:02:10 +00:00
konsti
310412a2ff
Update reqwest-middleware (#6206)
Update reqwest-middleware to the latest upstream
(https://github.com/TrueLayer/reqwest-middleware,
603ef97144b6b328c4e9ef7b13297d40bf461779) for #6205.
2024-08-19 10:25:40 -04:00
Zanie Blue
c32e01ec3d
Add support for python_version in ... markers (#6172)
Closes #3683 

Note our semantics do not exactly match the specification so we can
perform algebra on the markers. See the caveats in the documentation
(and in the discussion below).
2024-08-19 14:10:20 +00:00
Andrew Gallant
44b7b9a3c1 uv/tests: tweak marker emitting tests to use Python 3.12.1
The test output seems to depend on using Python 3.12.1 specifically.
While I'm not sure how it happens, it seems like these can get out of
sync between CI and local testing. In this case, I had a problem where
the marker expressions emitted locally were tied to Python 3.12.4, but
the tests in CI were tied to Python 3.12.1. Changing the test to require
3.12.1 specifically fixes this.
2024-08-19 06:02:29 -07:00
Andrew Gallant
5b6080f2ad uv/tests: add new initial set of 'workflow' tests
This initial set is meant to be a basic starting point where we
can test the interaction between 'uv' commands more systematically.
And specifically, with a focus on how the lock file changes.
2024-08-19 05:33:30 -07:00
Andrew Gallant
2b68a3d17a uv/tests: add and rejigger some helpers in our common test library
This adds some variations on 'uv add' and 'uv remove' specifically
for testing changes to the lock file (and not anything else).

We also rejigger 'run_and_format' so that we can use it in other
contexts, particularly for error reporting.

And we add a 'diff_lock' helper for returning the changes made to
a lock file after running a command.
2024-08-19 05:33:30 -07:00
Andrew Gallant
c7218e19ac cargo: add 'similar' dev dependency
We were already using this via 'insta'. We bring it in so that
we can explicitly snapshot diffs.
2024-08-19 05:33:30 -07:00
Andrew Gallant
a8011ffd50 uv/tests: use PathCopy::copy_from from assert_fs
Turns out assert_fs has a bunch of little goodies in it and we already
depend on it.
2024-08-19 05:33:30 -07:00
Andrew Gallant
5da561a917 uv/tests: remove deterministic macro
This was only being used in the ecosystem tests. Since we now don't do a
resolve when `uv lock` is run and when the lock file satisfies the
`pyproject.toml`, deterministic checking was removed since it's avoided
by construction. It was removed everywhere else, so we remove it here as
well.
2024-08-19 05:33:30 -07:00
Andrew Gallant
58fac3d577 uv/tests: remove non-deterministic checking in ecosystem tests
We basically avoid this by construction now, so there are no failures.
2024-08-19 05:33:30 -07:00
Andrew Gallant
b268f5eb8a uv/tests: move ecosystem project copying to TestContext
So that we can easily reuse ecosystem projects in other tests.
2024-08-19 05:33:30 -07:00
Andrew Gallant
74066ec29b cargo: remove unused 'derivative' dependency
This seems to be failing the `cargo shear` check on `main`. It looks
like this was caused by #6200.
2024-08-19 05:19:23 -07:00
konsti
4469f57516
Upstream konstin/pep508_rs#17 (#6200)
Upstream https://github.com/konstin/pep508_rs/pull/17

> This removes the `derivative` dependency which [seems to be
unmaintained](https://github.com/mcarton/rust-derivative/issues/117) and
depends on old versions of some crates, especially `syn`.
>
> I could also replace it with another crate like `educe` or
`derive-where` but the implementation seems simple enough.
2024-08-19 11:31:14 +00:00
Ed Morley
9e4c6a76d4
Update URL to distutils configuration files docs (#6004)
## Summary

The existing URL 404s:

https://docs.python.org/3/install/index.html#distutils-configuration-files

...since the `/3/` route now resolves to Python 3.12, where `distutils`
has been removed:
https://docs.python.org/3.12/whatsnew/3.12.html#distutils

The Python 3.11 docs are the most recent where the page still exists:

https://docs.python.org/3.11/install/index.html#distutils-configuration-files

## Test Plan

N/A
2024-08-19 11:48:03 +02:00
renovate[bot]
42e191013b
Update pre-commit dependencies (#6195) 2024-08-19 02:33:22 +00:00
renovate[bot]
e008b38df2
Update Rust crate indexmap to v2.4.0 (#6194) 2024-08-19 02:31:24 +00:00
renovate[bot]
8a48f755d1
Update Rust crate which to v6.0.3 (#6193) 2024-08-19 02:31:05 +00:00
renovate[bot]
457ef73209
Update Rust crate tokio to v1.39.3 (#6192) 2024-08-19 02:29:13 +00:00
renovate[bot]
20ef94b15d
Update Rust crate syn to v2.0.75 (#6191) 2024-08-19 02:25:42 +00:00
renovate[bot]
be095570f5
Update Rust crate serde_json to v1.0.125 (#6190) 2024-08-19 02:25:25 +00:00
renovate[bot]
f1d2e3fe96
Update Rust crate serde to v1.0.208 (#6189) 2024-08-19 02:24:01 +00:00
renovate[bot]
75d57f50aa
Update Rust crate ctrlc to v3.4.5 (#6188) 2024-08-19 02:23:08 +00:00