Commit Graph

3782 Commits

Author SHA1 Message Date
konsti 0b16d10b27
Don't build uv-dev by default (#6827)
Most times we compile with `cargo build`, we don't actually need
`uv-dev`. By making `uv-dev` dependent on a new `dev` feature, it
doesn't get built by default anymore, but only when passing `--features
dev`.

Hopefully a small improvement for compile times or at least system load.
2024-08-29 15:44:13 -04:00
Charlie Marsh 34d74501ac
Respect the user's upper-bound in `requires-python` (#6824)
## Summary

We now respect the user-provided upper-bound in for `requires-python`.
So, if the user has `requires-python = "==3.11.*"`, we won't explore
forks that have `python_version >= '3.12'`, for example.

However, we continue to _only_ compare the lower bounds when assessing
whether a dependency is compatible with a given Python range.

Closes https://github.com/astral-sh/uv/issues/6150.
2024-08-29 18:37:05 +00:00
Zanie Blue a17c1e8e40
Add test coverage for Python version discovery with prereleases (#6823)
Coverage for https://github.com/astral-sh/uv/pull/6813 — reverting that
commit causes the 3.11.0b0 test case to fail.
2024-08-29 13:29:22 -05:00
Andrew Gallant 9ea03ceb38
uv-cli: add worktree support to build.rs (#6825)
Previously, we were always asking Cargo to rebuild `uv-cli` if
`.git/HEAD` had changed. But in a worktree, `.git` is a file, not a
directory. And the file contains the path to git's internal worktree
state, which also has its own `HEAD` file. So in the case of a worktree,
we read the file and tell Cargo to watch the worktree-specific `HEAD`
file instead of `.git/head`.

The main thing this fixes is that, previously, in a worktree, `cargo
build` would *always* re-compile `uv` even if nothing changed.

This doesn't impact or fix anything in "typical" clones of uv though.
Only in worktrees.

Closes #6196, Closes #6197
2024-08-29 14:11:50 -04:00
Charlie Marsh cbfc928a9c
Add `uv export --format requirements.txt` (#6778)
## Summary

The interface here is intentionally a bit more limited than `uv pip
compile`, because we don't want `requirements.txt` to be a system of
record -- it's just an export format. So, we don't write annotation
comments (i.e., which dependency is requested from which), we don't
allow writing extras, etc. It's just a flat list of requirements, with
their markers and hashes.

Closes #6007.

Closes #6668.

Closes #6670.
2024-08-29 17:46:42 +00:00
Franco Mariluis 670e9603ee
add docs for AWS CodeArtifact (#6816)
<!--
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

This adds explicit information about using `uv` with AWS CodeArtifact
(both as an extra index to fetch private packages and also to publish
packages using `twine`).

## Test Plan

I'm currently using this setup with several private projects that use
CodeArtifact.

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-08-29 12:40:41 -05:00
Charlie Marsh f2ce80589f
Omit `[pip]` section from configuration file docs (#6814)
## Summary

Closes https://github.com/astral-sh/uv/issues/6800.
2024-08-29 12:57:13 -04:00
Charlie Marsh d62952ec21
Hint at `--no-workspace` in `uv init` failures (#6815)
## Summary

We now both (1) include the `pyproject.toml` (which we were doing
sometimes, but inconsistently) and (2) hint at `--no-workspace`).

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

## Test Plan

Looks like this now:

![Screenshot 2024-08-29 at 10 44
55 AM](https://github.com/user-attachments/assets/a7c4cbff-704b-4dac-b0e4-e8e12a2b1f5d)
2024-08-29 12:57:09 -04:00
Charlie Marsh f046e54c64
Ignore pre-release segments when discovering via `requires-python` (#6813)
## Summary

`3.13.0b0` should be allowed by `>=3.13`.

Closes #6798.
2024-08-29 11:45:29 -05:00
Zanie Blue e3d5d3d26d
Avoid deadlocks when multiple uv processes lock resources (#6790)
This is achieved by updating the `LockedFile::acquire` API to be async —
as in some cases we were attempting to acquire the lock synchronously,
i.e., without yielding, which blocked the runtime.

Closes https://github.com/astral-sh/uv/issues/6691 — I tested with the
reproduction there and a local release build and no longer reproduce the
deadlock with these changes.

Some additional context in the [internal Discord
thread](https://discord.com/channels/1039017663004942429/1278430431204741270/1278478941262188595)
2024-08-29 11:16:14 -05:00
Chan Kang 4f5356ed55
sort dependencies in `pyproject.toml` (#6388)
## Summary
resolves https://github.com/astral-sh/uv/issues/6203

## Test Plan
added a test fixing the bug described in the issue.

---------

Co-authored-by: konstin <konstin@mailbox.org>
2024-08-29 16:55:03 +02:00
my1e5 f956ab8fae
Update default `hello.py` to pass `ruff format` (#6811)
Closes https://github.com/astral-sh/uv/issues/6808
2024-08-29 10:31:52 -04:00
github-actions[bot] 3be4fe59d7
Sync latest Python releases (#6784) 2024-08-29 03:41:07 +00:00
Charlie Marsh 933d4ef3b6
Support inline optional tables in `uv add` and `uv remove` (#6787)
## Summary

Closes https://github.com/astral-sh/uv/issues/6785.
2024-08-29 02:08:31 +00:00
Charlie Marsh c166e65ba6
Move `lock.rs` into its own module (#6775)
## Summary

Desperately need the ability to start splitting up code here.
2024-08-28 18:04:45 -04:00
Zanie Blue 4a98e1eceb
Avoid using debug representation for git source urls (#6779)
e.g.

> DEBUG Using existing Git source
`https://github.com/StarfishStorage/python-swiftclient.git`

instead of

> DEBUG Using existing git source `Url { scheme: "https",
cannot_be_a_base: false, username: "", password: None, host:
Some(Domain("github.com")), port: None, path:
"/StarfishStorage/gunicorn.git", query: None, fragment: None }`
2024-08-28 22:02:24 +00:00
Zanie Blue aad00d22e4
Fix up reference to environment markers in resolver reference (#6773) 2024-08-28 18:00:43 -04:00
Zanie Blue c730530b4e
Add timeouts to all of the CI jobs (#6769)
Noticed
https://github.com/astral-sh/uv/actions/runs/10601946253/job/29382920849?pr=6767
hung. This seems like best practice.
2024-08-28 18:57:22 +00:00
Zanie Blue b9d027b67a
Use `uvx` for Python linting in CI (#6771) 2024-08-28 13:54:34 -05:00
Zanie Blue 98577b52bf
Enumerate available Docker tags (#6768) 2024-08-28 13:51:23 -05:00
Zanie Blue 38869f85a9
Fix link in changelog (#6765)
I bet you do not have the docs running
2024-08-28 12:38:59 -05:00
Charlie Marsh d9bd3bc7a5
Bump to v0.4.0 (#6764) 2024-08-28 17:29:16 +00:00
Ahmed Ilyas 9f0346592f
Add colors to the CLI help menu (#6280)
## Summary

Adds colors to the CLI output.

## Test Plan


<img width="526" alt="Screenshot 2024-08-21 at 00 06 40"
src="https://github.com/user-attachments/assets/88388272-659e-49d4-a641-83f64de55cf0">
<img width="879" alt="Screenshot 2024-08-21 at 00 06 57"
src="https://github.com/user-attachments/assets/26522bd3-c9cf-4359-a8d3-e5c9c72a54aa">
2024-08-28 11:43:52 -05:00
Charlie Marsh cef3d35405
Support `{package}@{version}` in `uv tool install` (#6762)
## Summary

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

Closes https://github.com/astral-sh/uv/issues/6535.
2024-08-28 12:40:49 -04:00
Charlie Marsh af323888ee
Accept either strings or structs for hosts (#6763)
## Summary

Technically a struct did work in the last release, so let's not break
it.
2024-08-28 16:36:12 +00:00
leaf-soba 71f5998752
Avoid showing duplicate paths in `uv python list` (#6740)
<!--
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
- Resolves issue #6690
<!-- What's the purpose of the change? What does it do, and why? -->

## Test Plan
```
$ cargo run python list
```
<!-- How was it tested? -->

---------

Co-authored-by: leaf-soba <leaf-soba@gmail.com>
Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-08-28 10:48:17 -05:00
Zanie Blue 451eef31a6
Bind to the host to allow connections in FastAPI Docker example (#6753)
This wouldn't allow connections as written
2024-08-28 10:33:54 -05:00
Zanie Blue 37e29f1109
Update FastAPI guide for virtual projects and use `uv init` to create the `pyproject.toml` (#6752)
Follows https://github.com/astral-sh/uv/pull/6751

Matches https://github.com/astral-sh/uv-fastapi-example/pull/3
2024-08-28 10:33:46 -05:00
Zanie Blue 50c4341cc6
Remove build system from FastAPI guide (#6751)
Matches https://github.com/astral-sh/uv-fastapi-example/pull/2
2024-08-28 10:33:38 -05:00
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