72acd2ca90d01e09f7960d6b62b8eb30e476de6c

Author
Mohaiminus Sakib <3596793+rode093@users.noreply.github.com>
Committer
GitHub <noreply@github.com>
Date

Message

feat(uv): add more useful aliases (#13462)

Co-authored-by: Mohaiminus Sakib <roddur093@gmail.com>
Co-authored-by: Marc Cornellà <marc@mcornella.com>

Diff

 1diff --git a/plugins/uv/README.md b/plugins/uv/README.md
 2index 144ec456a4a29de5f98d96a4141a5edacc61d984..266963e185cad9135312886e5d8355564f27a544 100644
 3--- a/plugins/uv/README.md
 4+++ b/plugins/uv/README.md
 5@@ -1,6 +1,7 @@
 6 # uv plugin
 7 
 8-This plugin automatically installs [uv](https://github.com/astral-sh/uv)'s completions for you, and keeps them up to date. It also adds convenient aliases for common usage.
 9+This plugin automatically installs [uv](https://github.com/astral-sh/uv)'s completions for you,
10+and keeps them up to date. It also adds convenient aliases for common usage.
11 
12 To use it, add `uv` to the plugins array in your zshrc file:
13 
14@@ -10,20 +11,26 @@ plugins=(... uv)
15 
16 ## Aliases
17 
18-| Alias | Command                                                                 | Description                                                          |
19-|:----- |------------------------------------------------------------------------ |:-------------------------------------------------------------------- |
20-| uva   | `uv add`                                                                | Add packages to the project                                          |
21-| uvexp | `uv export --format requirements-txt --no-hashes --output-file requirements.txt --quiet` | Export the lock file to `requirements.txt`          |
22-| uvl   | `uv lock`                                                               | Lock the dependencies                                                |
23-| uvlr  | `uv lock --refresh`                                                     | Rebuild the lock file without upgrading dependencies                 |
24-| uvlu  | `uv lock --upgrade`                                                     | Lock the dependencies to the newest compatible versions              |
25-| uvp   | `uv pip`                                                                | Manage pip packages                                                  |
26-| uvpy  | `uv python`                                                             | Manage Python installs                                               |
27-| uvpp  | `uv python pin`                                                         | Pin the current project to use a specific Python version             |
28-| uvr   | `uv run`                                                                | Run commands within the project's environment                        |
29-| uvrm  | `uv remove`                                                             | Remove packages from the project                                     |
30-| uvs   | `uv sync`                                                               | Sync the environment with the lock file                              |
31-| uvsr  | `uv sync --refresh`                                                     | "Force" sync the environment with the lock file (ignore cache)       |
32-| uvsu  | `uv sync --upgrade`                                                     | Sync the environment, allowing upgrades and ignoring the lock file   |
33-| uvup  | `uv self update`                                                        | Update the UV tool to the latest version                             |
34-| uvv   | `uv venv`                                                               | Manage virtual environments                                          |
35+| Alias | Command                                                                                  | Description                                                           |
36+| :---- | ---------------------------------------------------------------------------------------- | :-------------------------------------------------------------------- |
37+| uva   | `uv add`                                                                                 | Add packages to the project                                           |
38+| uvexp | `uv export --format requirements-txt --no-hashes --output-file requirements.txt --quiet` | Export the lock file to `requirements.txt`                            |
39+| uvi   | `uv init`                                                                                | Initialize a new project in current workspace and environment.        |
40+| uvinw | `uv init --no-workspace`                                                                 | Initialize a new project in a new workspace and environment           |
41+| uvl   | `uv lock`                                                                                | Lock the dependencies                                                 |
42+| uvlr  | `uv lock --refresh`                                                                      | Rebuild the lock file without upgrading dependencies                  |
43+| uvlu  | `uv lock --upgrade`                                                                      | Lock the dependencies to the newest compatible versions               |
44+| uvp   | `uv pip`                                                                                 | Manage pip packages                                                   |
45+| uvpi  | `uv python install`                                                                      | Install a specific version of python                                  |
46+| uvpl  | `uv python list`                                                                         | Lists all python version installed                                    |
47+| uvpp  | `uv python pin`                                                                          | Pin the current project to use a specific Python version              |
48+| uvpu  | `uv python uninstall`                                                                    | Remove a specific version of python                                   |
49+| uvpy  | `uv python`                                                                              | Manage Python installs                                                |
50+| uvr   | `uv run`                                                                                 | Run commands within the project's environment                         |
51+| uvrm  | `uv remove`                                                                              | Remove packages from the project                                      |
52+| uvs   | `uv sync`                                                                                | Sync the environment with the lock file                               |
53+| uvsr  | `uv sync --refresh`                                                                      | "Force" sync the environment with the lock file (ignore cache)        |
54+| uvsu  | `uv sync --upgrade`                                                                      | Sync the environment, allowing upgrades and ignoring the lock file    |
55+| uvtr  | `uv tree`                                                                                | Displays the full dependency tree for the current project environment |
56+| uvup  | `uv self update`                                                                         | Update the UV tool to the latest version                              |
57+| uvv   | `uv venv`                                                                                | Manage virtual environments                                           |
58diff --git a/plugins/uv/uv.plugin.zsh b/plugins/uv/uv.plugin.zsh
59index ef0f78f6b310e6545c669dbe4a2a9263d97c568b..0c0795e567d3bea784ad587459cb2699bc35d4c8 100644
60--- a/plugins/uv/uv.plugin.zsh
61+++ b/plugins/uv/uv.plugin.zsh
62@@ -7,10 +7,15 @@ alias uv="noglob uv"
63 
64 alias uva='uv add'
65 alias uvexp='uv export --format requirements-txt --no-hashes --output-file requirements.txt --quiet'
66+alias uvi='uv init'
67+alias uvinw='uv init --no-workspace'
68 alias uvl='uv lock'
69 alias uvlr='uv lock --refresh'
70 alias uvlu='uv lock --upgrade'
71 alias uvp='uv pip'
72+alias uvpi='uv python install'
73+alias uvpl='uv python list'
74+alias uvpu='uv python uninstall'
75 alias uvpy='uv python'
76 alias uvpp='uv python pin'
77 alias uvr='uv run'
78@@ -18,6 +23,7 @@ alias uvrm='uv remove'
79 alias uvs='uv sync'
80 alias uvsr='uv sync --refresh'
81 alias uvsu='uv sync --upgrade'
82+alias uvtr='uv tree'
83 alias uvup='uv self update'
84 alias uvv='uv venv'
85