Commit graph

443 commits

Author SHA1 Message Date
Charlie Marsh
c5d9f55bc4
Bump version to v0.4.21 (#8188) 2024-10-14 20:44:43 +00:00
Aditya Pratap Singh
05446cd736
Include uvx installation in Docker examples (#8179)
closes #7947
2024-10-14 13:23:11 -05:00
pantheraleo-7
7e13100786
docs: correct typo in index.md (#8150)
This was added in [#5426](https://github.com/astral-sh/uv/pull/5426)

The output that a python shell was started, but the command will only
print out the version because of the `--version` flag.

I think the section `Download Python versions as needed` should be
reverted back to `Download Python versions on demand` or something
similar because that's what the command will do. It will download the
given version if not already installed.
2024-10-12 22:00:33 +01:00
bluss
e67d87301a
Implement uv tree --no-dev (#8109)
## Summary

Allow pruning dev-dependencies in uv tree.
This is not inherently in conflict with --invert, but this pruning is
not yet implemented there.
2024-10-12 13:10:56 +00:00
Adam Dangoor
9351652e32
Update dependencies.md with typo fix (stands -> standards) (#8142) 2024-10-12 13:53:36 +01:00
samypr100
12a76690b2
ci(docker): support python 3.13 images (#8105)
## Summary

Closes https://github.com/astral-sh/uv/issues/8066#event-14593331489
2024-10-10 14:39:07 -05:00
Trevor Manz
585456a607
feat: Support remote scripts with uv run (#6375)
<!--
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?
-->

First off, congratulations on the 0.3 release! The PEP 723 standalone
scripts support is awesome, and I can already imagine a long tail of
little scripts of my own that would benefit from this functionality.

## Background

I really like the Deno CLI's support for running and installing remote
scripts.

```
deno run <url>
```

```
deno install --name foo <url>
```

I can see parallels with `uv run` and `uvx`. After mentioning this on
Discord, @zanieb suggested I could take a stab at a PR to implement
similar functionality for uv.

## Summary

This PR attempts to add support for executing remote standalone scripts
directly with `uv run`. While this is already possible by downloading
the script (i.e., via curl/wget) and then using uv run, having direct
support would be convenient.

The proposed functionality is:

```sh
uv run <url>
```

Another addition/alternative could be to support running scripts via
stdin:

```sh
curl -sL <url> | uv run -
```

But that is not implemented in this PR.

## Test Plan

I noticed that GitHub and `files.pythonhosted.org` URLs are used in some
of the tests. I've created a personal [GitHub
Gist](https://gist.github.com/manzt/cb24f3066c32983672025b04b9f98d1f)
with the example from PEP 723 for now to test this functionality.

~However, I couldn't figure out how to get the `with_snapshot` config
filter to filter out the tempfile path, so the test is currently
failing. Any assistance with this would be appreciated.~

## Notes

I'm not totally pleased with the implementation of this PR. I think it
would be better to handle the case earlier (and probably reuse the
cache), and avoid mutation, but since run command requires a local path
this was the simplest implementation I could come up with.

I know that performance is paramount with uv so I totally understand if
this requires a different approach or something more explicit to avoid
"inferring" the path. I'm just taking this as an opportunity to learn a
little more Rust and acquaint myself with the code base. cheers!

---------

Co-authored-by: Andrew Gallant <jamslam@gmail.com>
2024-10-10 14:10:17 -04:00
Ahmed Ilyas
97af56a603
Support uv export --no-header (#8096)
## Summary

Resolves https://github.com/astral-sh/uv/issues/8063

## Test Plan

`cargo test`
2024-10-10 17:17:44 +02:00
Charlie Marsh
f2741220e5
Update pip compatibility guide to note transitive URL dependency support (#8081)
## Summary

Closes https://github.com/astral-sh/uv/issues/8080.
2024-10-10 12:21:05 +02:00
Charlie Marsh
46a0ed7fa2
Use comma-separated values for UV_FIND_LINKS (#8061)
## Summary

These values can include spaces when passed on the command-line... Clap
doesn't give us a way to provide a value separator for _only_ an
environment variable (as is pip's behavior), so I think we're stuck
using comma-separated for here right now.

See, e.g., https://github.com/clap-rs/clap/discussions/3796.

Closes #8057.
2024-10-09 23:05:51 +00:00
David Szotten
7b9b690b02
document --reinstall with --exclude-newer to ensure downgrades (#6721)
fixes #6676
2024-10-09 23:03:31 +00:00
Mathieu Kniewallner
c2f13f9468
docs(dependency-bots): mention PEP 723 + some improvements (#7819)
## Summary

Renovate recently gained support for updating dependencies defined using
PEP 723 (https://github.com/renovatebot/renovate/pull/31266). Since uv
supports this format, I thought it could be nice to mention support for
it in the integrations documentation as well. I took the occasion to
make the page a bit more structured as well.

## Test Plan

Ran Renovate on https://github.com/mkniewallner/renovate-pep723, which
created https://github.com/mkniewallner/renovate-pep723/pull/2 that
updates a dependency defined using PEP 723. But I'll re-run some tests
again once the changes are released on Renovate cloud GitHub app just in
case.
2024-10-09 11:26:07 -05:00
Ahmed Ilyas
1764a95d39
Support pip install --exact (#8044)
## Summary

Resolves #8041 

## Test Plan

`cargo test`
2024-10-09 15:31:28 +02:00
Zanie Blue
0e1b25a536
Bump version to 0.4.20 (#8016) 2024-10-08 19:55:21 +00:00
Kemal Akkoyun
1a39ffe391
uv run: List available scripts when a script is not specified (#7687)
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
## Summary

This PR adds the ability to list available scripts in the environment
when `uv run` is invoked without any arguments.
It somewhat mimics the behavior of `rye run` command
(See https://rye.astral.sh/guide/commands/run).

This is an attempt to fix #4024.

## Test Plan

I added test cases. The CI pipeline should pass.

### Manuel Tests

```shell
❯ uv run
Provide a command or script to invoke with `uv run <command>` or `uv run script.py`.

The following scripts are available:

normalizer
python
python3
python3.12

See `uv run --help` for more information.
```

---------

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-10-08 19:34:50 +00:00
konsti
282fab5f70
Hint at wrong endpoint in publish (#7872)
Improve hints when using the simple index URL instead of the upload URL
in `uv publish`. This is the most common confusion when publishing, so
we give it some extra care and put it more centrally in the CLI help.

Fixes #7860

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2024-10-08 19:16:02 +00:00
Jo
15e5e3f6af
Fill in authors filed during uv init (#7756)
## Summary

Fill in the `authors` field of `pyproject.toml` by fetching author info
from Git.

Resolves #7718
2024-10-08 14:06:37 -05:00
Sigurd Spieckermann
b70405c59a Use simple image syntax in GitLab integration docs 2024-10-08 09:48:00 -05:00
Sigurd Spieckermann
cae9507bda Use more idiomatic CI job names in GitLab integration docs 2024-10-08 09:48:00 -05:00
Sigurd Spieckermann
427c1f7fb2 Fix cache directory path in GitLab integration docs 2024-10-08 09:48:00 -05:00
Sigurd Spieckermann
4e4a558d64 Remove obsolete command in GitLab integration docs 2024-10-08 09:48:00 -05:00
Sigurd Spieckermann
b5c52b205a Use idiomatic syntax in GitLab integration docs 2024-10-08 09:48:00 -05:00
Sigurd Spieckermann
eb5af72a6d Fix syntax in GitLab integration docs 2024-10-08 09:48:00 -05:00
Zanie Blue
a451fb6858
Bump version to 0.4.19 (#7991) 2024-10-07 17:32:37 -05:00
Zanie Blue
a4f64d2be6
Bump patch Python versions for project (#7972) 2024-10-07 12:38:12 -05:00
Zanie Blue
7d883fc12f
Add 3.13 support to the platform reference (#7971) 2024-10-07 12:06:43 -05:00
FishAlchemist
101feff7cb
Clearly specify the minimum supported Windows Server version in the document (#7946)
## Summary
https://doc.rust-lang.org/1.81.0/rustc/platform-support.html

![image](https://github.com/user-attachments/assets/f3921374-5f49-4f89-99d8-4808d94b4647)

This is actually part of the change in minimum Windows version
requirements in Rust 1.78.0, but subsequent versions of the
documentation clearly specify the minimum version of Windows Server.
https://github.com/rust-lang/rust/pull/126034

## Test Plan
Run the document server locally.

![image](https://github.com/user-attachments/assets/94f6bbd0-7aa6-4a47-aee2-d6f9ee35d5e5)
2024-10-06 09:33:19 -05:00
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