astral-uv:konsti/custom-middleware

Last commit made on 2024-05-13
Get this branch:
git clone -b konsti/custom-middleware https://git.launchpad.net/astral-uv

Branch merges

Branch information

Name:
konsti/custom-middleware
Repository:
lp:astral-uv

Recent commits

1481203... by Tim de Jager <email address hidden>

Support custom middleware

Allow rustlib users to override the default retry middleware with a custom middleware stack.

76a39c7... by Chan Kang <email address hidden>

add `sys_path` to `Interpreter` struct (#3500)

<!--
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
likely necessary to resolve https://github.com/astral-sh/uv/issues/2500

made this a separate PR in an attempt to make the changes as small as
possible; let me know if it's preferred to keep them as a single PR.
<!-- What's the purpose of the change? What does it do, and why? -->

## Test Plan
- edited the test in `interpreter.rs`
- tested manually via `println!`

```
$ cargo run --quiet pip show test
["/Users/chankang/Library/Caches/uv/.tmpKzNEPN", "/Users/chankang/.pyenv/versions/3.12.2/lib/python312.zip", "/Users/chankang/.pyenv/versions/3.12.2/lib/python3.12", "/Users/chankang/.pyenv/versions/3.12.2/lib/python3.12/lib-dynload", "/Users/chankang/repos/uv/.venv/lib/python3.12/site-packages"]
warning: Package(s) not found for: test
chankang@chans-Air ~/repos/uv - (syspath)
$ git diff
diff --git a/crates/uv-interpreter/src/environment.rs b/crates/uv-interpreter/src/environment.rs
index 33b785ce..8ebf0864 100644
--- a/crates/uv-interpreter/src/environment.rs
+++ b/crates/uv-interpreter/src/environment.rs
@@ -106,6 +106,7 @@ impl PythonEnvironment {
     /// Some distributions also create symbolic links from `purelib` to `platlib`; in such cases, we
     /// still deduplicate the entries, returning a single path.
     pub fn site_packages(&self) -> impl Iterator<Item = &Path> {
+ println!("{:?}", self.interpreter.sys_path());
         if let Some(target) = self.interpreter.target() {
             Either::Left(std::iter::once(target.root()))
         } else {
chankang@chans-Air ~/repos/uv - (syspath)
$ python -c "import sys; print(sys.path)"
['', '/Users/chankang/.pyenv/versions/3.12.2/lib/python312.zip', '/Users/chankang/.pyenv/versions/3.12.2/lib/python3.12', '/Users/chankang/.pyenv/versions/3.12.2/lib/python3.12/lib-dynload', '/Users/chankang/.pyenv/versions/3.12.2/lib/python3.12/site-packages']
chankang@chans-Air ~/repos/uv - (syspath)
```

<!-- How was it tested? -->

404552d... by konstin

Allow clippy map-unwrap-or (#3498)

`map_or` is harder too read than the `.map().unwrap()` versions.

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

Read and write `uv.lock` based on project root (#3497)

## Summary

The `uv.lock` location is no longer based on the current working
directory, but rather, on the discovered project name.

3dd34e2... by Charlie Marsh <email address hidden>

Read package name from `pyproject.toml` in `uv run` (#3496)

## Summary

Right now, the project name is hard-coded.

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

51f4ab1... by Charlie Marsh <email address hidden>

Use defaults in `RequirementsSpecification` constructors (#3495)

3bd89ce... by Charlie Marsh <email address hidden>

Discover `uv run` projects hierarchically (#3494)

## Summary

Ensures that running `uv run` in a subdirectory of a project behaves
just as-if in the project root.

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

5e32609... by Charlie Marsh <email address hidden>

Run `cargo update` (#3488)

ad01a76... by Andrew Gallant <email address hidden>

uv-resolver: push resolver state to its own type (#3492)

This still keeps the resolver state on the stack, but it organizes it
into a more structured representation. This is a precursor to
implementing resolver forking, where we will ultimately put this state
on the heap. The idea is that this will let us maintain multiple
independent resolver states that will all produce their own resolution
(and potentially other forked states).

Closes #3354

2d70303... by Charlie Marsh <email address hidden>

Rebrand workspace API as project API (#3489)

## Summary

I've started to refer to this as the "project" API in various places, it
seems less duplicative than the "workspace" API which is a little
different.