Commit graph

3315 commits

Author SHA1 Message Date
Charlie Marsh
51a03738a2
Use cached current directory everywhere (#5574) 2024-07-29 17:03:45 -04:00
Charlie Marsh
37388f0987
Make directory a required argument (#5573) 2024-07-29 20:47:34 +00:00
bluss
e46c24d3cf
Implement uv run --directory (#5566)
## Summary

uv run --directory <path> means that one doesn't have to change to a
project's directory to run programs from it. It makes it possible to use
projects as if they are tool installations.

To support this, first the code reading .python-version was updated so
that
it can read such markers outside the current directory. Note the minor
change this causes (if I'm right), described in the commit.

## Test Plan

One test has been added.

## --directory

Not sure what the name of the argument should be, but it's following uv
sync's directory for now.

Other alternatives could be "--project". Uv run and uv tool run should
probably find common agreement on this (relevant for project-locked
tools).

I've implemented this same change in Rye, some time ago, and then we
went
with --pyproject `<`path to pyproject.toml file`>`. I think using
pyproject.toml file path and not directory was probably a mistake, an
overgeneralization one doesn't need.
2024-07-29 15:53:10 -04:00
Charlie Marsh
cf94a10054
Skip copying to empty entries in seekable zip (#5571)
## Summary

We cannot do this when streaming, since we may not have the metadata for
the entry.

Closes https://github.com/astral-sh/uv/issues/5565.
2024-07-29 19:00:19 +00:00
Charlie Marsh
f70501a22e
Use a consistent buffer size when writing out zip files (#5570) 2024-07-29 14:45:33 -04:00
Charlie Marsh
05b1f51aa1
Use a consistent buffer size for downloads (#5569) 2024-07-29 14:31:39 -04:00
Charlie Marsh
48162de974
Bump version to v0.2.31 (#5568) 2024-07-29 14:06:20 -04:00
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
a346d257cb
Update rs-async-zip fork commit (#5560)
## Summary

Closes https://github.com/astral-sh/uv/issues/5556.
2024-07-29 14:42:53 +00:00
Charlie Marsh
e6ad0cd2f9
Remove PyO3 updates from renovate (#5559) 2024-07-29 14:38:12 +00:00
Charlie Marsh
a5866f44c4
Add a no-op resolution benchmark (#5558) 2024-07-29 10:37:12 -04:00
renovate[bot]
8f378ec2c9
Update CodSpeedHQ/action action to v3 (#5549)
=
2024-07-29 10:03:04 -04:00
Charlie Marsh
7ea95239bd
Use hatchling rather than implicit setuptools default (#5527)
## Summary

Closes https://github.com/astral-sh/uv/issues/5461.
2024-07-29 14:00:12 +00:00
konsti
0877f76aae
Retry on incomplete body (#5555)
This is an attempt to add
https://github.com/astral-sh/uv/issues/3514#issuecomment-2253562096 to
retrying.

Relevant hyper code:
*
15cd6fa1fc/src/proto/h1/decode.rs (L683)
*
15cd6fa1fc/src/proto/h1/decode.rs (L161-L164)
2024-07-29 15:53:23 +02:00
renovate[bot]
24472108fe
Update pre-commit dependencies (#5546) 2024-07-29 09:44:31 -04:00
renovate[bot]
77696c4ab4
Update Rust crate axoupdater to 0.7.0 (#5547) 2024-07-29 09:44:25 -04:00
renovate[bot]
5365794023
Update hynek/setup-cached-uv action to v2 (#5550) 2024-07-29 09:44:03 -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
Charlie Marsh
41c1fc0c4d
Generate hashes for --find-links entries (#5544)
## Summary

Closes https://github.com/astral-sh/uv/issues/3874.
2024-07-29 08:49:38 +00:00
Charlie Marsh
51b7e9bff1
Retain editable designation for cached wheel installs (#5545)
## Summary

The package was being installed as editable, but it wasn't marked as
such in `uv pip list`, as the `direct-url.json` was wrong.

Closes https://github.com/astral-sh/uv/issues/5543.
2024-07-28 22:39:48 -04:00
Charlie Marsh
9af0ae2bef
Add relocatable installs to support concurrency-safe cached environments (#5509)
## Summary

The idea here is similar to what we do for wheels: we create the
`CachedEnvironment` in the `archive-v0` bucket, then symlink it to its
content-addressed location. This ensures that we can always recreate
these environments without concern for whether anyone else is accessing
them.

Part of the challenge here is that we want the virtual environments to
be relocatable, because we're now building them in one location but
persisting them in another. This requires that we write relative (rather
than absolute) paths to scripts and entrypoints. The main risk with
relocatable virtual environments is that the scripts and entrypoints
_themselves_ are not relocatable, because they use a relative shebang.
But that's fine for cached environments, which are never intended to
leave the cache.

Closes https://github.com/astral-sh/uv/issues/5503.
2024-07-28 20:32:11 -04:00
renovate[bot]
600ef6f18c
Update Rust crate assert_cmd to v2.0.15 (#5534) 2024-07-28 20:32:02 -04:00
renovate[bot]
c9099b1ed3
Update Rust crate toml to v0.8.16 (#5541) 2024-07-28 20:31:46 -04:00
renovate[bot]
335fe82cfe
Update Rust crate tokio to v1.39.2 (#5540) 2024-07-28 20:31:39 -04:00
renovate[bot]
834a1ed515
Update Rust crate serde_json to v1.0.121 (#5539) 2024-07-28 20:31:36 -04:00
renovate[bot]
96c65628b7
Update Rust crate predicates to v3.1.2 (#5538) 2024-07-28 20:31:29 -04:00
renovate[bot]
f2860df91f
Update Rust crate clap to v4.5.11 (#5537) 2024-07-28 20:30:53 -04:00
renovate[bot]
3b488d8635
Update Rust crate cargo-util to v0.2.13 (#5536) 2024-07-28 20:30:28 -04:00
renovate[bot]
f8f82b354d
Update Rust crate assert_fs to v1.1.2 (#5535) 2024-07-28 20:30:21 -04:00
renovate[bot]
9164d5cf97
Update Rust crate anstream to v0.6.15 (#5533) 2024-07-28 20:30:14 -04:00
Pavel Dikov
cb47aed9de
feat(venv): add relocatable flag (#5515)
## Summary

Adds a `--relocatable` CLI arg to `uv venv`. This flag does two things:

* ensures that the associated activation scripts do not rely on a
hardcoded
absolute path to the virtual environment (to the extent possible; `.csh`
and
  `.nu` left as-is)
* persists a `relocatable` flag in `pyvenv.cfg`.

The flag in `pyvenv.cfg` in turn instructs the wheel `Installer` to
create script
entrypoints in a relocatable way (use `exec` trick + `dirname $0` on
POSIX;
use relative path to `python[w].exe` on Windows).

Fixes: #3863

## Test Plan

* Relocatable console scripts covered as additional scenarios in
existing test cases.
* Integration testing of boilerplate generation in `venv`.
* Manual testing of `uv venv` with and without `--relocatable`
2024-07-29 00:10:11 +00: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
d7c79182ea
Extend Ruff configuration to sort imports (#5528) 2024-07-28 21:49:28 +00:00
Charlie Marsh
9732922929
Migrate benchmark setup to uv (#5526) 2024-07-28 21:37:57 +00:00
Charlie Marsh
2d5c166642
Compare simplified paths in Windows exclusion tests (#5525)
## Summary

Closes https://github.com/astral-sh/uv/issues/5521.
2024-07-28 17:26:46 -04: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
Mark Ture
12e92b7718
Fix typo in projects.md (#5523) 2024-07-28 21:05:26 +01:00
Charlie Marsh
83412837e5
Warn, but don't error, when encountering tilde .dist-info directories (#5520)
## Summary

Closes https://github.com/astral-sh/uv/issues/3668.
2024-07-28 19:13:06 +00:00
Charlie Marsh
b0c841ee3b
Ban --no-cache with --link-mode=symlink (#5519)
## Summary

Closes https://github.com/astral-sh/uv/issues/5360.
2024-07-28 15:01:17 -04:00
Krishnan Chandra
4b4128446d
Support xz compressed packages (#5513)
## Summary

Closes #2187.

The [xz
backdoor](https://gist.github.com/thesamesam/223949d5a074ebc3dce9ee78baad9e27)
is still fairly recent, but luckily the [Rust `xz2` crate bundles
version 5.2.5 of the C `xz`
package](https://github.com/alexcrichton/xz2-rs/tree/main/lzma-sys),
which is before the backdoor was introduced.

It's worth noting that a security risk still exists if you have a
compromised version of `xz` installed on your system, but that risk is
not introduced by `uv` or the Rust packages in general.

## Test Plan

Tried installing the package mentioned in the linked issue: `python-apt
@
https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/python-apt/2.7.6/python-apt_2.7.6.tar.xz`

(Note that this will only work on Ubuntu - I tried on a Mac and while
the archive was extracted properly, the package did not install because
of some missing files)

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2024-07-28 18:37:48 +00:00
Charlie Marsh
caf01735fa
Avoid warning users for missing self-extra lower bounds (#5518)
## Summary

Closes https://github.com/astral-sh/uv/issues/5227.
2024-07-28 18:35:18 +00:00
Charlie Marsh
88340fbd0d
Remove some unused methods (#5512) 2024-07-28 17:20:12 +00:00
Charlie Marsh
1734c7ed50
Use existing METADATA parser in wheel installer (#5508) 2024-07-27 14:38:16 -04:00
Jo
ae11317cc0
Make pip list --editable conflicts with --exlcude-editable (#5506)
## Summary

I think it makes no sense to allow `--editable` and `--exclude-editable`
at the same time.

## Test Plan
```console
$ cargo run -- pip list --editable --exclude-editable
error: the argument '--editable' cannot be used with '--exclude-editable'

Usage: uv.exe pip list --editable

For more information, try '--help'.

```
2024-07-27 08:26:46 -04:00
Charlie Marsh
866d844977
Allow uv pip install for unmanaged projects (#5504)
## Summary

Just an oversight.

Closes: https://github.com/astral-sh/uv/issues/5500.
2024-07-27 02:10:18 +00:00
Charlie Marsh
24859bd3ee
Upgrade to Rust 1.80.0 (#5472) 2024-07-27 01:49:47 +00:00
Charlie Marsh
3ea5e16e96
Respect reinstalls in cached environments (#5499)
## Summary

Closes #5493.
2024-07-27 01:36:58 +00:00