π Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
Development workflow: migrate from Makefile to uv + justfile (#3302)
Meggison Oritsemisan151c1c1b2085
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfiledeleted file mode 100644index 6d954febc..000000000--- a/.devcontainer/Dockerfile+++ /dev/null@@ -1,20 +0,0 @@-# See here for image contents: https://github.com/microsoft/vscode-dev-containers/blob/main/containers/python-3/.devcontainer/base.Dockerfile--# [Choice] Python version: 3, 3.10, 3.9-ARG VARIANT="3.9"-FROM mcr.microsoft.com/vscode/devcontainers/python:${VARIANT}--# [Option] Install Node.js-ARG INSTALL_NODE="true"-ARG NODE_VERSION="lts/*"-RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi--# https://exerror.com/importerror-libgl-so-1-cannot-open-shared-object-file-no-such-file-or-directory/-RUN apt-get update && apt install -y libgl1-mesa-glx--# [Optional] Uncomment this section to install additional OS packages.-# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \-# && apt-get -y install --no-install-recommends <your-package-list-here>--# [Optional] Uncomment this line to install global node packages.-# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.jsondeleted file mode 100644index 1908429a9..000000000--- a/.devcontainer/devcontainer.json+++ /dev/null@@ -1,94 +0,0 @@-{- "name": "Python 3",- "build": {- "dockerfile": "Dockerfile",- "context": "..",- "args": {- // Update 'VARIANT' to pick a Python version: 3, 3.9, 3.10- "VARIANT": "3.9",- // Options- "INSTALL_NODE": "true",- "NODE_VERSION": "lts/*"- },- },- "runArgs": [- // Enable GPU passthrough, requires WSL2 on Windows- //"--gpus=all",- // One of the following options is required for torch multiprocessing- //"--ipc=host",- //"--shm-size=4gb",- ],- "settings": {- "editor.formatOnSave": true,- "editor.rulers": [- 120- ],- "python.pythonPath": "/usr/local/bin/python",- "python.defaultInterpreterPath": "/usr/local/bin/python",- "python.languageServer": "Pylance",- "python.autoComplete.addBrackets": true,- "python.analysis.autoImportCompletions": true,- "python.analysis.completeFunctionParens": true,- "python.analysis.autoSearchPaths": true,- "python.analysis.useImportHeuristic": true,- "python.analysis.diagnosticMode": "workspace",- "python.sortImports": true,- "python.sortImports.args": [- // isort recommends pyproject.toml- // "--settings-path=${workspaceFolder}/pyproject.toml",- "--settings-path=${workspaceFolder}/setup.cfg"- ],- "python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",- "python.formatting.blackPath": "/usr/local/py-utils/bin/black",- "python.formatting.provider": "black",- "python.formatting.blackArgs": [- "--config=${workspaceFolder}/pyproject.toml"- ],- "python.linting.banditPath": "/usr/local/py-utils/bin/bandit",- "python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",- "python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",- "python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",- "python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",- "python.linting.pylintPath": "/usr/local/py-utils/bin/pylint",- "python.linting.enabled": true,- "python.linting.pylintEnabled": false,- "python.linting.flake8Enabled": true,- "python.linting.flake8Args": [- "--config=${workspaceFolder}/setup.cfg",- "--verbose"- ],- "python.testing.pytestArgs": [- "test"- ],- "python.testing.unittestEnabled": false,- "python.testing.pytestEnabled": true,- "restructuredtext.confPath": "${workspaceFolder}/docs/source",- "restructuredtext.builtDocumentationPath": "${workspaceFolder}/docs/build",- "restructuredtext.languageServer.disabled": false,- "[python]": {- "editor.codeActionsOnSave": {- "source.organizeImports": true,- }- }- },- // Add the IDs of extensions you want installed when the container is created.- "extensions": [- "ms-python.python",- "ms-python.vscode-pylance",- "visualstudioexptteam.vscodeintellicode",- "kevinrose.vsc-python-indent",- "littlefoxteam.vscode-python-test-adapter",- "hbenl.vscode-test-explorer",- "medo64.render-crlf",- "shardulm94.trailing-spaces",- "njqdev.vscode-python-typehint",- "lextudio.restructuredtext",- "trond-snekvik.simple-rst",- ],- // Use 'forwardPorts' to make a list of ports inside the container available locally.- // "forwardPorts": [],- // Use 'postCreateCommand' to run commands after the container is created.- "postCreateCommand": "pre-commit install && sudo /usr/local/bin/python setup.py develop",- // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.- "remoteUser": "vscode"-}diff --git a/.github/actions/env/action.yml b/.github/actions/env/action.ymlindex 10902edc8..e8f988902 100644--- a/.github/actions/env/action.yml+++ b/.github/actions/env/action.yml@@ -37,6 +37,9 @@ runs:shell: bashrun: pip install uv+ - name: Install just+ uses: extractions/setup-just@v3+- if: ${{ contains(fromJson('["nightly"]'), inputs.pytorch-version ) }}name: Install PyTorch nightlyshell: bashdiff --git a/.github/workflows/docs.yml b/.github/workflows/docs.ymlindex 0a373a5f6..54d919761 100644--- a/.github/workflows/docs.yml+++ b/.github/workflows/docs.yml@@ -117,7 +117,7 @@ jobs:- name: Run doctestshell: bash -l {0}- run: make doctest+ run: just ci-doctest- name: Install docs depsshell: bash -l {0}@@ -125,4 +125,4 @@ jobs:- name: Build Documentationshell: bash -l {0}- run: make build-docs SPHINXOPTS="-W"+ run: just ci-build-docsdiff --git a/.gitignore b/.gitignoreindex 3b93725ac..f309cb9b1 100644--- a/.gitignore+++ b/.gitignore@@ -15,14 +15,16 @@ kornia.egg-info/.pytest_cache/*.dev_env.mypy_cache/*-.coverage+.coverage**bak*ipynb_checkpoints*docs/source/_static/*jpgdocs/source/_static/img/*jpgdocs/source/_static/scripts/**DS_Store+*jpg# onnx tests create temp.onnx file*.onnxvenv/+weights/diff --git a/.vscode/settings.json b/.vscode/settings.jsonnew file mode 100644index 000000000..a32e2b468--- /dev/null+++ b/.vscode/settings.json@@ -0,0 +1,5 @@+{+ "python-envs.defaultEnvManager": "ms-python.python:conda",+ "python-envs.defaultPackageManager": "ms-python.python:conda",+ "python-envs.pythonProjects": []+}diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex aa4373242..082867a19 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -67,61 +67,92 @@ repository under your GitHub account.4. Creating a development environment- **Using kornia script**+ **Using kornia script (Recommended)**- Assuming that you are on ubuntu, with nvidia-drivers installed. In bash, source the ``path.bash.inc`` script.- This will install a local conda environment under ``./.dev_env``, which includes Pytorch and some dependencies- (no root required).+ Kornia now uses [uv](https://github.com/astral-sh/uv) for fast Python package management and virtual environment creation.+ The `setup_dev_env.sh` script will automatically install uv (if not already installed), create a virtual environment,+ and install all development dependencies including PyTorch with the appropriate CUDA version.```bash- $ source ./path.bash.inc- $ pip install -e .[dev]- $ python -c "import kornia; print(kornia.__version__)"+ $ ./setup_dev_env.sh```- To install, or update the conda environment run ``setup_dev_env.sh``+ This script will:+ - Install uv if it's not already available+ - Create a virtual environment in the `./venv` directory+ - Install PyTorch with the appropriate CUDA version (default CUDA 12.1)+ - Install all development dependencies from `requirements/requirements-dev.txt`+ - Install documentation dependencies from `requirements/requirements-docs.txt`+ You can customize the Python version, PyTorch version, and CUDA version using environment variables:```bash- $ ./setup_dev_env.sh+ $ PYTHON_VERSION=3.10 PYTORCH_VERSION=2.4.0 CUDA_VERSION=11.8 ./setup_dev_env.sh```+ To use CPU-only PyTorch:+ ```bash+ $ PYTORCH_MODE=cpuonly ./setup_dev_env.sh+ ```- **Manually setup**+ **Using justfile commands (Recommended)**- Otherwise, use a virtual environment of your preference. We recommend using- [conda](https://docs.conda.io/en/latest/) because it facilitates the Pytorch setup, mainly for those who have a- **GPU** available.+ Kornia provides a `justfile` with convenient commands for development tasks. The justfile automatically+ ensures the virtual environment is set up before running any commands.- Example of creating and activating a virtualenv under `venv` name:+ To see all available commands:```bash- # Using virtualenv- $ virtualenv venv -p <your python version / alias> # e.g python3.10- $ ./venv/bin/activate+ $ just+ ```- # Using conda- $ conda create -p venv python=<language version> # e.g 3.10- $ conda activate venv/+ To run tests:+ ```bash+ $ just test-cpu # Run CPU tests+ $ just test-cuda # Run CUDA tests+ $ just test-all # Run all tests```- Setup Pytorch and Kornia:+ To run linting and type checking:```bash- # Installing pytorch: https://pytorch.org/get-started/locally/- # With pip- $ pip install torch- # With conda- $ conda install pytorch cudatoolkit -c pytorch -c nvidia # For GPU env- # or- $ conda install pytorch cpuonly -c pytorch # For CPU env+ $ just lint # Run code formatting and linting+ $ just mypy # Run type checking+ ```++ **Manually setup with uv**- # Installing Kornia for development- $ pip install -e .[dev]+ If you prefer to set up the environment manually:++ 1. Install uv:+ ```bash+ # On Linux/macOS+ $ curl -LsSf https://astral.sh/uv/install.sh | sh- # If you want to contribute to the documentation- $ pip install -e .[docs]+ # Or using pip+ $ pip install uv+ ```++ 2. Create and activate a virtual environment:+ ```bash+ $ uv venv+ $ source .venv/bin/activate # On Windows: .venv\Scripts\activate+ ```++ 3. Install PyTorch with appropriate CUDA version:+ ```bash+ # For CUDA 12.1 (default)+ $ uv pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121++ # For CPU-only+ $ uv pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu+ ```++ 4. Install Kornia development dependencies:+ ```bash+ $ uv pip install -e .[dev,x]+ $ uv pip install -e .[docs] # For documentation development```**Attention**: If *Kornia* was already installed in your virtual environment, remove it with- `pip uninstall kornia` before reinstalling it in editable mode with the `-e` flag.+ `uv pip uninstall kornia` before reinstalling it in editable mode with the `-e` flag.5. Develop the code on your branch, and before creating the pull request, make sure to ensure the code passes the checks.diff --git a/Makefile b/Makefiledeleted file mode 100644index eee5fe4a3..000000000--- a/Makefile+++ /dev/null@@ -1,74 +0,0 @@-BENCHMARK_SOURCE = benchmarks/-BENCHMARK_BACKENDS = inductor,eager-BENCHMARK_OPTS =--.PHONY: test test-cpu test-cuda lint mypy build-docs install uninstall FORCE--test: mypy lint build-docs test-all--test-all: FORCE- pytest -v --device all --dtype all --cov=kornia tests/--test-cpu: FORCE- pytest -v --device cpu --dtype all --cov=kornia tests/--test-cuda: FORCE- pytest -v --device cuda --dtype all --cov=kornia tests/--test-mps: FORCE- pytest -v --device mps --dtype float32 -k "not (grad or exception or jit or dynamo)" tests/--test-module: FORCE- pytest -v --device all --dtype all tests/$(module)--test-jit: FORCE- pytest -v --device all --dtype all -m jit--test-gradcheck: FORCE- pytest -v --device all --dtype all -m grad--test-nn: FORCE- pytest -v --device all --dtype all -m nn--test-quick: FORCE- pytest -v --device all --dtype all -m "not (jit or grad or nn)"--test-slow: FORCE- pytest -v --device all --dtype all -m "(jit or grad or nn)"--test-coverage: FORCE- coverage erase && coverage run --source kornia/ -m pytest --device=all --dtype float32,float64 tests/ && coverage report--lint: FORCE- pre-commit run ruff --all-files--mypy: FORCE- mypy--doctest:- pytest -v --doctest-modules kornia/--build-docs: FORCE- cd docs; make clean html--install: FORCE- python setup.py install--install-dev: FORCE- python setup.py develop--benchmark: FORCE- # We want to always run within warmup because torch optimizer backend- pytest $(BENCHMARK_SOURCE) --benchmark-warmup=on --benchmark-warmup-iterations=100 --benchmark-calibration-precision=10 --benchmark-group-by=func --optimizer=$(BENCHMARK_BACKENDS) $(BENCHMARK_OPTS) $(0)--benchmark-docker:- docker image rm kornia-benchmark:latest --force- docker build -t kornia-benchmark:latest -f docker/Dockerfile.benchmark .- docker run -e "TERM=xterm-256color" \- -e "BACKENDS=$(BENCHMARK_BACKENDS)" \- -e "OPTS=$(BENCHMARK_OPTS)" \- --gpus all\- -it kornia-benchmark:latest--uninstall: FORCE- pip uninstall korniadiff --git a/README.md b/README.mdindex b8df13352..bfd86df1a 100644--- a/README.md+++ b/README.md@@ -101,6 +101,16 @@ Kornia is an open-source project that is developed and maintained by volunteers.pip install -e .```+#### For development with UV (Recommended)++For development, Kornia now uses [uv](https://github.com/astral-sh/uv) for fast Python package management and virtual environment creation.++ ```bash+ ./setup_dev_env.sh+ ```++This will set up a complete development environment with all dependencies. See [CONTRIBUTING.md](CONTRIBUTING.md) for more details.+#### From Github url (latest version)```bashdiff --git a/docs/source/community/contribute.rst b/docs/source/community/contribute.rstindex bd8ac504b..b53426146 100644--- a/docs/source/community/contribute.rst+++ b/docs/source/community/contribute.rst@@ -16,7 +16,7 @@ Everyone is welcomed to get involved with the project. There are different ways4. Fix a bug or develop a feature from the roadmap:- We will always have an open ticket showing the current roadmap.- Pick an unassigned feature (or potentially propose new one) or an open bug ticket.- - Follow the instructions from Developing Kornia in order to setup your development environment and start coding.+ - Follow the instructions from `Developing Kornia <https://github.com/kornia/kornia/blob/main/CONTRIBUTING.md#developing-kornia>`_ to set up your development environment and start coding.- Checkout our coding conventions. See more details below.- Run the test framework locally and make sure all works as expected before sending a pull request.- Open a Pull Request, get the green light from the CI and get your code merged.diff --git a/justfile b/justfilenew file mode 100644index 000000000..6d0c61e0c--- /dev/null+++ b/justfile@@ -0,0 +1,148 @@+# Run `just` to see all available commands++# Default recipe - show help when running just without arguments+default:+ @just --list++# Variables+benchmark_source := "benchmarks/"+benchmark_backends := "inductor,eager"+benchmark_opts := ""++# Ensure virtual environment is available and set up+# Note: This recipe doesn't actually activate the venv for subsequent commands+# because each line in a just recipe runs in a separate shell.+# Each command must explicitly use the venv paths.+_ensure-venv:+ #!/usr/bin/env bash+ if [[ ! -f "venv/bin/activate" ]]; then+ echo "π§ Setting up virtual environment..."+ ./setup_dev_env.sh+ else+ echo "Virtual environment found!"+ fi++# Run all tests with coverage+test-all: _ensure-venv+ ./venv/bin/pytest -v --device all --dtype all --cov=kornia tests/++# Run CPU-only tests+test-cpu: _ensure-venv+ ./venv/bin/pytest -v --device cpu --dtype all --cov=kornia tests/++test-cpu-f32: _ensure-venv+ ./venv/bin/pytest -v --device cpu --dtype float32 --cov=kornia tests/++# Run CUDA tests+test-cuda: _ensure-venv+ ./venv/bin/pytest -v --device cuda --dtype all --cov=kornia tests/++test-cuda-f32: _ensure-venv+ ./venv/bin/pytest -v --device cuda --dtype float32 --cov=kornia tests/++# Run MPS tests (Apple Silicon)+test-mps: _ensure-venv+ ./venv/bin/pytest -v --device mps --dtype float32 -k "not (grad or exception or jit or dynamo)" tests/++# Run tests for a specific module (usage: just test-module tests/test_color.py)+test-module module: _ensure-venv+ ./venv/bin/pytest -v --device all --dtype all tests/{{module}}++# Run JIT compilation tests+test-jit: _ensure-venv+ ./venv/bin/pytest -v --device all --dtype all -m jit++# Run gradient check tests+test-gradcheck: _ensure-venv+ ./venv/bin/pytest -v --device all --dtype all -m grad++# Run neural network tests+test-nn: _ensure-venv+ ./venv/bin/pytest -v --device all --dtype all -m nn++# Run quick tests (excludes slow jit, grad, nn tests)+test-quick: _ensure-venv+ ./venv/bin/pytest -v --device all --dtype all -m "not (jit or grad or nn)"++# Run slow tests (jit, grad, nn)+test-slow: _ensure-venv+ ./venv/bin/pytest -v --device all --dtype all -m "(jit or grad or nn)"++# Run tests with coverage report+test-coverage: _ensure-venv+ coverage erase+ coverage run --source kornia/ -m pytest --device=all --dtype float32,float64 tests/+ coverage report++# Run linting with ruff+lint: _ensure-venv+ ./venv/bin/pre-commit run ruff --all-files++# Run type checking with mypy+mypy: _ensure-venv+ ./venv/bin/mypy++# Run doctests (local dev)+doctest: _ensure-venv+ ./venv/bin/pytest -v --doctest-modules kornia/++# CI doctests (no venv, uses system/uv environment)+ci-doctest:+ pytest -v --doctest-modules kornia/++# Build documentation (local dev)+build-docs: _ensure-venv+ cd docs && make clean html++# CI docs build (no venv)+ci-build-docs:+ sphinx-build -W -b html docs/source docs/build/html++# Install package in development mode+install-dev: _ensure-venv+ ./venv/bin/uv pip install -e .++# Run benchmarks+benchmark *args: _ensure-venv+ ./venv/bin/pytest {{benchmark_source}} --benchmark-warmup=on --benchmark-warmup-iterations=100 --benchmark-calibration-precision=10 --benchmark-group-by=func --optimizer={{benchmark_backends}} {{benchmark_opts}} {{args}}++# Build and run benchmark Docker container+benchmark-docker:+ docker image rm kornia-benchmark:latest --force || true+ docker build -t kornia-benchmark:latest -f docker/Dockerfile.benchmark .+ docker run -e "TERM=xterm-256color" \+ -e "BACKENDS={{benchmark_backends}}" \+ -e "OPTS={{benchmark_opts}}" \+ --gpus all \+ -it kornia-benchmark:latest++# Setup development environment+setup:+ ./setup_dev_env.sh++# Activate virtual environment (reminder command)+activate:+ @echo "Run: source venv/bin/activate"++# Show virtual environment status+venv-status:+ #!/usr/bin/env bash+ if [[ -n "$VIRTUAL_ENV" ]]; then+ echo "Virtual environment active: $VIRTUAL_ENV"+ echo "Python: $(which python)"+ echo "Pip: $(which pip)"+ else+ echo "No virtual environment active"+ echo "Run: source venv/bin/activate"+ fi++# Clean up build artifacts and cache+clean:+ find . -type f -name "*.pyc" -delete+ find . -type d -name "__pycache__" -delete+ find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true+ rm -rf build/ dist/ .coverage htmlcov/++# Show help+help:+ @just --listdiff --git a/requirements/requirements-dev.txt b/requirements/requirements-dev.txtindex 229ad5375..2aff772d1 100644--- a/requirements/requirements-dev.txt+++ b/requirements/requirements-dev.txt@@ -9,6 +9,7 @@ onnxruntimepillowpre-commit>=2pytest==8.3.5+pytest-covpytest-timeoutrequestssetuptools>=61.2 # needed by pytorch dynamo / tritondiff --git a/setup_dev_env.sh b/setup_dev_env.shindex a6ce1e7f6..dd05ef3b5 100755--- a/setup_dev_env.sh+++ b/setup_dev_env.sh@@ -6,70 +6,69 @@ if [ "$apparent_sdk_dir" == "$script_link" ]; thenfisdk_dir="$( command cd -P "$apparent_sdk_dir" > /dev/null && pwd -P )"-# create root directory to install miniconda-dev_env_dir=$sdk_dir/.dev_env-mkdir -p $dev_env_dir+# create root directory for the virtual environment+mkdir -p $sdk_dir-# define miniconda paths-conda_bin_dir=$dev_env_dir/bin-conda_bin=$conda_bin_dir/conda--# download and install miniconda-# check the operating system: Mac or Linux-platform=$(uname)-if [[ "$platform" == "Darwin" ]];-then- download_link=https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh-else- download_link=https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh+# check if uv is installed, if not install it+if ! command -v uv &> /dev/null; then+ echo "Installing uv..."+ curl -LsSf https://astral.sh/uv/install.sh | sh+ export PATH="$HOME/.cargo/bin:$PATH"fi-if [ ! -e $dev_env_dir/miniconda.sh ]; then- curl -o $dev_env_dir/miniconda.sh \- -O "$download_link"- chmod +x $dev_env_dir/miniconda.sh-fi-if [ ! -e $conda_bin ]; then- $dev_env_dir/miniconda.sh -b -u -p $dev_env_dir-fi--# define a python version to initialise the conda environment.+# define a python version to initialise the virtual environment.# by default we assume python 3.11python_version=${PYTHON_VERSION:-"3.11"}pytorch_version=${PYTORCH_VERSION:-"2.4.0"}pytorch_mode=${PYTORCH_MODE:-""} # use `cpuonly` for CPU or leave it in blank for GPUcuda_version=${CUDA_VERSION:-"12.1"}-# configure for nightly builds-pytorch_channel="pytorch"-if [ "$pytorch_version" == "nightly" ]; then- pytorch_version=""- pytorch_channel="pytorch-nightly"+# check if virtual environment already exists+if [ -d "$sdk_dir/venv" ]; then+ echo "Virtual environment found, activating..."+ source $sdk_dir/venv/bin/activate+ echo "Virtual environment activated: $VIRTUAL_ENV"+ echo "Python: $(which python)"+ echo "To install/update dependencies, delete the venv directory and run this script again."+ exit 0fi-# configure pytorch cuda version+# create virtual environment with uv+echo "Creating virtual environment with Python $python_version..."+uv venv $sdk_dir/venv --python $python_version++# activate virtual environment+source $sdk_dir/venv/bin/activate++# configure pytorch installation based on modeif [ "$pytorch_mode" == "cpuonly" ]; then- pytorch_cuda_version="cpuonly"+ pytorch_index_url="https://download.pytorch.org/whl/cpu"else- pytorch_cuda_version="pytorch-cuda=$cuda_version -c nvidia"+ # For CUDA, use the appropriate index URL+ pytorch_index_url="https://download.pytorch.org/whl/cu${cuda_version//./}"fi-# create an environment with the specific python version-$conda_bin config --append channels conda-forge-$conda_bin update -n base -c defaults conda-$conda_bin create --name venv python=$python_version-$conda_bin clean -ya--# activate local virtual environment-source $conda_bin_dir/activate $dev_env_dir/envs/venv-# install pytorch and torchvision-conda install pytorch=$pytorch_version $pytorch_cuda_version -c $pytorch_channel+echo "Installing PyTorch $pytorch_version..."+if [ "$pytorch_version" == "nightly" ]; then+ # Install nightly builds+ uv pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu${cuda_version//./}+elif [ "$pytorch_version" != "" ]; then+ # Install specific version+ uv pip install torch==$pytorch_version torchvision --index-url $pytorch_index_url+else+ # Install latest stable+ uv pip install torch torchvision --index-url $pytorch_index_url+fi-# install testing dependencies-pip install -e .[dev,x]+# install project dependencies with dev and x extras+echo "Installing development dependencies..."+uv pip install -e .[dev,x]# install docs dependencies-pip install -e .[docs]+echo "Installing documentation dependencies..."+uv pip install -e .[docs]-conda deactivate # close the `venv` environment+echo "Development environment setup complete!"+echo "To activate the environment, run: source $sdk_dir/venv/bin/activate"+echo "To deactivate, run: deactivate"