Commit graph

416 commits

Author SHA1 Message Date
Eduardo Mendes
561655b51f
fix uninstallation command for windows on documentation (#7944)
## Summary

Fix uninstall uv command for windows on documentation
2024-10-06 09:29:17 -05: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
Seth Morton
c591636dbe
Add UV_FIND_LINKS environment variable support for the --find-links command-line option (#7912)
## Summary

This PR adds support for the `UV_FIND_LINKS` environment variable as an
alternative to the `--find-links` command-line option, as requested in
#1839.

## Test Plan

A unit test was added to validate that setting `UV_FIND_LINKS` provided
the same result as a link provided with the `--find-links` command-line
option.

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2024-10-04 11:30:49 +00:00
Volker Hilsenstein
ca62f8855b
Fix documentation (projects guide) regarding adding a git dependency (#7916)
## Summary

This is a trivial, one line documentation change that fixes the
following documentation bug.

The current documentation suggests this for adding a git dependency

```
# Add a git dependency

uv add requests --git https://github.com/psf/requests
```

Executing what is suggested with `uv` version `0.4.18` results in this
error message

```
uv add requests --git https://github.com/psf/requests
error: unexpected argument '--git' found
```

The working approach is to add the git depency like this:

```
uv add git+https://github.com/psf/requests
```

## Test Plan

I manually tested the command suggested currently in the guide against
my change.
2024-10-04 11:42:18 +01:00
tfsingh
5ff7dc99cb
Support uv run --script (#7739)
This PR adds support for executing a script with ```uv run```, even when
the script does not have a ```.py``` extension. Addresses #7396.
2024-10-02 09:51:12 -05:00
Victorien
30e11c6deb
Fix code block title in Gitlab integration docs (#7861)
![image](https://github.com/user-attachments/assets/64b8d1cc-6dd7-4cd0-9e4a-aee992ec87fc)

A bit sad that mkdocs/mkdocs-material doesn't error on these kind of
issues. I'm wondering if a linter tool, similar to
[sphinx-lint](https://github.com/sphinx-contrib/sphinx-lint) exists for
mkdocs 🤔
2024-10-02 05:21:01 -04:00
Zanie Blue
7b55e97909
Bump version to 0.4.18 (#7852) 2024-10-01 18:25:34 -05:00
Jonas Vacek
267dda995b
GitLab Integration documentation (#6857)
<!--
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
Documentation for GitLab integration, reliant on the new tags introduced
in https://github.com/astral-sh/uv/pull/6053

## Test Plan

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

---------

Co-authored-by: David Fritzsche <9479371+davidfritzsche@users.noreply.github.com>
Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-10-01 18:34:49 +00:00
konsti
af824c17af
Use uv publish instead of twine in docs (#7837) 2024-10-01 16:14:29 +02: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
Javad Zarezadeh
dea5aa6b04
Update documentation to setup-uv@v3 (#7807)
## Summary

Update the documentation from using setup-uv@v2 for GitHub Actions to
use setup-uv@v3 instead.
2024-09-30 08:47:52 -04: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
adisbladis
9f981c934a
Add UV_NO_SYNC environment variable (#7752)
## Summary

I have a workflow where I want use `uv` as a dependency solver only, and
manage my environments with external tooling (Nix).

## Test Plan

Manually tested. Automated testing seems excessive for such a trivial
change.

## Problems

It's still not as useful as I'd like it to be.
`uv` uncondtionally creates a virtual environment, something I would
expect that `--no-sync` should disable.
This looks a bit more tricky to achieve and I'm not sure about how to
best structure it.
2024-09-28 12:03:45 -04:00
Jo
0dbf9ae4a7
Support uv run -m foo to run a module (#7754)
## Summary

This is another attempt using `module: bool` instead of `module:
Option<String>` following #7322.
The original PR can't be reopened after a force-push to the branch, I've
created this new PR.

Resolves #6638
2024-09-28 10:07:21 -05:00
Zanie Blue
313612dad7
Fix table of contents sizing (#7751)
Now
<img width="864" alt="Screenshot 2024-09-27 at 10 57 40 PM"
src="https://github.com/user-attachments/assets/84c99d34-9b5a-4522-a2b4-0ef3c9cdda49">
Previously
<img width="864" alt="Screenshot 2024-09-27 at 10 57 46 PM"
src="https://github.com/user-attachments/assets/d7ff7401-ece5-4b49-813e-cd4e58d6cf19">
2024-09-27 22:59:38 -05:00
Charlie Marsh
d2e7b40cec
Bump version to v0.4.17 (#7742) 2024-09-27 13:28:38 -04:00
Ahmed Ilyas
805f1bd6f5
Add uv build --all option (#7724)
## Summary

Resolves #7705 

## Test Plan

`cargo test` and tested locally.

The snapshots were unstable due to the packages being built in a
non-deterministic order, so I used the quiet flag to suppress the
output.

Another question is whether we should label the build output to indicate
which package it belongs to?
2024-09-27 02:46:06 +00:00
Zanie Blue
f8fc8816e6
Add uv build and uv publish to features overview (#7716) 2024-09-26 12:47:11 -05:00
Aarni Koskela
21151b591c
Docs: Spell out the names of the Docker images for easier copy-paste (#7706)
## Summary

It was all too easy to just copy the non-qualified name of the Docker
images and wonder why they couldn't be found – well, because they're on
`ghcr.io`, and you need to read the prose before the list to figure that
out.


## Test Plan

No plan.
2024-09-26 09:18:46 -05:00
Jo
0c801f8f4b
Initialize a Git repository in uv init (#5476)
## Summary

Similiar to `cargo init --vcs <VCS>`, this PR adds the `--vcs <VCS>`
flag for `uv init`, allowing to create a version control system during
initialization. By default, `uv init` will create a Git repository if
the `--vcs` flag is not provided. Use `--vcs none` to disable this
feature.

Currently, only Git is supported. While Cargo also supports hg, pijul,
and fossil, this initial PR only includes Git. We can add more later if
there are any user requests.

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2024-09-26 02:40:39 +00:00
Charlie Marsh
4ba0e56754
Document uv-with-Jupyter workflows (#7625)
## Summary

This is a work-in-progress as I actually want to change some behaviors
here.

Closes https://github.com/astral-sh/uv/issues/6329.
2024-09-26 00:55:02 +00:00
tfsingh
6e9ecde9c2
Add support for uv init --script (#7565)
This PR adds support for ```uv init --script```, as defined in issue
#7402 (started working on this before I saw jbvsmo's PR). Wanted to
highlight a few decisions I made that differ from the existing PR:

1. ```--script``` takes a path, instead of a path/name. This potentially
leads to a little ambiguity (I can certainly elaborate in the docs,
lmk!), but strictly allowing ```uv init --script path/to/script.py```
felt a little more natural than allowing for ```uv init --script path/to
--name script.py``` (which I also thought would prompt more questions
for users, such as should the name include the .py extension?)
2. The request is processed immediately in the ```init``` method,
sharing logic in resolving which python version to use with ```uv add
--script```. This made more sense to me — since scripts are meant to
operate in isolation, they shouldn't consider the context of an
encompassing package should one exist (I also think this decision makes
the relative codepaths for scripts/packages easier to follow).
3. No readme — readme felt a little excessive for a script, but I can of
course add it in!

---------

Co-authored-by: João Bernardo Oliveira <jbvsmo@gmail.com>
2024-09-25 22:48:01 +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
tfsingh
106633a5e5
Add support for upgrading Python in tool environments (#7605)
This PR adds support for upgrading the build environment of tools with
the addition of a ```--python``` argument to ```uv upgrade```, as
specified in #7471.

Some things to note:
- I added support for individual packages — I didn't think there was a
good reason for ```--python``` to only apply to all packages
- Upgrading with ```--python``` also upgrades the package itself — I
think this is fair as if a user wants to _strictly_ switch the version
of Python being used to build a tool's environment they can use ```uv
install```. This behavior can of course be modified if others don't
agree!

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

Closes https://github.com/astral-sh/uv/issues/7471.
2024-09-25 17:40:28 +00:00
Zanie Blue
e81ed8ec5d
Bump version to 0.4.16 (#7669) 2024-09-24 14:39:21 -05:00
Charlie Marsh
9a6f455cbf
Run cargo dev generate-all (#7664)
A rebase somewhere let this slip by.
2024-09-24 17:19:10 +00:00
Zanie Blue
bcd14ec799
Display Python implementation when creating environments (#7652)
e.g.

```
❯ cargo run -q -- venv -p pypy
Using PyPy 3.9.19
Creating virtual environment at: .venv
Activate with: source .venv/bin/activate
```
2024-09-24 11:45:52 -05:00
Zanie Blue
0c6117f5da
Unhide the --directory option (#7653) 2024-09-24 11:45:33 -05:00
konsti
205bf8cabe
Implement trusted publishing (#7548)
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2024-09-24 16:07:20 +00:00
konsti
1995d20298
Add uv publish: Basic upload with username/password or keyring (#7475)
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2024-09-24 15:33:06 +00:00
Huang, Hong-Chang
63b60bc0c8
Remove double whitespaces from the code (#7623)
Co-authored-by: konstin <konstin@mailbox.org>
2024-09-23 20:15:06 +00:00
Nick Murphy
49ae3dd94d
Document environment variable that disables printing of virtual environment name in prompt (#7648)
This PR adds a line to `docs/configuration/environment.md` that
documents `VIRTUAL_ENV_DISABLE_PROMPT`. If set to `1` when the virtual
environment is activated, then the virtual environment name will not be
prepended to a terminal prompt.

So far I've tested this in bash, but from the various activation
scripts, it looks like it is respected for a variety of shells.

Maintainers should please feel free to edit this PR directly. Thank you!
2024-09-23 14:48:21 -05:00
Charlie Marsh
8efd38c7a9
Use anchorlinks rather than permalinks (#7626)
## Summary

Unfortunately, the permalinks show up in the SERPs as part of the title:

![Screenshot 2024-09-22 at 3 08
54 PM](https://github.com/user-attachments/assets/6914af46-35bd-4d53-8a57-fbba21a0f7e9)

Instead, we'll just make the headers themselves links.

Before:
![Screenshot 2024-09-22 at 3 08
03 PM](https://github.com/user-attachments/assets/9e354fca-d319-4779-b38a-05daee530608)
![Screenshot 2024-09-22 at 3 08
06 PM](https://github.com/user-attachments/assets/954af6b5-35cd-4519-815f-24555b6ba086)

After:

![Screenshot 2024-09-22 at 3 08
19 PM](https://github.com/user-attachments/assets/90c84012-778d-440d-9028-2b40d86ad53c)
![Screenshot 2024-09-22 at 3 08
17 PM](https://github.com/user-attachments/assets/8add8f41-4030-4bbf-9acd-e6027e3f6cda)

I prefer what we had before visually, but the SEO hit is bad enough that
I want to change it.
2024-09-22 19:35:45 -04:00
Charlie Marsh
35d6274c31
Add a --project argument to run a command from a project (#7603)
## Summary

`uv run --project ./path/to/project` now uses the provided directory as
the starting point for any file discovery. However, relative paths are
still resolved relative to the current working directory.

Closes https://github.com/astral-sh/uv/issues/5613.
2024-09-21 20:19:49 +00:00
Charlie Marsh
0d81bfbc67
Bump version to v0.4.15 (#7612) 2024-09-21 09:01:20 -04:00
Zanie Blue
e47e8fe965
Add the execution policy to powershell installs for single versions (#7602) 2024-09-20 15:15:34 -05:00
Zanie Blue
a497b156bb
Bump version to 0.4.14 (#7600) 2024-09-20 15:08:54 -05: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
bluss
7a25a82fc9
Move uvx shell completion to uvx --generate-shell-completion (#7511)
## Summary

Because a problem was found with Powershell and combining the generated
completion scripts for uv and uvx, let's try separating uv and uvx
command completion scripts.

The generated powershell script template can be seen in clap_complete
source, and it starts with `using` directives, which makes it impossible
(apparently) to concatenate two of those script outputs.

As a side effect, this is available under `uv tool run
--generate-shell-completion` too.

Fixes #7482

## Test Plan

- `eval "$(cargo run --bin uvx -- --generate-shell-completion bash)"`
- Test Powershell
2024-09-20 01:27:25 +00:00
Zanie Blue
b8f9ee3b4d
Bump version to 0.4.13 (#7558) 2024-09-19 20:43:56 +00:00
You Jiacheng
a235b7d70d
Clarify behavior of of overrides in CLI reference (#7537)
## Summary
Improve the description of override-dependencies based on the statement
in `concepts/resolution.md`: "As with constraints, overrides do not add
a dependency on the package and only take effect if the package is
requested in a direct or transitive dependency."

I tested it locally, `concepts/resolution.md` is correct. It would be
better to also include this in the Reference Chapter of the docs.
2024-09-19 07:02:42 -05:00
Zanie Blue
209c870232
Add UV_LINK_MODE to Docker caching example (#7510)
As mentioned in https://github.com/astral-sh/uv/issues/7509
2024-09-19 05:55:54 -05:00
Zanie Blue
7778a11b2d
Use more verbose spelling of "virtualenv" during creation (#7523)
This stands out alongside other messaging which uses the longer spelling
"virtual environment"
2024-09-18 21:22:37 -05:00
Zanie Blue
2545bca692
Bump version to 0.4.12 (#7499) 2024-09-18 08:50:04 -05:00
samypr100
5e49f21adf
docs: add warning note on self-hosted github runners (#5757)
## Summary

Related discussion: #5731

This adds a warning section for caching on non-ephemeral (e.g. ec2) self
hosted github runners.

## Test Plan

Prettier was ran on the file.

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-09-18 13:34:25 +00: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
kyoto7250
e5dd67f58e
Add support for --with-editable to uv tool (#6744)
<!--
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? -->
close #6272 

## Test Plan
<!-- How was it tested? -->
As in https://github.com/astral-sh/uv/pull/6262

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-09-17 20:51:34 +00:00
Charlie Marsh
6c52f36655
Bump version to v0.4.11 (#7478) 2024-09-17 19:48:37 +00:00