uv/crates
konsti 01d1a39c21
Add `uv run --package` (#3864)
Add a `--package` option that allows switching the current project in
the workspace. Wherever you are in a workspace, you should be able to
run with any other project as root. This is the uv equivalent of `cargo
run -p`.

I don't love the `--package` name, esp. since `-p` is already taken and
in general to many things start with p already.

Part of this change is moving the workspace discovery of
`ProjectWorkspace` to `Workspace` itself.

## Usage

In albatross-virtual-workspace:

```console
$ uv venv
$ uv run --preview --package bird-feeder python -c "import albatross"
   Built file:///home/konsti/projects/uv/scripts/workspaces/albatross-virtual-workspace/packages/bird-feeder
   Built file:///home/konsti/projects/uv/scripts/workspaces/albatross-virtual-workspace/packages/seeds
Built 2 editables in 167ms
Resolved 5 packages in 4ms
Installed 5 packages in 1ms
 + anyio==4.4.0
 + bird-feeder==1.0.0 (from file:///home/konsti/projects/uv/scripts/workspaces/albatross-virtual-workspace/packages/bird-feeder)
 + idna==3.6
 + seeds==1.0.0 (from file:///home/konsti/projects/uv/scripts/workspaces/albatross-virtual-workspace/packages/seeds)
 + sniffio==1.3.1
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'albatross'
$ uv venv
$ uv run --preview --package albatross python -c "import albatross"
   Built file:///home/konsti/projects/uv/scripts/workspaces/albatross-virtual-workspace/packages/albatross
   Built file:///home/konsti/projects/uv/scripts/workspaces/albatross-virtual-workspace/packages/bird-feeder
   Built file:///home/konsti/projects/uv/scripts/workspaces/albatross-virtual-workspace/packages/seeds
Built 3 editables in 173ms
Resolved 7 packages in 6ms
Installed 7 packages in 1ms
 + albatross==0.1.0 (from file:///home/konsti/projects/uv/scripts/workspaces/albatross-virtual-workspace/packages/albatross)
 + anyio==4.4.0
 + bird-feeder==1.0.0 (from file:///home/konsti/projects/uv/scripts/workspaces/albatross-virtual-workspace/packages/bird-feeder)
 + idna==3.6
 + seeds==1.0.0 (from file:///home/konsti/projects/uv/scripts/workspaces/albatross-virtual-workspace/packages/seeds)
 + sniffio==1.3.1
 + tqdm==4.66.4
```

In albatross-root-workspace:

```console
$ uv venv
$ uv run --preview --package bird-feeder python -c "import albatross"
  Using Python 3.12.3 interpreter at: /home/konsti/.local/bin/python3
  Creating virtualenv at: .venv
  Activate with: source .venv/bin/activate
      Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.10s
       Running `/home/konsti/projects/uv/target/debug/uv run --preview --package bird-feeder python -c 'import albatross'`
     Built file:///home/konsti/projects/uv/scripts/workspaces/albatross-root-workspace/packages/bird-feeder
     Built file:///home/konsti/projects/uv/scripts/workspaces/albatross-root-workspace/packages/seeds                                              Built 2 editables in 161ms
  Resolved 5 packages in 4ms
  Installed 5 packages in 1ms
   + anyio==4.4.0
   + bird-feeder==1.0.0 (from file:///home/konsti/projects/uv/scripts/workspaces/albatross-root-workspace/packages/bird-feeder)
   + idna==3.6
   + seeds==1.0.0 (from file:///home/konsti/projects/uv/scripts/workspaces/albatross-root-workspace/packages/seeds)
   + sniffio==1.3.1
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
  ModuleNotFoundError: No module named 'albatross'
$ uv venv
$ cargo run run --preview --package albatross python -c "import albatross"
Using Python 3.12.3 interpreter at: /home/konsti/.local/bin/python3
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.13s
     Running `/home/konsti/projects/uv/target/debug/uv run --preview --package albatross python -c 'import albatross'`
   Built file:///home/konsti/projects/uv/scripts/workspaces/albatross-root-workspace
   Built file:///home/konsti/projects/uv/scripts/workspaces/albatross-root-workspace/packages/bird-feeder
   Built file:///home/konsti/projects/uv/scripts/workspaces/albatross-root-workspace/packages/seeds
Built 3 editables in 168ms
Resolved 7 packages in 5ms
Installed 7 packages in 1ms
 + albatross==0.1.0 (from file:///home/konsti/projects/uv/scripts/workspaces/albatross-root-workspace)
 + anyio==4.4.0
 + bird-feeder==1.0.0 (from file:///home/konsti/projects/uv/scripts/workspaces/albatross-root-workspace/packages/bird-feeder)
 + idna==3.6
 + seeds==1.0.0 (from file:///home/konsti/projects/uv/scripts/workspaces/albatross-root-workspace/packages/seeds)
 + sniffio==1.3.1
 + tqdm==4.66.4
```
2024-06-02 21:42:14 +00:00
..
bench Add Git resolver in lieu of static hash map (#3954) 2024-05-31 22:44:42 -04:00
cache-key Remove some unused `pub use` exports (#3930) 2024-05-30 22:26:52 -04:00
distribution-filename Incorporate build tag into wheel prioritization (#3781) 2024-05-23 21:12:53 +00:00
distribution-types Remove some `anyhow` usages (#3962) 2024-06-01 20:11:23 +00:00
install-wheel-rs Support x86 windows (#3873) 2024-05-28 16:07:39 +00:00
once-map Use `FxHasher` in resolver (#3641) 2024-05-17 15:04:22 -04:00
pep440-rs feat: bump pep580 and pep440 types (#3860) 2024-05-27 09:38:39 +02:00
pep508-rs Unify editable and unnamed URL parsing (#3946) 2024-05-31 21:08:00 +00:00
platform-tags fix: add missing ppc64le alias for powerpc64le (#3963) 2024-06-02 13:15:24 -04:00
pypi-types Discard fragments when parsing unnamed URLs (#3940) 2024-05-31 13:54:15 +00:00
requirements-txt Unify editable and unnamed URL parsing (#3946) 2024-05-31 21:08:00 +00:00
uv Add `uv run --package` (#3864) 2024-06-02 21:42:14 +00:00
uv-auth Increase verbosity of credential fetch logs (#3550) 2024-05-13 15:55:57 +00:00
uv-build Add support for `tool.uv` into distribution building (#3904) 2024-05-31 02:42:03 +00:00
uv-cache Remove special-casing for editable requirements (#3869) 2024-05-28 15:49:34 +00:00
uv-client Remove some `anyhow` usages (#3962) 2024-06-01 20:11:23 +00:00
uv-configuration Add support for `tool.uv` into distribution building (#3904) 2024-05-31 02:42:03 +00:00
uv-dev Add Git resolver in lieu of static hash map (#3954) 2024-05-31 22:44:42 -04:00
uv-dispatch Add Git resolver in lieu of static hash map (#3954) 2024-05-31 22:44:42 -04:00
uv-distribution Add `uv run --package` (#3864) 2024-06-02 21:42:14 +00:00
uv-extract Fix nightly cfg checker warnings (#3932) 2024-05-31 09:35:52 +00:00
uv-fs Add support for `tool.uv` into distribution building (#3904) 2024-05-31 02:42:03 +00:00
uv-git Remove some `anyhow` usages (#3962) 2024-06-01 20:11:23 +00:00
uv-installer Add `uv run --package` (#3864) 2024-06-02 21:42:14 +00:00
uv-interpreter Add missing i686 alias for x86 (#3899) 2024-05-29 11:31:39 -04:00
uv-normalize Improve JSON Schema and add export script (#3461) 2024-05-08 16:15:16 +00:00
uv-requirements Remove some `anyhow` usages (#3962) 2024-06-01 20:11:23 +00:00
uv-resolver Remove some `anyhow` usages (#3962) 2024-06-01 20:11:23 +00:00
uv-state Add persistent storage of installed toolchains (#3797) 2024-05-27 03:54:49 +00:00
uv-trampoline Support x86 windows (#3873) 2024-05-28 16:07:39 +00:00
uv-types Add Git resolver in lieu of static hash map (#3954) 2024-05-31 22:44:42 -04:00
uv-version Bump version to v0.2.5 (#3885) 2024-05-28 18:05:32 +00:00
uv-virtualenv Rewrite Python interpreter discovery (#3266) 2024-05-21 14:37:23 -05:00
uv-warnings Rename to `uv` (#1302) 2024-02-15 11:19:46 -06:00
uv-workspace Fix workspace settings - remove deny unknown fields (#3907) 2024-05-29 11:31:07 -04:00
README.md Rename `uv-traits` and split into separate modules (#2674) 2024-03-26 15:39:43 -05:00

README.md

Crates

bench

Functionality for benchmarking uv.

cache-key

Generic functionality for caching paths, URLs, and other resources across platforms.

distribution-filename

Parse built distribution (wheel) and source distribution (sdist) filenames to extract structured metadata.

distribution-types

Abstractions for representing built distributions (wheels) and source distributions (sdists), and the sources from which they can be downloaded.

install-wheel-rs

Install built distributions (wheels) into a virtual environment.]

once-map

A waitmap-like concurrent hash map for executing tasks exactly once.

pep440-rs

Utilities for interacting with Python version numbers and specifiers.

pep508-rs

Utilities for interacting with PEP 508 dependency specifiers.

platform-host

Functionality for detecting the current platform (operating system, architecture, etc.).

platform-tags

Functionality for parsing and inferring Python platform tags as per PEP 425.

uv

Command-line interface for the uv package manager.

uv-build

A PEP 517-compatible build frontend for uv.

uv-cache

Functionality for caching Python packages and associated metadata.

uv-client

Client for interacting with PyPI-compatible HTTP APIs.

uv-dev

Development utilities for uv.

uv-dispatch

A centralized struct for resolving and building source distributions in isolated environments. Implements the traits defined in uv-types.

uv-distribution

Client for interacting with built distributions (wheels) and source distributions (sdists). Capable of fetching metadata, distribution contents, etc.

uv-extract

Utilities for extracting files from archives.

uv-fs

Utilities for interacting with the filesystem.

uv-git

Functionality for interacting with Git repositories.

uv-installer

Functionality for installing Python packages into a virtual environment.

uv-interpreter

Functionality for detecting and leveraging the current Python interpreter.

uv-normalize

Normalize package and extra names as per Python specifications.

uv-package

Types and functionality for working with Python packages, e.g., parsing wheel files.

uv-requirements

Utilities for reading package requirements from pyproject.toml and requirements.txt files.

uv-resolver

Functionality for resolving Python packages and their dependencies.

uv-types

Shared traits for uv, to avoid circular dependencies.

pypi-types

General-purpose type definitions for types used in PyPI-compatible APIs.

uv-virtualenv

A venv replacement to create virtual environments in Rust.

uv-warnings

User-facing warnings for uv.

requirements-txt

Functionality for parsing requirements.txt files.