Commit graph

884 commits

Author SHA1 Message Date
Charlie Marsh
82d94838cb
Implement a --verify-hashes hash-checking mode (#4007)
## Summary

This is an alternative to `--require-hashes` which will validate a hash
if it's present, but ignore requirements that omit hashes or are absent
from the lockfile entirely.

So, e.g., transitive dependencies that are missing will _not_ error; nor
will dependencies that are included but lack a hash.

Closes https://github.com/astral-sh/uv/issues/3305.
2024-07-17 21:25:31 +00:00
Charlie Marsh
70c1e5926a
Fix reference to projects.md (#5154) 2024-07-17 13:45:48 -04:00
Charlie Marsh
fe403576c5
Bump version to v0.2.26 (#5149) 2024-07-17 12:51:11 -04:00
Charlie Marsh
a191f84929
Autogenerate possible values for enums in reference documentation (#5137)
## Summary

For example:

![Screenshot 2024-07-16 at 7 44
10 PM](https://github.com/user-attachments/assets/73ce16ba-eb0e-43c4-a741-65a54637452f)

Closes https://github.com/astral-sh/uv/issues/5129.
2024-07-17 12:37:33 -04:00
Zanie Blue
67050932fa
We will find your Python (#5145)
https://github.com/astral-sh/uv/pull/5133#discussion_r1681179083
2024-07-17 14:46:12 +00:00
Zanie Blue
4027d0797e
Add install notes for anti-curl | sh users (#5131)
Co-authored-by: Andrew Gallant <andrew@astral.sh>
2024-07-17 09:29:16 -05:00
Zanie Blue
690a7b1cee
Improve PyPI install docs (#5118) 2024-07-17 09:29:02 -05:00
Zanie Blue
b1501e64e2
Touch-ups to the Python installation guide (#5133) 2024-07-17 09:28:55 -05:00
Mathieu Kniewallner
c9637f00f0
docs: bunch of fixes and improvements (#5136)
## Summary

A bunch of fixes and improvements on different parts of the
documentation. For Docker documentation changes, links to the relevant
documentations have been included in the commit messages.
2024-07-16 20:41:45 -04:00
Zanie Blue
177bbaa8c0
Add stubs for the project documentation (#5135)
@ibraheemdev is going to do some work on these, I just sketched out some
parts to try to understand how things will fit together.
2024-07-16 17:02:54 -05:00
Mathieu Kniewallner
e28d128388
docs: update dev dependencies (#5132)
<!--
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

While playing out with `uv` preview features, I've noticed 2 issues with
the development dependencies documentation:
- it is mentioned that the feature is not implemented, but it looks like
it actually is
- despite what is said, it doesn't seem that it's possible to use a map
for development dependencies yet:
  ```toml
  [tool.uv.dev-dependencies]
  test = [
      "pytest >=8.1.1,<9"
  ]
  lint = [
      "mypy >=1,<2"
  ]

  [tool.uv]
  default-dev-dependencies = ["test"]
  ```

  ```console
  $ uv sync --preview
  error: Failed to parse: `pyproject.toml`
    Caused by: TOML parse error at line 32, column 1
     |
  32 | [tool.uv.dev-dependencies]
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^
  invalid type: map, expected a sequence
  ```
2024-07-16 16:20:24 -05:00
Charlie Marsh
7211e62132
Add reference documentation for pip settings (#5125)
## Summary

Third part of https://github.com/astral-sh/uv/issues/5093.
2024-07-16 21:14:27 +00:00
Charlie Marsh
f7c52fdbfb
Add reference documentation for global settings (#5123)
## Summary

Second part of: https://github.com/astral-sh/uv/issues/5093.
2024-07-16 20:50:04 +00:00
Charlie Marsh
616a61a244
Add reference documentation for resolver settings (#5122)
## Summary

First part of https://github.com/astral-sh/uv/issues/5093.

Remaining:

- Global settings
- `pip`-specific settings (some will be copied-over from here)
- Auto-generating the "Possible values" for enums
2024-07-16 16:39:22 -04:00
Zanie Blue
ca85767aff
Reference the root requirements from the insiders requirements file (#5105)
Seems best not to duplicate these
2024-07-16 09:51:16 -05:00
Charlie Marsh
6d0e6eea6f
Fix depth of settings headers (#5103)
Closes https://github.com/astral-sh/uv/issues/5092.
2024-07-16 14:00:03 +00:00
Charlie Marsh
f992532f78
Fix benchmark image in documentation (#5102) 2024-07-16 13:54:06 +00:00
Charlie Marsh
e61a221fef
Migrate from MdBook to MkDocs (#5062)
## Summary

We want to have consistency between the Ruff and uv documentation for
the upcoming release. We don't love the Ruff docs, but we'd rather have
consistency and then work towards improving them both, rather than have
two very-different documentation sites that both have weaknesses.

The setup here is simpler than in Ruff as: (1) we don't yet generate any
docs from Rust and (2) we don't try to reuse the README in the uv
documentation (which adds a lot of complexity in Ruff). So the change
here is mostly a 1-to-1 port to MkDocs.

## Test Plan

![Screenshot 2024-07-14 at 9 49
15 PM](https://github.com/user-attachments/assets/8bfb5b06-08ff-4329-b368-d9087b78996e)
2024-07-15 22:22:07 +00:00
Zanie Blue
35b268a614
Add guide for tools (#4982)
Co-authored-by: Ibraheem Ahmed <ibraheem@ibraheem.ca>
2024-07-15 22:04:18 +00:00
Zanie Blue
1888520444
Add documentation for running scripts (#4968)
Co-authored-by: Ibraheem Ahmed <ibraheem@ibraheem.ca>
2024-07-15 21:59:39 +00:00
Charlie Marsh
41cd4bee58
Add a generate-all step and auto-generate settings.md (#5080)
## Summary

Ensures that `generate-all` generates both the JSON Schema and the
`settings.md` API reference.
2024-07-15 19:58:53 +00:00
Benjamin Hodgson
a5deb43be8
Docs: Add guide for authenticating to Azure Artifacts (#4857)
## Summary

As discussed in #3542 - there has been some confusion about how to get
`uv` to work with ADO Artifacts so I'm adding a quick guide.

## Test Plan

Smoke-tested the examples on my machine.
2024-07-15 11:06:50 -05:00
Zanie Blue
42cb2541b5
Remove extra "project" docs files (#4977) 2024-07-10 17:38:13 -05:00
Zanie Blue
067b3ee666
Add some references to more details in the Python install guide (#4962) 2024-07-10 10:37:53 -05:00
Zanie Blue
5b6dffe522
Update "Python versions" documentation (#4943)
Replacing references to toolchains
2024-07-10 01:07:27 +00:00
Zanie Blue
e01022d75b
Add Python installation guide (#4942)
Note some of this behavior does not exist yet.
2024-07-09 20:05:59 -05:00
Zanie Blue
dd7da6af5f
Change "toolchain" to "python" (#4735)
Whew this is a lot.

The user-facing changes are:

- `uv toolchain` to `uv python` e.g. `uv python find`, `uv python
install`, ...
- `UV_TOOLCHAIN_DIR` to` UV_PYTHON_INSTALL_DIR`
- `<UV_STATE_DIR>/toolchains` to `<UV_STATE_DIR>/python` (with
[automatic
migration](https://github.com/astral-sh/uv/pull/4735/files#r1663029330))
- User-facing messages no longer refer to toolchains, instead using
"Python", "Python versions" or "Python installations"

The internal changes are:

- `uv-toolchain` crate to `uv-python`
- `Toolchain` no longer referenced in type names
- Dropped unused `SystemPython` type (previously replaced)
- Clarified the type names for "managed Python installations"
- (more little things)
2024-07-03 07:44:29 -05:00
Zanie Blue
12e12d066d
Restructure documentation sections to focus on new user experience (#4586)
Moving the preview features to top-level concepts and pushing the
pip-compatible interface down.

e.g.

<img width="291" alt="Screenshot 2024-06-27 at 7 03 48 AM"
src="500ad97d-899d-4051-b59d-e74786b3a45f">
2024-07-02 11:44:45 -05:00
Zanie Blue
f7fb5a4061
Add page for contributing to the docs (#4562) 2024-06-27 07:27:58 -05:00
Zanie Blue
1ee201da5a
Add structured documentation (#4426)
A ton of work remaining here, pushing so I can preview things rendered.

Here's the [latest rendered
documentation](https://astral-sh.github.io/uv/).
2024-06-26 11:28:42 -05:00
Zanie Blue
e89196f969
Add documentation for using uv in a Docker image (#4433)
[Rendered](https://github.com/astral-sh/uv/blob/zb/docker/docs/docker.md)
2024-06-21 09:49:34 -05:00
Nyakku Shigure
9ef652d234
Fix PEP 508 link in preview doc specifying_dependencies (#4158)
<!--
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? -->

Fix PEP 508 link.

## Test Plan

See preview
https://github.com/SigureMo/uv/blob/fix-pep508-link-in-preview-doc/docs/specifying_dependencies.md
2024-06-08 08:54:02 -05:00
konsti
1eb968fa73
Draft for user docs for workspaces (#3866)
These docs are not yet meant to be consumed by end users, for now they
allow sharing the state of workspace support in terms of features that
are relevant to users, and to gather feedback on the design. We can
progressively update this doc as workspace support matures.
2024-06-01 16:13:11 -04:00
konsti
4f87edbe66
Add basic tool.uv.sources support (#3263)
## Introduction

PEP 621 is limited. Specifically, it lacks
* Relative path support
* Editable support
* Workspace support
* Index pinning or any sort of index specification

The semantics of urls are a custom extension, PEP 440 does not specify
how to use git references or subdirectories, instead pip has a custom
stringly format. We need to somehow support these while still stying
compatible with PEP 621.

## `tool.uv.source`

Drawing inspiration from cargo, poetry and rye, we add `tool.uv.sources`
or (for now stub only) `tool.uv.workspace`:

```toml
[project]
name = "albatross"
version = "0.1.0"
dependencies = [
  "tqdm >=4.66.2,<5",
  "torch ==2.2.2",
  "transformers[torch] >=4.39.3,<5",
  "importlib_metadata >=7.1.0,<8; python_version < '3.10'",
  "mollymawk ==0.1.0"
]

[tool.uv.sources]
tqdm = { git = "https://github.com/tqdm/tqdm", rev = "cc372d09dcd5a5eabdc6ed4cf365bdb0be004d44" }
importlib_metadata = { url = "https://github.com/python/importlib_metadata/archive/refs/tags/v7.1.0.zip" }
torch = { index = "torch-cu118" }
mollymawk = { workspace = true }

[tool.uv.workspace]
include = [
  "packages/mollymawk"
]

[tool.uv.indexes]
torch-cu118 = "https://download.pytorch.org/whl/cu118"
```

See `docs/specifying_dependencies.md` for a detailed explanation of the
format. The basic gist is that `project.dependencies` is what ends up on
pypi, while `tool.uv.sources` are your non-published additions. We do
support the full range or PEP 508, we just hide it in the docs and
prefer the exploded table for easier readability and less confusing with
actual url parts.

This format should eventually be able to subsume requirements.txt's
current use cases. While we will continue to support the legacy `uv pip`
interface, this is a piece of the uv's own top level interface. Together
with `uv run` and a lockfile format, you should only need to write
`pyproject.toml` and do `uv run`, which generates/uses/updates your
lockfile behind the scenes, no more pip-style requirements involved. It
also lays the groundwork for implementing index pinning.

## Changes

This PR implements:
* Reading and lowering `project.dependencies`,
`project.optional-dependencies` and `tool.uv.sources` into a new
requirements format, including:
  * Git dependencies
  * Url dependencies
  * Path dependencies, including relative and editable
* `pip install` integration
* Error reporting for invalid `tool.uv.sources`
* Json schema integration (works in pycharm, see below)
* Draft user-level docs (see `docs/specifying_dependencies.md`)

It does not implement:
* No `pip compile` testing, deprioritizing towards our own lockfile
* Index pinning (stub definitions only)
* Development dependencies
* Workspace support (stub definitions only)
* Overrides in pyproject.toml
* Patching/replacing dependencies

One technically breaking change is that we now require user provided
pyproject.toml to be valid wrt to PEP 621. Included files still fall
back to PEP 517. That means `pip install -r requirements.txt` requires
it to be valid while `pip install -r requirements.txt` with `-e .` as
content falls back to PEP 517 as before.

## Implementation

The `pep508` requirement is replaced by a new `UvRequirement` (name up
for bikeshedding, not particularly attached to the uv prefix). The still
existing `pep508_rs::Requirement` type is a url format copied from pip's
requirements.txt and doesn't appropriately capture all features we
want/need to support. The bulk of the diff is changing the requirement
type throughout the codebase.

We still use `VerbatimUrl` in many places, where we would expect a
parsed/decomposed url type, specifically:
* Reading core metadata except top level pyproject.toml files, we fail a
step later instead if the url isn't supported.
* Allowed `Urls`.
* `PackageId` with a custom `CanonicalUrl` comparison, instead of
canonicalizing urls eagerly.
* `PubGrubPackage`: We eventually convert the `VerbatimUrl` back to a
`Dist` (`Dist::from_url`), instead of remembering the url.
* Source dist types: We use verbatim url even though we know and require
that these are supported urls we can and have parsed.

I tried to make improve the situation be replacing `VerbatimUrl`, but
these changes would require massive invasive changes (see e.g.
https://github.com/astral-sh/uv/pull/3253). A main problem is the ref
`VersionOrUrl` and applying overrides, which assume the same
requirement/url type everywhere. In its current form, this PR increases
this tech debt.

I've tried to split off PRs and commits, but the main refactoring is
still a single monolith commit to make it compile and the tests pass.

## Demo

Adding
d1ae3b85d5/pyproject.json
as json schema (v7) to pycharm for `pyproject.toml`, you can try the IDE
support already:


![pycharm](599082c7-6be5-41c1-a3cd-516092382f8d)


[dove.webm](c293c272-c80b-459d-8c95-8c46a8d198a1)
2024-05-03 21:10:50 +00:00