torch_poetry_bootstrap

Crates.iotorch_poetry_bootstrap
lib.rstorch_poetry_bootstrap
version0.1.18
created_at2025-07-10 17:38:19.664808+00
updated_at2025-07-11 17:37:38.848468+00
descriptionA command-line tool to detect CUDA version and install the appropriate PyTorch wheel via Poetry.
homepage
repositoryhttps://github.com/drossotto/torch_poetry_bootstrap
max_upload_size
id1746843
size29,920
Davide Rossotto (drossotto)

documentation

README

torch_poetry_bootstrap

A simple command-line utility that detects your system's NVIDIA CUDA version and recommends the appropriate PyTorch wheel source. It outputs a tool.poetry.source TOML snippet for Poetry users, ensuring correct PyTorch installation with GPU support.


Installation

If you have Rust installed, the CLI can be installed via cargo, like so:

cargo install torch_poetry_bootstrap

πŸ“¦ Option 2: Download a Precompiled Binary

If you don’t want to install Rust, you can download a standalone binary from the GitHub Releases:

  1. Visit the Releases page.

  2. Download the binary appropriate for your system:

    • Windows: torch_poetry_bootstrap.exe
    • Linux: torch_poetry_bootstrap
    • macOS: torch_poetry_bootstrap
  3. (Linux/macOS only) Make the binary executable:

    chmod +x torch_poetry_bootstrap
    
    
    

Features

  • Detects local CUDA version via nvidia-smi
  • Resolves the most compatible PyTorch wheel index (e.g., cu121, cu118, etc.)
  • Outputs a copy-pasteable TOML snippet for use in your pyproject.toml
  • Supports dry-run and TOML print modes
  • Logs messages to stdout and optionally to a file

Example Usage

torch_poetry_bootstrap \
  --patch-pyproject examples/pyproject.toml \
  --output examples/patched.toml

torch_poetry_bootstrap v0.1.15
πŸ” Running `nvidia-smi` to detect CUDA version...
βœ… Detected CUDA version: 12.3
πŸ“„ Loading torch source mapping from JSON...
βœ… Selected best matching torch source:
πŸ”— Source: cu121
🌐 URL: https://download.pytorch.org/whl/cu121
Source 'cu121' with URL 'https://download.pytorch.org/whl/cu121' already exists in the pyproject.toml.
βœ… Successfully patched `pyproject.toml` with the new source.: examples/patched.toml
Completed in 1.71s

Commit count: 0

cargo fmt