Commit graph

226 commits

Author SHA1 Message Date
Zanie Blue
110c38e549
Improve the project creation documentation (#9236) 2024-11-20 08:50:14 -06:00
Zanie Blue
20eccc157c
Improve content on project configuration (#9235) 2024-11-20 08:49:51 -06:00
Zanie Blue
ca9aaf1c48
Reorganize the project concept documentation (#9121)
- Adds a collapsible section for the project concept
- Splits the project concept document into several child documents.
- Moves the workspace and dependencies documents to under the project
section
- Adds a mkdocs plugin for redirects, so links to the moved documents
still work

I attempted to make the minimum required changes to the contents of the
documents here. There is a lot of room for improvement on the content of
each new child document. For review purposes, I want to do that work
separately. I'd prefer if the review focused on this structure and idea
rather than the content of the files.

I expect to do this to other documentation pages that would otherwise be
very nested.

The project concept landing page and nav (collapsed by default) looks
like this now:

<img width="1507" alt="Screenshot 2024-11-14 at 11 28 45 AM"
src="https://github.com/user-attachments/assets/88288b09-8463-49d4-84ba-ee27144b62a5">
2024-11-19 13:52:12 -06:00
Charlie Marsh
e4fc875afa
Allow conflicting extras in explicit index assignments (#9160)
## Summary

This PR enables something like the "final boss" of PyTorch setups --
explicit support for CPU vs. GPU-enabled variants via extras:

```toml
[project]
name = "project"
version = "0.1.0"
requires-python = ">=3.13.0"
dependencies = []

[project.optional-dependencies]
cpu = [
    "torch==2.5.1+cpu",
]
gpu = [
    "torch==2.5.1",
]

[tool.uv.sources]
torch = [
    { index = "torch-cpu", extra = "cpu" },
    { index = "torch-gpu", extra = "gpu" },
]

[[tool.uv.index]]
name = "torch-cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true

[[tool.uv.index]]
name = "torch-gpu"
url = "https://download.pytorch.org/whl/cu124"
explicit = true

[tool.uv]
conflicts = [
    [
        { extra = "cpu" },
        { extra = "gpu" },
    ],
]
```

It builds atop the conflicting extras work to allow sources to be marked
as specific to a dedicated extra being enabled or disabled.

As part of this work, sources now have an `extra` field. If a source has
an `extra`, it means that the source is only applied to the requirement
when defined within that optional group. For example, `{ index =
"torch-cpu", extra = "cpu" }` above only applies to
`"torch==2.5.1+cpu"`.

The `extra` field does _not_ mean that the source is "enabled" when the
extra is activated. For example, this wouldn't work:

```toml
[project]
name = "project"
version = "0.1.0"
requires-python = ">=3.13.0"
dependencies = ["torch"]

[tool.uv.sources]
torch = [
    { index = "torch-cpu", extra = "cpu" },
    { index = "torch-gpu", extra = "gpu" },
]

[[tool.uv.index]]
name = "torch-cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true

[[tool.uv.index]]
name = "torch-gpu"
url = "https://download.pytorch.org/whl/cu124"
explicit = true
```

In this case, the sources would effectively be ignored. Extras are
really confusing... but I think this is correct? We don't want enabling
or disabling extras to affect resolution information that's _outside_ of
the relevant optional group.
2024-11-19 01:06:25 +00:00
Andrew Gallant
ed130b0c11
docs: add some words about specifying conflicting extras/groups (#9120)
This doesn't cover the optional `package` key since I wasn't quite sure
how to articulate its utility in a digestible way.

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-11-14 13:50:18 -06:00
Kasper Zutterman
f508ef038c
Fix reference to --resolution in docs (#8968)
<!--
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

<!-- What's the purpose of the change? What does it do, and why? -->
Update `resolution` to `--resolution`, so it's aligned with the rest of
the resolution documentation, and copy-pastable for usage.

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2024-11-09 13:43:53 +00:00
Zanie Blue
9a04b7fbeb
Add project boundary note (#8900)
Some checks are pending
CI / integration test | github actions (push) Blocked by required conditions
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 | 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 | pypy on ubuntu (push) Blocked by required conditions
CI / check system | pyston (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 | 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 | 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
CI / check system | embedded python3.10 on windows (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
2024-11-07 15:49:14 -06:00
Zanie Blue
daa929a96e Add docs for .python-version file discovery (#8898) 2024-11-07 14:29:54 -06:00
k_fukuchi
545a55f58f
Fix indentation in projects.md (#8772)
## Summary

Fix indentation in `projects.md`
2024-11-03 08:28:08 -06:00
Trevor Manz
a90a8e7a61
Fix add httpx example with real git branch (#8756)
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 | python on ubuntu (push) Blocked by required conditions
CI / check system | python on opensuse (push) Blocked by required conditions
CI / check system | homebrew python on macos aarch64 (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 | pypy on ubuntu (push) Blocked by required conditions
CI / check system | pyston (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 | 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 | 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
CI / check system | embedded python3.10 on windows (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
<!--
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

The example in the docs for adding a git source with `--branch` fails
because `main` doesn't exist.

```sh
uv add git+https://github.com/encode/httpx --branch main
# error: Git operation failed
#   Caused by: failed to fetch into: /Users/manzt/.cache/uv/git-v0/db/4c0b1441d92956e1
#   Caused by: failed to fetch branch `main`
#   Caused by: process didn't exit successfully: `/usr/bin/git fetch --force --update-head-ok 'https://github.com/encode/httpx' '+refs/heads/main:refs/remotes/origin/main'` (exit status: 128)
```

This PR changes the example to the default branch for httpx, `master`.

<!-- What's the purpose of the change? What does it do, and why? -->

## Test Plan

N/A

<!-- How was it tested? -->
2024-11-01 13:03:21 -04:00
Charlie Marsh
988ac749f4
Clarify requires-python requirement for dependencies (#8619)
## Summary

Closes https://github.com/astral-sh/uv/issues/8597.
2024-10-28 00:52:55 +00:00
Zanie Blue
4df9ab2b58 Fix inclusion or exclusion of dependencies 2024-10-25 13:27:37 -05:00
Zanie Blue
3014d28229 Add documentation for PEP 735 support (#8566)
This adds the minimal documentation I think we need to release PEP 735
support.

I want to add documentation on `include-group` and such but that can
come after.

I also want to restructure some of the project dependency documentation,
but that will be easier once this all lands in `main`.
2024-10-25 13:27:37 -05:00
Charlie Marsh
2e028cd3b6 Rewrite some references to "optional groups" (#8454)
## Summary

We generally want to avoid references to "optional groups" now that
dependency groups are a first-class, standardized concept.
2024-10-25 13:27:37 -05:00
Charlie Marsh
2651aee33f
Enforce lockfile schema versions (#8509)
## Summary

Historically, we haven't enforced schema versions. This PR adds a
versioning policy such that, if a uv version writes schema v2, then...

- It will always reject lockfiles with schema v3 or later.
- It _may_ reject lockfiles with schema v1, but can also choose to read
them, if possible.

(For example, the change we proposed to rename `dev-dependencies` to
`dependency-groups` would've been backwards-compatible: newer versions
of uv could still read lockfiles that used the `dev-dependencies` field
name, but older versions should reject lockfiles that use the
`dependency-groups` field name.)

Closes https://github.com/astral-sh/uv/issues/8465.
2024-10-24 12:23:56 -04:00
Charles Tapley Hoyt
109abf5037
Improve documentation of manually adding branch, rev, and tag (#8497)
Closes #8490 by improving the documentation to make it more obvious how
to manually edit the `pyproject.toml` if you want to explicitly set the
branch, rev (commit), or tag.

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2024-10-23 16:12:01 +00:00
Charlie Marsh
fa14ea44b9
Add docs example for URLs with [tool.uv.dependency-metadata] (#8484) 2024-10-23 02:19:14 +00:00
Charlie Marsh
cc734ea2b6
Allow dependency metadata entries for direct URL requirements (#7846)
## Summary

This is part of making
https://github.com/astral-sh/uv/issues/7299#issuecomment-2385286341
better. You can now use `tool.uv.dependency-metadata` for direct URL
requirements. Unfortunately, you _must_ include a version, since we need
one to perform resolution.
2024-10-22 22:01:23 -04:00
konsti
c09edf9854
More specific workspaces recommendation (#8478)
Workspaces should be used over editable installs if the packages are all
part of the same repository.
2024-10-22 20:45:53 -04:00
konsti
0dd4d017e3
Link to Dependency specifiers instead of PEP 508 (#8411)
The canonical source is
https://packaging.python.org/en/latest/specifications/dependency-specifiers/,
not PEP 508 anymore, so we should link there and use the new name.
2024-10-21 14:43:38 -04:00
Charlie Marsh
e8b8daf0fb
Fix cache-keys typo in tags = true (#8422)
Closes https://github.com/astral-sh/uv/issues/8421.
2024-10-21 17:35:22 +00:00
Charlie Marsh
e9f1161b95
Modify cache versioning to support backwards compatibility (#8386)
## Summary

Going forward, we're going to provide better versioning guarantees
around using the same cache across multiple uv versions, so this PR
updates the docs to reflect that. It also bumps the `sdists-` version to
fix the inconvenience demonstrated in
https://github.com/astral-sh/uv/issues/8367.

Closes https://github.com/astral-sh/uv/issues/8367.
2024-10-20 16:48:04 +00:00
Charlie Marsh
7730861bc5
Allow users to incorporate Git tags into dynamic cache keys (#8259)
## Summary

You can now use `cache-keys = [{ git = { commit = true, tags = true }
}]` to include both the current commit and set of tags in the cache key.

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

Closes https://github.com/astral-sh/uv/issues/7997.
2024-10-16 11:13:29 -04:00
samypr100
319c0183c6
Add templates for popular build backends (#7857)
Co-authored-by: konstin <konstin@mailbox.org>
2024-10-16 14:19:59 +02:00
Jo
ea0c32df8c
docs: remove "Only a single source may be defined for each dependency" (#8243)
After #7745, mutiple sources are supported.
2024-10-16 08:19:44 -04:00
Charlie Marsh
9a76e47888
Allow multiple pinned indexes in tool.uv.sources (#7769)
## Summary

This PR lifts the restriction that a package must come from a single
index. For example, you can now do:

```toml
[project]
name = "project"
version = "0.1.0"
readme = "README.md"
requires-python = ">=3.12"
dependencies = ["jinja2"]

[tool.uv.sources]
jinja2 = [
    { index = "torch-cu118", marker = "sys_platform == 'darwin'"},
    { index = "torch-cu124", marker = "sys_platform != 'darwin'"},
]

[[tool.uv.index]]
name = "torch-cu118"
url = "https://download.pytorch.org/whl/cu118"

[[tool.uv.index]]
name = "torch-cu124"
url = "https://download.pytorch.org/whl/cu124"
```

The construction is very similar to the way we handle URLs today: you
can have multiple URLs for a given package, but they must appear in
disjoint forks. So most of the code is just adding that abstraction to
the resolver, following our handling of URLs.

Closes #7761.
2024-10-15 22:58:15 +00:00
Charlie Marsh
5b391770df
Add support for named and explicit indexes (#7481)
## Summary

This PR adds a first-class API for defining registry indexes, beyond our
existing `--index-url` and `--extra-index-url` setup.

Specifically, you now define indexes like so in a `uv.toml` or
`pyproject.toml` file:

```toml
[[tool.uv.index]]
name = "pytorch"
url = "https://download.pytorch.org/whl/cu121"
```

You can also provide indexes via `--index` and `UV_INDEX`, and override
the default index with `--default-index` and `UV_DEFAULT_INDEX`.

### Index priority

Indexes are prioritized in the order in which they're defined, such that
the first-defined index has highest priority.

Indexes are also inherited from parent configuration (e.g., the
user-level `uv.toml`), but are placed after any indexes in the current
project, matching our semantics for other array-based configuration
values.

You can mix `--index` and `--default-index` with the legacy
`--index-url` and `--extra-index-url` settings; the latter two are
merely treated as unnamed `[[tool.uv.index]]` entries.

### Index pinning

If an index includes a name (which is optional), it can then be
referenced via `tool.uv.sources`:

```toml
[[tool.uv.index]]
name = "pytorch"
url = "https://download.pytorch.org/whl/cu121"

[tool.uv.sources]
torch = { index = "pytorch" }
```

If an index is marked as `explicit = true`, it can _only_ be used via
such references, and will never be searched implicitly:

```toml
[[tool.uv.index]]
name = "pytorch"
url = "https://download.pytorch.org/whl/cu121"
explicit = true

[tool.uv.sources]
torch = { index = "pytorch" }
```

Indexes defined outside of the current project (e.g., in the user-level
`uv.toml`) can _not_ be explicitly selected.

(As of now, we only support using a single index for a given
`tool.uv.sources` definition.)

### Default index

By default, we include PyPI as the default index. This remains true even
if the user defines a `[[tool.uv.index]]` -- PyPI is still used as a
fallback. You can mark an index as `default = true` to (1) disable the
use of PyPI, and (2) bump it to the bottom of the prioritized list, such
that it's used only if a package does not exist on a prior index:

```toml
[[tool.uv.index]]
name = "pytorch"
url = "https://download.pytorch.org/whl/cu121"
default = true
```

### Name reuse

If a name is reused, the higher-priority index with that name is used,
while the lower-priority indexes are ignored entirely.

For example, given:

```toml
[[tool.uv.index]]
name = "pytorch"
url = "https://download.pytorch.org/whl/cu121"

[[tool.uv.index]]
name = "pytorch"
url = "https://test.pypi.org/simple"
```

The `https://test.pypi.org/simple` index would be ignored entirely,
since it's lower-priority than `https://download.pytorch.org/whl/cu121`
but shares the same name.

Closes #171.

## Future work

- Users should be able to provide authentication for named indexes via
environment variables.
- `uv add` should automatically write `--index` entries to the
`pyproject.toml` file.
- Users should be able to provide multiple indexes for a given package,
stratified by platform:
```toml
[tool.uv.sources]
torch = [
  { index = "cpu", markers = "sys_platform == 'darwin'" },
  { index = "gpu", markers = "sys_platform != 'darwin'" },
]
```
- Users should be able to specify a proxy URL for a given index, to
avoid writing user-specific URLs to a lockfile:
```toml
[[tool.uv.index]]
name = "test"
url = "https://private.org/simple"
proxy = "http://<omitted>/pypi/simple"
```
2024-10-15 18:24:23 -04:00
Charlie Marsh
855c1917e1
Respect [tool.uv.sources] in build requirements (#7172)
## Summary

We weren't respecting `tool.uv.sources` for `build-requires`.

Closes https://github.com/astral-sh/uv/issues/7147.
2024-10-15 15:31:04 +00:00
Adam Dangoor
9351652e32
Update dependencies.md with typo fix (stands -> standards) (#8142) 2024-10-12 13:53:36 +01:00
David Szotten
7b9b690b02
document --reinstall with --exclude-newer to ensure downgrades (#6721)
fixes #6676
2024-10-09 23:03:31 +00:00
Zanie Blue
ab80bf5f10
Clarify project environment creation a little (#7941)
Closes https://github.com/astral-sh/uv/issues/7940
2024-10-05 15:02:04 +00:00
bluss
67769a4985
packaged app: use executable named for the project and main function (#7670)
## Summary

Create a function main as the default for a packaged app. Configure the
default executable as:

`example-packaged-app = "example_packaged_app:main"`

Which is often what you want - the executable has the same name as the
app.
The purpose is to more often hit what the user wants, so they don't have
to even rename the command to start developing.

## Test Plan

- existing tests are updated
2024-09-30 17:19:36 -05:00
Charlie Marsh
f67347e72c
Allow multiple source entries for each package in tool.uv.sources (#7745)
## Summary

This PR enables users to provide multiple source entries in
`tool.uv.sources`, e.g.:

```toml
[tool.uv.sources]
httpx = [
  { git = "https://github.com/encode/httpx", tag = "0.27.2", marker = "sys_platform == 'darwin'" },
  { git = "https://github.com/encode/httpx", tag = "0.24.1", marker = "sys_platform == 'linux'" },
]
```

The implementation is relatively straightforward: when we lower the
requirement, we now return an iterator rather than a single requirement.
In other words, the above is transformed into two requirements:

```txt
httpx @ git+https://github.com/encode/httpx@0.27.2 ; sys_platform == 'darwin'
httpx @ git+https://github.com/encode/httpx@0.24.1 ; sys_platform == 'linux'
```

We verify (at deserialization time) that the markers are
non-overlapping.

Closes https://github.com/astral-sh/uv/issues/3397.
2024-09-30 21:16:44 +00:00
Sebastián Ramírez
5fc1495c54
✏️ Fix typo in projects.md (#7784)
## Summary

✏️ Fix typo in `projects.md`

<!-- What's the purpose of the change? What does it do, and why? -->

## Test Plan

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

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2024-09-29 19:40:45 +00:00
Charlie Marsh
a3abd89ab0
Note that uv lock --upgrade-package retains locked versions (#7694)
Closes https://github.com/astral-sh/uv/issues/7672.
2024-09-25 22:17:55 +00:00
Charlie Marsh
cc2aa8855a
Add documentation on cache versioning (#7693)
Closes https://github.com/astral-sh/uv/issues/7547.
2024-09-25 22:13:02 +00:00
Jacob Coffee
8259600ca6
Fix - to _ in Packaged applications doc (#7571)
## Summary

Small stale/typo char in docs when generating a project

```
➜ ntp -v uv-test && uv venv --python 3.12 --seed && uv init --app --package example-packaged-app
Directory /tmp/testing/uv-test created and switched to.
Using Python 3.12.4 interpreter at: /Users/coffee/.local/share/mise/installs/python/3.12/bin/python3.12
Creating virtual environment with seed packages at: .venv
 + pip==24.2
Activate with: source .venv/bin/activate.fish
Virtual environment created with Python 3.12 and activated.
Using Python 3.12.4 interpreter at: /Users/coffee/.local/share/mise/installs/python/3.12/bin/python3.12
Creating virtual environment with seed packages at: .venv
 + pip==24.2
Activate with: source .venv/bin/activate.fish
Initialized project `example-packaged-app` at `/private/tmp/testing/uv-test/example-packaged-app`

/tmp/testing/uv-test via  pyenv (uv-test) on ☁  (us-east-2)
➜ tree
   0 B    ┌─ README.md
4096 B    ├─ pyproject.toml
4096 B    │     ┌─ __init__.py
4096 B    │  ┌─ example_packaged_app
4096 B    ├─ src
8192 B ┌─ example-packaged-app
8192 B uv-test
```

## Test Plan

Eyeballs
2024-09-20 08:47:53 +02:00
Charlie Marsh
fda227616c
Allow users to provide pre-defined metadata for resolution (#7442)
## Summary

This PR enables users to provide pre-defined static metadata for
dependencies. It's intended for situations in which the user depends on
a package that does _not_ declare static metadata (e.g., a
`setup.py`-only sdist), and that is expensive to build or even cannot be
built on some architectures. For example, you might have a Linux-only
dependency that can't be built on ARM -- but we need to build that
package in order to generate the lockfile. By providing static metadata,
the user can instruct uv to avoid building that package at all.

For example, to override all `anyio` versions:

```toml
[project]
name = "project"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = ["anyio"]

[[tool.uv.dependency-metadata]]
name = "anyio"
requires-dist = ["iniconfig"]
```

Or, to override a specific version:

```toml
[project]
name = "project"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = ["anyio"]

[[tool.uv.dependency-metadata]]
name = "anyio"
version = "3.7.0"
requires-dist = ["iniconfig"]
```

The current implementation uses `Metadata23` directly, so we adhere to
the exact schema expected internally and defined by the standards. Any
entries are treated similarly to overrides, in that we won't even look
for `anyio@3.7.0` metadata in the above example. (In a way, this also
enables #4422, since you could remove a dependency for a specific
package, though it's probably too unwieldy to use in practice, since
you'd need to redefine the _rest_ of the metadata, and do that for every
package that requires the package you want to omit.)

This is under-documented, since I want to get feedback on the core ideas
and names involved.

Closes https://github.com/astral-sh/uv/issues/7393.
2024-09-18 03:18:05 +00:00
Charlie Marsh
778da3350a
Add --no-editable support to uv sync and uv export (#7371)
## Summary

Closes https://github.com/astral-sh/uv/issues/5792.
2024-09-17 14:50:36 +00:00
Charlie Marsh
9f7d9da449
Prune unzipped source distributions in uv cache prune --ci (#7446)
## Summary

It's very unlikely that retaining these is beneficial, since you tend to
partition the cache by platform anyway.

Closes https://github.com/astral-sh/uv/issues/7394.
2024-09-16 19:18:20 -04:00
Charlie Marsh
8d4b6ca971
Add documentation on platform-specific dependencies (#7411)
## Summary

Closes https://github.com/astral-sh/uv/issues/6758.
2024-09-15 17:55:37 -04:00
Aditya Pratap Singh
3d62154849
Add support for remaining pip-supported file extensions (#7387)
closes #7365 

Summary

This pull request adds support for additional file extension aliases in
the SourceDistExtension and ExtensionError enums. The newly supported
file extensions include .tbz, .tgz, .txz, .tar.lz, .tar.lzma. These
changes align the extensions supported by the SourceDistExtension with
those used in Python packaging tools, enhancing compatibility with a
broader range of source distribution formats.

Test Plan
should be added or updated to verify that the new extensions are
correctly recognized as valid source distributions and that errors are
correctly raised when unsupported extensions are provided.
2024-09-14 19:59:07 +00:00
Aditya Pratap Singh
adcb67a882
Fix documentation typos for uv build --build-constraint flag (#7330)
Summary

This pull request fixes a typo in the --build-constraints flag, which
should be singular (--build-constraint). This update ensures consistency
across the documentation and prevents potential confusion for users.

Closes #7315

## Test Plan
The change was verified by reviewing the relevant documentation files
where the flag is referenced. No functional code changes were made, so
no additional testing is required beyond confirming the documentation
update.

## Tested
The change was tested by visually inspecting the updated documentation
to confirm that the typo has been corrected
2024-09-12 14:07:33 -05:00
Zanie Blue
f22e5ef69a
Avoid selecting prerelease Python installations without opt-in (#7300)
Similar to our semantics for packages with pre-release versions.

We will not use prerelease versions unless there are only prerelease
versions available, a specific version is requested,
or the prerelease version is found in a reasonable source (active
environment, explicit path, etc. but not `PATH`).

For example, `uv python install 3.13 && uv run python --version` will no
longer use `3.13.0rc2` unless that is the only Python version available,
`--python 3.13` is used, or that's the Python version that is present in
`.venv`.
2024-09-11 15:49:33 -05:00
Charlie Marsh
58a157a0ad
Support globs as cache keys in tool.uv.cache-keys (#7268)
## Summary

This has been asked for a few times. There are risks that these checks
could be slow, but they're buyer-beware.

Closes https://github.com/astral-sh/uv/issues/7246.
2024-09-11 15:30:59 -04:00
Charlie Marsh
3f011f3b7b
Add uv run --no-sync (#7192)
## Summary

When `--no-sync` is provided, we won't lock or sync, but we will run the
command in the project environment.

Closes https://github.com/astral-sh/uv/issues/7165.
2024-09-10 17:29:43 -04:00
Zanie Blue
b5cc913d5c
Create py.typed files during uv init --lib (#7232) 2024-09-10 15:16:00 -05:00
Vivien Maisonneuve
e87d8e719d
Fix typo in docs: cache-key -> cache-keys (#7244)
## Summary

The new entry is `tool.uv.cache-keys` (with an `s`), not
`tool.uv.cache-key`.
2024-09-10 09:25:25 -04:00
Bartosz Sławecki
5905f40f50
Use type hints in code from uv init (#7225)
Let's promote type hints!

<!--
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

<!-- What's the purpose of the change? What does it do, and why? -->
The generated script now annotates the return type of the dummy function
`hello()`.

## Test Plan

<!-- How was it tested? -->
All existing tests have been synced with this update.
2024-09-09 15:37:21 -05:00
Charlie Marsh
4f2349119c
Add support for dynamic cache keys (#7136)
## Summary

This PR adds a more flexible cache invalidation abstraction for uv, and
uses that new abstraction to improve support for dynamic metadata.

Specifically, instead of relying solely on a timestamp, we now pass
around a `CacheInfo` struct which (as of now) contains
`Option<Timestamp>` and `Option<Commit>`. The `CacheInfo` is saved in
`dist-info` as `uv_cache.json`, so we can test already-installed
distributions for cache validity (along with testing _cached_
distributions for cache validity).

Beyond the defaults (`pyproject.toml`, `setup.py`, and `setup.cfg`
changes), users can also specify additional cache keys, and it's easy
for us to extend support in the future. Right now, cache keys can either
be instructions to include the current commit (for `setuptools_scm` and
similar) or file paths (for `hatch-requirements-txt` and similar):

```toml
[tool.uv]
cache-keys = [{ file = "requirements.txt" }, { git = true }]
```

This change should be fully backwards compatible.

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

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

Closes https://github.com/astral-sh/uv/issues/6860.
2024-09-09 20:19:15 +00:00