Commit graph

4903 commits

Author SHA1 Message Date
João Paulo Euko
bb52997ac4
Remove duplicate code from mkdocs template file (#6757)
This PR remove a duplicated code from `mkdocs` template

Fix: #6756
2024-08-28 11:31:30 -04:00
Charlie Marsh
6a8da7dff8
Compare virtual members when invalidating lockfile (#6754)
## Summary

Whether a package is itself virtual isn't captured in the package
metadata, so we have to compare the sources.

Closes https://github.com/astral-sh/uv/issues/6749.
2024-08-28 15:11:16 +00:00
renovate[bot]
1309f24c43
Update Rust crate windows-sys to 0.59.0 (#5785)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [windows-sys](https://togithub.com/microsoft/windows-rs) |
workspace.dependencies | minor | `0.52.0` -> `0.59.0` |

---

### Release Notes

<details>
<summary>microsoft/windows-rs (windows-sys)</summary>

###
[`v0.59.0`](https://togithub.com/microsoft/windows-rs/releases/tag/0.59.0)

[Compare
Source](https://togithub.com/microsoft/windows-rs/compare/0.52.0...0.59.0)

This release includes an update to the
[windows-sys](https://crates.io/crates/windows-sys) crate only. The
`windows-sys` crate is updated very infrequently and only when there is
an explicit need to do so. The 0.59.0 release includes a rollup of API
fixes, updates, and additions since the
[0.52.0](https://togithub.com/microsoft/windows-rs/releases/tag/0.52.0)
release nine months ago. Notably:

- This update introduces support for Arm64EC
([#&#8203;2957](https://togithub.com/microsoft/windows-rs/issues/2957))
- Updated bindings for the latest APIs
https://github.com/microsoft/windows-rs/tree/0.59.0/crates/libs/bindgen/default
- Derive standard traits
([#&#8203;3041](https://togithub.com/microsoft/windows-rs/issues/3041))
-   Updates to code generation to handle newer Rust warnings and lints
- Overall smaller crate and more efficient code gen to reduce build time
- Support for feature search
https://microsoft.github.io/windows-rs/features/#/0.59.0
-   MSRV is updated to 1.60

**Full Changelog**:
https://github.com/microsoft/windows-rs/compare/0.52.0...0.59.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/astral-sh/uv).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM4LjU2LjAiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbImludGVybmFsIl19-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-08-28 08:43:59 -05:00
samypr100
3eee70dfa1
feat: publish tag without patch version (#6734)
## Summary

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

This change would publish an additional tag that includes only
`major.minor`.

For a release with x.y.z, this would publish the tags:
* `ghcr.io/astral-sh/uv:latest`
* `ghcr.io/astral-sh/uv:x.y.z`
* `ghcr.io/astral-sh/uv:x.y`
2024-08-28 08:31:53 -05:00
Zanie Blue
f96b4c7837
Add dependabot and renovate documentation page (#6236)
cc @mkniewallner

---------

Co-authored-by: Mathieu Kniewallner <mathieu.kniewallner@gmail.com>
2024-08-28 07:41:23 -05:00
Charlie Marsh
53ef633c6d
Do not require workspace members to sync with --frozen (#6737)
## Summary

Closes https://github.com/astral-sh/uv/issues/6685.
2024-08-28 07:58:50 -04:00
Charlie Marsh
485e0d2748
Avoid including non-excluded members in parent workspaces (#6735)
## Summary

If you're in a directory, and there's workspace above it, we check if
the directory is excluded from the workspace members... But not if it's
_included_ in the first place.

Closes https://github.com/astral-sh/uv/issues/6732.
2024-08-28 01:39:46 +00:00
Charlie Marsh
56cc0c9b3c
Avoid using editable tag in lockfile for non-package dependencies (#6728)
## Summary

Use a dedicated source type for non-package requirements. Also enables
us to support non-package `path` dependencies _and_ removes the need to
have the member `pyproject.toml` files available when we sync _and_
makes it explicit which dependencies are virtual vs. not (as evidenced
by the snapshot changes). All good things!
2024-08-28 01:19:05 +00:00
Charlie Marsh
8fdb3a882e
Read hash from URL fragment if --hashes are omitted (#6731)
## Summary

Like pip, if `--hashes` are omitted but there's a valid hash in the URL
fragment, we should respect it.

Closes https://github.com/astral-sh/uv/issues/6701.
2024-08-28 00:03:01 +00:00
Charlie Marsh
b01c16a666
Recommend [project] table in uv add for non-project directories (#6725) 2024-08-27 23:51:15 +00:00
Zanie Blue
75a5066e10
Improvements to the application and library documentation (#6726) 2024-08-27 23:15:12 +00:00
Charlie Marsh
3ee6ca31f4
Rename virtual workspace roots to non-project workspace roots (#6717)
## Summary

Closes https://github.com/astral-sh/uv/issues/6709.
2024-08-27 21:36:40 +00:00
Charlie Marsh
c1e831881b
Update workspace documentation to remove legacy virtual projects (#6720) 2024-08-27 17:31:12 -04:00
Zanie Blue
d5d8375c7e
Update project documentation for the application / library concepts (#6718)
Follows https://github.com/astral-sh/uv/pull/6689 and
https://github.com/astral-sh/uv/pull/6585
2024-08-27 16:22:31 -05:00
Amos Wenger
2c5cc62106
ci: Make Windows tests ~27% faster by putting temp folder in dev drive (#6680)
## Summary

This PR makes `cargo test | windows` faster in CI.

### Before

![Windows tests take
5m44s](https://github.com/user-attachments/assets/8dd9c619-9b7b-4ebd-a027-56e7967b6d34)

### After

![Windows tests take
5m12s](https://github.com/user-attachments/assets/7702fdba-3034-4db8-b211-85207a1feffa)

## Also

This PR disables the `brotli` feature of `async-compression` since it's
not strictly needed, but this has little to do with the improvements
(it's still less code to build).

This PR introduces additional code in uv tool uninstall to ignore errors
(that only seem to happen on ReFS, ie. on Dev Drives) akin to "the thing
we're trying to delete cannot be deleted because it's already being
deleted".

If `raw_os_error` was stable we could do u32 matching instead of that
`.to_string().contains()` abomination.
2024-08-27 15:25:05 -05:00
Charlie Marsh
ffb0c304d1
Implement deserialization for trusted host (#6716) 2024-08-27 19:30:44 +00:00
Charlie Marsh
14074f8775
Avoid reading stale .egg-info from mutable sources (#6714)
## Summary

In theory this problem already existed for `PKG-INFO`, but `egg-info`
would be more common, I think, since it's built in the source tree.

Closes https://github.com/astral-sh/uv/issues/6712.
2024-08-27 19:23:26 +00:00
Charlie Marsh
a999303d2f
Use PathBuf types in Source enum (#6708) 2024-08-27 14:46:39 -04:00
Zanie Blue
bc5b069a61
Add --app and --lib options to uv init (#6689)
Changes the `uv init` experience with a focus on working for more
use-cases out of the box.

- Adds `--app` and `--lib` options to control the created project style
- Changes the default from a library with `src/` and a build backend
(`--lib`) to an application that is not packaged (`--app`)
- Hides the `--virtual` option and replaces it with `--package` and
`--no-package`
- `--no-package` is not allowed with `--lib` right now, but it could be
in the future once we understand a use-case
- Creates a runnable project
- Applications have a `hello.py` file which you can run with `uv run
hello.py`
- Packaged applications, e.g., `uv init --app --package` create a
package and script entrypoint, which you can run with `uv run hello`
- Libraries provide a demo API function, e.g., `uv run python -c "import
name; print(name.hello())"` — this is unchanged

Closes #6471
2024-08-27 18:08:09 +00:00
Charlie Marsh
8d466db080
Avoid writing invalid PEP 723 scripts on tool.uv.sources (#6706)
## Summary

We were writing empty lines between the dependencies and the
`tool.uv.sources` table, which led to the `/// script` tag being
unclosed and thus not recognized.

Closes https://github.com/astral-sh/uv/issues/6700.
2024-08-27 17:49:08 +00:00
Charlie Marsh
a8f4e08d5b
Warn on unclosed script tags (#6704)
Should this be user-facing by default? It seems annoying because then
it's unavoidable if you (for whatever reason) have an intentionally
unclosed tag.

Motivated by https://github.com/astral-sh/uv/issues/6700.
2024-08-27 17:47:11 +00:00
Charlie Marsh
eb14056e9c
Add support for virtual projects (#6585)
## Summary

The basic idea here is: any project can either be a package, or not
("virtual").

If a project is virtual, we don't build or install it.

A project is virtual if either of the following are true:

- `tool.uv.virtual = true` is set.
- `[build-system]` is absent.

The concept of "virtual projects" only applies to workspace member right
now; it doesn't apply to `path` dependencies which are treated like
arbitrary Python source trees.

TODOs that should be resolved prior to merging:

- [ ] Documentation
- [ ] How do we reconcile this with "virtual workspace roots" which are
a little different -- they omit `[project]` entirely and don't even have
a name?
- [x] `uv init --virtual` should create a virtual project rather than a
virtual workspace.
- [x] Running `uv sync` in a virtual project after `uv init --virtual`
shows `Audited 0 packages in 0.01ms`, which is awkward. (See:
https://github.com/astral-sh/uv/pull/6588.)

Closes https://github.com/astral-sh/uv/issues/6511.
2024-08-27 13:42:46 -04:00
Zanie Blue
6d38d42b41
Always run both public and private documentation checks (#6707)
Avoiding failures like https://github.com/astral-sh/uv/pull/6705

Context in https://github.com/astral-sh/uv/pull/6099

## Test plan

Even though I opened the pull request, the public build was still
tested.
2024-08-27 17:35:43 +00:00
Zanie Blue
c56102bde3
Fix some broken links (#6705) 2024-08-27 17:24:49 +00:00
Charlie Marsh
6c62d9fbf1
Bump version to v0.3.5 (#6696) 2024-08-27 16:30:12 +00:00
Zanie Blue
cee0d2daf5
Improve lockfile concept documentation, add coverage for upgrades (#6698) 2024-08-27 11:20:53 -05:00
konsti
18453ae79f
Add note about install python on alpine (#6677)
When not using a python base image and using alpine, you need to install
python by yourself. You should also pin the python version when doing
so; currently, i see only python 3.12 in the alpine repository.
2024-08-27 11:03:55 -05:00
Charlie Marsh
5d5e06c0e6
Improve messages for empty solves and installs (#6588)
## Summary

Tries to improve the following:

```
❯ cargo run sync
   Compiling uv-cli v0.0.1 (/Users/crmarsh/workspace/uv/crates/uv-cli)
   Compiling uv v0.3.3 (/Users/crmarsh/workspace/uv/crates/uv)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 3.81s
     Running `/Users/crmarsh/workspace/uv/target/debug/uv sync`
Using Python 3.12.1
Creating virtualenv at: .venv
Resolved in 7ms
Audited environment in 0.05ms
```

In this case we don't actually have any dependencies -- should we just
omit `Resolved in...` and perhaps even the audited line?
2024-08-27 10:40:16 -04:00
Charlie Marsh
3f15f2d922
Use relative paths by default in uv add (#6686)
## Summary

Closes https://github.com/astral-sh/uv/issues/6684.
2024-08-27 14:02:08 +00:00
Charlie Marsh
d86075fc1e
Add support for --trusted-host (#6591)
## Summary

This PR revives https://github.com/astral-sh/uv/pull/4944, which I think
was a good start towards adding `--trusted-host`. Last night, I tried to
add `--trusted-host` with a custom verifier, but we had to vendor a lot
of `reqwest` code and I eventually hit some private APIs. I'm not
confident that I can implement it correctly with that mechanism, and
since this is security, correctness is the priority.

So, instead, we now use two clients and multiplex between them.

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

## Test Plan

Created self-signed certificate, and ran `python3 -m http.server --bind
127.0.0.1 4443 --directory . --certfile cert.pem --keyfile key.pem` from
the packse index directory.

Verified that `cargo run pip install
transitive-yanked-and-unyanked-dependency-a-0abad3b6 --index-url
https://127.0.0.1:8443/simple-html` failed with:

```
error: Request failed after 3 retries
  Caused by: error sending request for url (https://127.0.0.1:8443/simple-html/transitive-yanked-and-unyanked-dependency-a-0abad3b6/)
  Caused by: client error (Connect)
  Caused by: invalid peer certificate: Other(OtherError(CaUsedAsEndEntity))
```

Verified that `cargo run pip install
transitive-yanked-and-unyanked-dependency-a-0abad3b6 --index-url
'https://127.0.0.1:8443/simple-html' --trusted-host '127.0.0.1:8443'`
failed with the expected error (invalid resolution) and made valid
requests.

Verified that `cargo run pip install
transitive-yanked-and-unyanked-dependency-a-0abad3b6 --index-url
'https://127.0.0.1:8443/simple-html' --trusted-host '127.0.0.2' -n` also
failed.
2024-08-27 09:36:50 -04:00
Charlie Marsh
ce749591de
Read requirements from requires.txt when available (#6655)
## Summary

Allows us to avoid building setuptools-based packages at versions prior
to Metadata 2.2

Closes https://github.com/astral-sh/uv/issues/6647.
2024-08-27 13:02:26 +00:00
Charlie Marsh
51723a2699
Ignore send errors in installer (#6667)
## Summary

Similar to https://github.com/astral-sh/uv/pull/6182.
2024-08-27 12:59:17 +00:00
Karim Abou Zeid
5ef0375204
Fix docs for disabling build isolation with uv sync (#6674)
Self-explanatory
2024-08-27 08:49:59 -04:00
Zanie Blue
563e292c14
Add development section to Docker guide and reference new example project (#6666) 2024-08-27 06:41:44 -05:00
Mathieu Kniewallner
fd17f6d902
docs: use python to highlight requirements and use more content tabs (#6549)
## Summary

It appears that using `python` for code blocks containing requirements
works quite well.

![Screenshot from 2024-08-23
23-23-05](https://github.com/user-attachments/assets/38c92ef7-1f5e-40eb-8ea4-7024c8180bc4)

![Screenshot from 2024-08-23
23-23-31](https://github.com/user-attachments/assets/940dc7d5-22a8-4cd8-b54a-d56542d4345c)

Also using more content tabs for cases where we need to differentiate
macOS/Linux from Windows.

## Test Plan

Local run of the documentation.
2024-08-27 06:05:14 -05:00
Mathieu Kniewallner
6a988aca55
refactor: use a struct for install options (#6561)
## Summary

Closes #6545.

## Test Plan

Relying on existing tests.
2024-08-27 05:38:16 -05:00
Zanie Blue
680dcc344c
Improve consistency of directory lookup instructions in Docker (#6665) 2024-08-26 20:39:25 -05:00
Zanie Blue
3949e5d30e
Shift the order of some of the Docker guide content (#6664) 2024-08-26 20:13:14 -05:00
Damian Shaw
e44dc089b9
Clarify package priority order in pip compatibility guide (#6619)
This is a minor documentation update to a recently added section
"Package priority" in the pip compatibility guide. The aim of this PR is
clear up two things which I think the current paragraph implies but I
don't think are (always) true:

1. That pip doesn't use provided order to prioritize resolution
2. That uv relies solely on provided order to prioritize resolution

What is true, at least for now, is pip has more heuristics than uv to
prioritize during resolution, and so I've tried to rework this to make
it clear why changing the order might help uv come to a different
resolution whereas for pip it might not make a difference.
2024-08-26 20:07:44 -04:00
konsti
ae57d85dfb
Detect musl and error for musl pbs builds (#6643)
As described in #4242, we're currently incorrectly downloading glibc
python-build-standalone on musl target, but we also can't fix this by
using musl python-build-standalone on musl targets since the musl builds
are effectively broken.

We reintroduce the libc detection previously removed in #2381, using it
to detect which libc is the current one before we have a python
interpreter. I changed the strategy a big to support an empty `PATH`
which we use in the tests.

For simplicity, i've decided to just filter out the musl
python-build-standalone archives from the list of available archive,
given this is temporary. This means we show the same error message as if
we don't have a build for the platform. We could also add a dedicated
error message for musl.

Fixes #4242

## Test Plan

Tested manually.

On my ubuntu host, python downloads continue to pass:
```
target/x86_64-unknown-linux-musl/debug/uv python install
```

On alpine, we fail:
```
$ docker run -it --rm -v .:/io alpine /io/target/x86_64-unknown-linux-musl/debug/uv python install
  Searching for Python installations
  error: No download found for request: cpython-any-linux-x86_64-musl
```
2024-08-27 00:06:53 +00:00
Charlie Marsh
1ae2c3f142
Respect tool.uv.environments in pip compile --universal (#6663)
## Summary

We now respect the `environments` field in `uv pip compile --universal`,
e.g.:

```toml
[tool.uv]
environments = ["platform_system == 'Emscripten'"]
```

Closes https://github.com/astral-sh/uv/issues/6641.
2024-08-26 23:58:17 +00:00
Di-Is
154ea243d0
Add docs for constraint-dependencies and override-dependencies (#6596)
Add missing portions of documents reported in #6518 and #5248(Comment).

## Summary

<img width="600" alt="override"
src="https://github.com/user-attachments/assets/062f0036-8672-4c68-b21c-aebdeb79b58b">

<img width="600" alt="constraint"
src="https://github.com/user-attachments/assets/f5ef1aa2-0662-4352-a1a0-3af1127fb7fb">
2024-08-26 23:40:06 +00:00
Charlie Marsh
100e45ca33
Avoid reusing state across tool upgrades (#6660)
## Summary

Because tool upgrades can use different Python versions, we can't share
state across them.

Closes https://github.com/astral-sh/uv/issues/6659.
2024-08-26 18:08:50 -04:00
Charlie Marsh
39f3cd2a94
Bump version to v0.3.4 (#6656) 2024-08-26 16:51:01 -04:00
2*yo
900056105a
[Doc] Fix using uv temporarily on docker (#6657)
<!--
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 following Dockerfile command fails:

```
[...]
RUN --mount=from=uv,source=/uv,target=/bin/uv \
    cd /opt/opencti-connector-webhook && \
    uv pip install --system -r requirements.txt && \
    apk del git build-base
[...]
```
Result 

```
yo@opencti:~/connectors/stream/webhook$ docker build -t opencti/connector-webhook:d .
[+] Building 1.0s (3/3) FINISHED                                                                                                                                            docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                  0.1s
 => => transferring dockerfile: 557B                                                                                                                                                  0.1s
 => ERROR [internal] load metadata for docker.io/library/uv:latest                                                                                                                    0.8s
 => [internal] load metadata for docker.io/library/python:3.11-alpine                                                                                                                 0.8s
------
 > [internal] load metadata for docker.io/library/uv:latest:
------
ERROR: failed to solve: uv: failed to resolve source metadata for docker.io/library/uv:latest: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
```

Fix:

```
[...]
RUN --mount=from=ghcr.io/astral-sh/uv,source=/uv,target=/bin/uv \
    cd /opt/opencti-connector-webhook && \
    uv pip install --system -r requirements.txt && \
    apk del git build-base
[...]
```


## Test Plan

<!-- How was it tested? -->
```
$ docker --version
Docker version 26.0.0, build 2ae903e
$ date
Mon Aug 26 20:31:53 UTC 2024

$ docker build -t opencti/connector-webhook:e .
[+] Building 41.8s (13/13) FINISHED                                                                                                                                         docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                  0.0s
 => => transferring dockerfile: 587B                                                                                                                                                  0.0s
 => [internal] load metadata for ghcr.io/astral-sh/uv:latest                                                                                                                          0.5s
 => [internal] load metadata for docker.io/library/python:3.11-alpine                                                                                                                 0.5s
 => [internal] load .dockerignore                                                                                                                                                     0.1s
 => => transferring context: 2B                                                                                                                                                       0.0s
 => [stage-0 1/6] FROM docker.io/library/python:3.11-alpine@sha256:700b4aa84090748aafb348fc042b5970abb0a73c8f1b4fcfe0f4e3c2a4a9fcca                                                   0.0s
 => [internal] load build context                                                                                                                                                     0.1s
 => => transferring context: 130B                                                                                                                                                     0.0s
 => CACHED FROM ghcr.io/astral-sh/uv:latest@sha256:f6b18f4a7408c5244374b00c8832089258d130f7a77a38807348072e714ffa0c                                                                   0.0s
 => CACHED [stage-0 2/6] COPY src /opt/opencti-connector-webhook                                                                                                                      0.0s
 => CACHED [stage-0 3/6] RUN apk --no-cache add git build-base libmagic libffi-dev libxml2-dev libxslt-dev                                                                            0.0s
 => [stage-0 4/6] RUN --mount=from=ghcr.io/astral-sh/uv,source=/uv,target=/bin/uv     cd /opt/opencti-connector-webhook &&     uv pip install --system -r requirements.txt    38.3s
 => [stage-0 5/6] COPY entrypoint.sh /                                                                                                                                                0.1s
 => [stage-0 6/6] RUN chmod +x /entrypoint.sh                                                                                                                                         0.8s
 => exporting to image                                                                                                                                                                1.7s
 => => exporting layers                                                                                                                                                               1.6s
 => => writing image sha256:aa6810f883d104c838f35e848c0d7d8b4df5c7c3929f18a88b7139d0ec892a0b                                                                                          0.0s
 => => naming to docker.io/opencti/connector-webhook:e                                                                                                                                0.0s
```
2024-08-26 15:36:38 -05:00
Zanie Blue
430cd3006e
Add tip to use intermediate layers (#6650) 2024-08-26 15:14:47 -05:00
Zanie Blue
330f5adf34
Move WORKDIR directive in Docker examples (#6652) 2024-08-26 15:09:01 -05:00
Zanie Blue
a2290ff360
Remove duplicate WORKDIR directive in Docker example (#6651) 2024-08-26 14:42:46 -05:00
Charlie Marsh
486c9848a1
Add docs for disabling build isolation with uv sync (#6607)
## Summary

This requires some care, so worth documenting the intended workflows.

Closes https://github.com/astral-sh/uv/issues/6437.
2024-08-26 18:21:43 +00:00
Charlie Marsh
023acbe4b0
Avoid un-strict syncing by-default for build isolation (#6606)
## Summary

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

Closes https://github.com/astral-sh/uv/issues/6599.
2024-08-26 14:04:58 -04:00