From bc1b075d857e7f6114ea77cd0969a3dc29c69601 Mon Sep 17 00:00:00 2001 From: Xuehai Pan Date: Fri, 25 Jul 2025 00:13:21 +0800 Subject: [PATCH] docs: prefer `uvx` over `pipx` in docs --- .github/ISSUE_TEMPLATE/bug-report.yaml | 4 +- .github/ISSUE_TEMPLATE/feature-request.yaml | 4 +- .github/ISSUE_TEMPLATE/questions.yaml | 4 +- README.md | 42 ++++++++++----------- docs/source/index.rst | 4 +- nvitop-exporter/README.md | 4 +- nvitop/cli.py | 4 +- 7 files changed, 34 insertions(+), 32 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug-report.yaml b/.github/ISSUE_TEMPLATE/bug-report.yaml index 89f208a..6b4e479 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yaml +++ b/.github/ISSUE_TEMPLATE/bug-report.yaml @@ -11,8 +11,8 @@ body: You may try the latest version of `nvitop` in an isolated environment with the following commands first: ```bash - pip3 install --upgrade pipx - PYTHONFAULTHANDLER=1 pipx run --spec git+https://github.com/XuehaiPan/nvitop.git nvitop + pip3 install --upgrade uv + PYTHONFAULTHANDLER=1 uvx --from git+https://github.com/XuehaiPan/nvitop.git nvitop ``` - type: checkboxes diff --git a/.github/ISSUE_TEMPLATE/feature-request.yaml b/.github/ISSUE_TEMPLATE/feature-request.yaml index 105d74a..8f4c417 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.yaml +++ b/.github/ISSUE_TEMPLATE/feature-request.yaml @@ -11,8 +11,8 @@ body: You may try the latest version of `nvitop` in an isolated environment with the following commands first: ```bash - pip3 install --upgrade pipx - PYTHONFAULTHANDLER=1 pipx run --spec git+https://github.com/XuehaiPan/nvitop.git nvitop + pip3 install --upgrade uv + PYTHONFAULTHANDLER=1 uvx --from git+https://github.com/XuehaiPan/nvitop.git nvitop ``` - type: checkboxes diff --git a/.github/ISSUE_TEMPLATE/questions.yaml b/.github/ISSUE_TEMPLATE/questions.yaml index b898f26..c60774a 100644 --- a/.github/ISSUE_TEMPLATE/questions.yaml +++ b/.github/ISSUE_TEMPLATE/questions.yaml @@ -11,8 +11,8 @@ body: You may try the latest version of `nvitop` in an isolated environment with the following commands first: ```bash - pip3 install --upgrade pipx - PYTHONFAULTHANDLER=1 pipx run --spec git+https://github.com/XuehaiPan/nvitop.git nvitop + pip3 install --upgrade uv + PYTHONFAULTHANDLER=1 uvx --from git+https://github.com/XuehaiPan/nvitop.git nvitop ``` - type: checkboxes diff --git a/README.md b/README.md index b409c64..1a0381a 100644 --- a/README.md +++ b/README.md @@ -146,34 +146,16 @@ Run `bash install-nvidia-driver.sh --help` for more information. ## Installation -**It is highly recommended to install `nvitop` in an isolated virtual environment.** Simple installation and run via [`pipx`](https://pypa.github.io/pipx) or [`uvx`](https://docs.astral.sh/uv/guides/tools) (a.k.a. `uv tool run`): +**It is highly recommended to install `nvitop` in an isolated virtual environment.** Simple installation and run via [`uvx`](https://docs.astral.sh/uv/guides/tools) (a.k.a. `uv tool run`) or [`pipx`](https://pypa.github.io/pipx): ```bash -pipx run nvitop -# or uvx nvitop +# or +pipx run nvitop ``` You can also set this command as an alias in your shell startup file, e.g.: -```bash -# For Bash -echo 'alias nvitop="pipx run nvitop"' >> ~/.bashrc - -# For Zsh -echo 'alias nvitop="pipx run nvitop"' >> ~/.zshrc - -# For Fish -mkdir -p ~/.config/fish -echo 'alias nvitop="pipx run nvitop"' >> ~/.config/fish/config.fish - -# For PowerShell -New-Item -Path (Split-Path -Parent -Path $PROFILE.CurrentUserAllHosts) -ItemType Directory -Force -'Function nvitop { pipx run nvitop @Args }' >> $PROFILE.CurrentUserAllHosts -``` - -or - ```bash # For Bash echo 'alias nvitop="uvx nvitop"' >> ~/.bashrc @@ -190,6 +172,24 @@ New-Item -Path (Split-Path -Parent -Path $PROFILE.CurrentUserAllHosts) -ItemType 'Function nvitop { uvx nvitop @Args }' >> $PROFILE.CurrentUserAllHosts ``` +or + +```bash +# For Bash +echo 'alias nvitop="pipx run nvitop"' >> ~/.bashrc + +# For Zsh +echo 'alias nvitop="pipx run nvitop"' >> ~/.zshrc + +# For Fish +mkdir -p ~/.config/fish +echo 'alias nvitop="pipx run nvitop"' >> ~/.config/fish/config.fish + +# For PowerShell +New-Item -Path (Split-Path -Parent -Path $PROFILE.CurrentUserAllHosts) -ItemType Directory -Force +'Function nvitop { pipx run nvitop @Args }' >> $PROFILE.CurrentUserAllHosts +``` + Install from PyPI ([![PyPI](https://img.shields.io/pypi/v/nvitop?label=pypi&logo=pypi)](https://pypi.org/project/nvitop)): ```bash diff --git a/docs/source/index.rst b/docs/source/index.rst index 6836046..95a2be5 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -42,10 +42,12 @@ An interactive NVIDIA-GPU process viewer and beyond, the one-stop solution for G Installation """""""""""" -**It is highly recommended to install nvitop in an isolated virtual environment.** Simple installation and run via `pipx `_: +**It is highly recommended to install nvitop in an isolated virtual environment.** Simple installation and run via `uvx `_ (a.k.a. ``uv tool run``) or `pipx `_: .. code:: bash + uvx nvitop + # or pipx run nvitop Install from PyPI (|PyPI Package|_): diff --git a/nvitop-exporter/README.md b/nvitop-exporter/README.md index 517b898..a4a3762 100644 --- a/nvitop-exporter/README.md +++ b/nvitop-exporter/README.md @@ -7,9 +7,9 @@ Prometheus exporter built on top of `nvitop`. Start the exporter with the following command: ```bash -pipx run nvitop-exporter --bind-address 0.0.0.0 --port 5050 -# or uvx nvitop-exporter --bind-address 0.0.0.0 --port 5050 +# or +pipx run nvitop-exporter --bind-address 0.0.0.0 --port 5050 ``` Then you can access the metrics at [`http://localhost:5050/metrics`](http://localhost:5050/metrics). diff --git a/nvitop/cli.py b/nvitop/cli.py index 236b826..fcc6d35 100644 --- a/nvitop/cli.py +++ b/nvitop/cli.py @@ -413,8 +413,8 @@ def main() -> int: or install `nvitop` in an isolated environment: - pip3 install --upgrade pipx - pipx run nvitop + pip3 install --upgrade uv + uvx nvitop """, ).strip() messages.append(f'{message}\n')