diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 9bac2756b8b..19188206ea0 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -9,7 +9,7 @@ LICENSE @NVIDIA/modelopt-setup-codeowners LICENSE_HEADER @NVIDIA/modelopt-setup-codeowners pyproject.toml @NVIDIA/modelopt-setup-codeowners SECURITY.md @NVIDIA/modelopt-setup-codeowners -tox.ini @NVIDIA/modelopt-setup-codeowners +noxfile.py @NVIDIA/modelopt-setup-codeowners uv.lock @NVIDIA/modelopt-setup-codeowners # Library diff --git a/.github/workflows/code_quality.yml b/.github/workflows/code_quality.yml index 723f3af1209..cd877d18d24 100644 --- a/.github/workflows/code_quality.yml +++ b/.github/workflows/code_quality.yml @@ -24,4 +24,4 @@ jobs: with: extra_args: --results=verified,unknown - name: Run code quality checks - run: pip install tox && tox -e pre-commit-all + run: pip install nox uv && nox -s pre_commit_all diff --git a/.github/workflows/gpu_tests.yml b/.github/workflows/gpu_tests.yml index d2b06229888..95d633ec7c7 100644 --- a/.github/workflows/gpu_tests.yml +++ b/.github/workflows/gpu_tests.yml @@ -41,16 +41,16 @@ jobs: files: | .github/workflows/gpu_tests.yml modelopt/** + noxfile.py + pyproject.toml tests/gpu/** tests/gpu_megatron/** - tests/gpu_regression/** tests/gpu_trtllm/** + tests/gpu_regression/** examples/speculative_decoding/** examples/dataset/** modelopt_recipes/general/speculative_decoding/** tools/launcher/** - pyproject.toml - tox.ini fail_on_initial_diff_error: true wait-checks: needs: [check-file-changes] @@ -101,14 +101,8 @@ jobs: COVERAGE_PROCESS_START: ${{ github.workspace }}/pyproject.toml COVERAGE_FILE: ${{ github.workspace }}/.coverage run: | - # nemo containers use uv venvs which is not compatible with tox-current-env, so run tests directly - if [[ "${{ matrix.example }}" == "gpu_megatron" ]]; then - python -m pip install -e .[hf,dev-test] - python -m pytest tests/gpu_megatron --cov - else - python -m pip install tox tox-current-env - COV_ARGS="--cov" python -m tox -e cuda13-${{ matrix.example }} --current-env - fi + pip install nox + nox -s ${{ matrix.example }} - name: Upload GPU coverage to Codecov uses: codecov/codecov-action@v5 with: diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 6789142f97f..eda19778594 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -27,7 +27,7 @@ jobs: - uses: actions/checkout@v6 - uses: ./.github/actions/ubuntu-setup - name: Build docs - run: pip install tox && tox -e build-docs + run: pip install nox uv && nox -s docs - name: Upload docs artifact if: github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' uses: actions/upload-artifact@v4 @@ -47,7 +47,7 @@ jobs: - uses: ./.github/actions/ubuntu-setup - name: Build docs if: github.event.action != 'closed' - run: pip install tox && tox -e build-docs + run: pip install nox uv && nox -s docs - name: Deploy / remove PR preview uses: rossjrw/pr-preview-action@v1 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e3e62d78def..35edb9e53ef 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,13 +13,11 @@ jobs: steps: - uses: actions/checkout@v6 - uses: ./.github/actions/ubuntu-setup - - name: Install dependencies - run: pip install tox - name: Run basic unit tests - run: tox -e py312-torch29-tf_latest-unit + run: pip install nox uv && nox -s "unit-3.12(torch_211, tf_latest)" - name: Build Wheel run: | - tox -e build-wheel + nox -s build_wheel echo "WHEEL_PATH=$(find dist -name "*.whl" | head -n 1)" >> $GITHUB_ENV - name: Upload GitHub Release Artifact env: diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index afa57fc3a86..29bd48ebd07 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -9,9 +9,9 @@ on: paths: - ".github/workflows/unit_tests.yml" - "modelopt/**" - - "tests/unit/**" + - "noxfile.py" - "pyproject.toml" - - "tox.ini" + - "tests/unit/**" - "tools/launcher/**" schedule: - cron: "0 0 * * *" # Nightly @@ -38,7 +38,10 @@ jobs: - uses: actions/checkout@v6 - uses: ./.github/actions/ubuntu-setup - name: Run unit tests - run: pip install tox && COV_ARGS="--cov" tox -e py312-torch211-tf_latest-unit + env: + COVERAGE_PROCESS_START: ${{ github.workspace }}/pyproject.toml + COVERAGE_FILE: ${{ github.workspace }}/.coverage + run: pip install nox uv && nox -s "unit-3.12(torch_211, tf_latest)" - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v5 with: @@ -57,8 +60,7 @@ jobs: with: python-version: "3.12" - name: Run unit tests (without coverage) - # Some issues with torch 2.10 on Windows, so using 2.9 for now - run: pip install tox && tox -e py312-torch29-tf_latest-unit + run: pip install nox uv && nox -s "unit-3.12(torch_211, tf_latest)" multi-py: if: github.event_name == 'pull_request' needs: [linux] @@ -74,7 +76,7 @@ jobs: with: python-version: "3.${{ matrix.py }}" - name: Run unit tests - run: pip install tox && tox -e py3${{ matrix.py }}-torch211-tf_latest-unit + run: pip install nox uv && nox -s "unit-3.${{ matrix.py }}(torch_211, tf_latest)" multi-torch: if: github.event_name == 'pull_request' needs: [linux] @@ -88,7 +90,7 @@ jobs: - uses: actions/checkout@v6 - uses: ./.github/actions/ubuntu-setup - name: Run unit tests - run: pip install tox && tox -e py312-torch${{ matrix.torch }}-tf_latest-unit + run: pip install nox uv && nox -s "unit-3.12(torch_${{ matrix.torch }}, tf_latest)" multi-transformers: if: github.event_name == 'pull_request' needs: [linux] @@ -102,7 +104,7 @@ jobs: - uses: actions/checkout@v6 - uses: ./.github/actions/ubuntu-setup - name: Run unit tests - run: pip install tox && tox -e py312-torch211-tf_${{ matrix.tf }}-unit + run: pip install nox uv && nox -s "unit-3.12(torch_211, tf_min)" launcher: if: github.event_name == 'pull_request' needs: [linux] @@ -133,7 +135,7 @@ jobs: - uses: actions/checkout@v6 - uses: ./.github/actions/ubuntu-setup - name: Run unit tests - run: pip install tox && tox -e py312-partial-unit-${{ matrix.test-env }} + run: pip install nox uv && nox -s "partial_unit(subset='${{ matrix.test-env }}')" unit-pr-required-check: # Run even if some jobs are skipped if: ${{ github.event_name == 'pull_request' && always() }} diff --git a/.vscode/settings.json b/.vscode/settings.json index 0e8465ad38d..5a1c278b0f7 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -19,7 +19,6 @@ ".mypy_cache": true, ".pytest_cache": true, ".ruff_cache": true, - ".tox": true, "**/__pycache__/**": true, "**/*.pyc": true, "**/runs": true, diff --git a/CLAUDE.md b/CLAUDE.md index d07775f3a85..4af38586788 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -37,9 +37,9 @@ Primarily Python codebase with optional C++/CUDA extensions supporting PyTorch, | Pattern match | `pytest tests/unit -k "test_quantize"` | | Lint + format (all files) | `pre-commit run --all-files` | | Lint (diff only) | `pre-commit run --from-ref origin/main --to-ref HEAD` | -| Run via tox (CPU unit) | `tox -e py312-torch210-tf_latest-unit` | -| Build docs | `tox -e build-docs` | -| Build wheel | `tox -e build-wheel` | +| Run via nox (CPU unit) | `nox -s "unit-3.12(torch_211, tf_latest)"` | +| Build docs | `nox -s docs` | +| Build wheel | `nox -s build_wheel` | ## Architecture @@ -104,7 +104,7 @@ A **recipe** is a declarative YAML specification of an optimization configuratio | `modelopt_recipes/general/ptq/` | Built-in PTQ recipe YAML files | | `pyproject.toml` | Optional dependency groups (`[onnx]`, `[hf]`, `[all]`, `[dev]`); ruff, mypy, pytest, bandit, and coverage config | | `.pre-commit-config.yaml` | Pre-commit hooks (ruff, mypy, clang-format, license headers) | -| `tox.ini` | Test environment definitions | +| `noxfile.py` | Test session definitions | ## Design Patterns diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 23f07850a6b..53e879a7bf3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -89,7 +89,7 @@ We use [pytest](https://docs.pytest.org/) for all tests. For any new features / - `tests/gpu_trtllm`: Fast GPU-based unit tests for the core ModelOpt library for TensorRT-LLM features. In most cases, they should not take more than a few seconds to run. - `tests/examples`: Integration tests for ModelOpt examples. They should not take more than a few minutes to run. Please refer to [example test README](./tests/examples/README.md) for more details. -Please refer to [tox.ini](./tox.ini) for more details on how to run the tests and their dependencies. +Please refer to [noxfile.py](./noxfile.py) for more details on how to run the tests and their dependencies. ## ✍️ Signing your work diff --git a/noxfile.py b/noxfile.py new file mode 100644 index 00000000000..3d6d9d66eca --- /dev/null +++ b/noxfile.py @@ -0,0 +1,193 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Nox session definitions for testing, linting, docs, and wheel builds. + +Usage: + python -m pip install nox uv # install nox and uv (once) + nox -l # list all sessions + nox -s gpu_megatron # run a GPU session (inside container) + nox -s "unit-3.12(torch_211, tf_latest)" # run a specific unit test combination + nox -s "unit-3.12(torch_211, tf_latest)" -R # force-recreate venv (e.g. after dep changes) + COVERAGE_PROCESS_START=pyproject.toml nox -s "unit-3.12(torch_211, tf_latest)" # with coverage +""" + +import glob +import os +import shutil + +import nox + +nox.options.default_venv_backend = "uv" if shutil.which("uv") else "virtualenv" +nox.options.envdir = "/tmp/.nox" +nox.options.reuse_existing_virtualenvs = True + +TORCH_VERSIONS = { + "torch_28": "torchvision~=0.23.0", + "torch_29": "torchvision~=0.24.0", + "torch_210": "torchvision~=0.25.0", + "torch_211": "torchvision~=0.26.0", +} + +TRANSFORMERS_VERSIONS = { + "tf_latest": None, + "tf_min": "transformers~=4.56.0", +} + + +def _cov_args(): + """Return --cov when COVERAGE_PROCESS_START is set (CI only).""" + return ["--cov"] if os.environ.get("COVERAGE_PROCESS_START") else [] + + +# ─── CPU unit tests ─────────────────────────────────────────────────────────── +@nox.session(python=["3.10", "3.11", "3.12", "3.13"]) +@nox.parametrize("tf_ver", [nox.param(k, id=k) for k in TRANSFORMERS_VERSIONS]) +@nox.parametrize("torch_ver", [nox.param(k, id=k) for k in TORCH_VERSIONS]) +def unit(session, torch_ver, tf_ver): + """Unit tests — parametrized over torch and transformers versions.""" + session.install(TORCH_VERSIONS[torch_ver], "-e", ".[all,dev-test]") + tf_pin = TRANSFORMERS_VERSIONS[tf_ver] + if tf_pin: + session.install(tf_pin) + session.run("python", "-m", "pytest", "tests/unit", *_cov_args()) + + +@nox.session(python="3.12") +@nox.parametrize("subset", ["onnx", "torch", "torch_deploy"]) +def partial_unit(session, subset): + """Unit tests with partial installs.""" + if subset == "onnx": + session.install("torchvision~=0.26.0", ".[onnx,dev-test]") + session.run("python", "-m", "pytest", "tests/unit/onnx") + elif subset == "torch": + session.install("megatron-core", ".[dev-test]") + session.run( + "python", + "-m", + "pytest", + "tests/unit/torch", + "--ignore=tests/unit/torch/deploy", + "--ignore=tests/unit/torch/puzzletron", + ) + else: # torch_deploy + session.install(".[onnx,dev-test]") + session.run("python", "-m", "pytest", "tests/unit/torch/deploy") + + +# ─── GPU sessions (run inside containers — no new venv) ────────────────────── +# `venv_backend="none"` skips creating a new venv so the session runs directly in the container's +# existing Python environment (e.g. /opt/venv in NeMo) instead of an isolated one. +# Use `python -m pip/pytest` to ensure the container's active venv Python is used, +# not a stale PATH entry (e.g. NeMo container has pip → /usr/local/bin/pip but python → /opt/venv/bin/python). +# Container: nvcr.io/nvidia/pytorch:26.01-py3 or later +@nox.session(venv_backend="none") +def gpu(session): + # tests/gpu/_extensions/test_onnx_extensions.py fails for newer containers + # until https://github.com/tbenthompson/cppimport/pull/98 + session.run( + "python", + "-m", + "pip", + "install", + "--no-build-isolation", + "git+https://github.com/Dao-AILab/fast-hadamard-transform.git", + ) + session.run("python", "-m", "pip", "install", "-e", ".[all,dev-test]") + session.run("python", "-m", "pip", "uninstall", "-y", "cupy-cuda12x") + session.run("python", "-m", "pip", "install", "cupy-cuda13x") + session.run( + "python", + "-m", + "pip", + "install", + "--no-build-isolation", + "git+https://github.com/state-spaces/mamba.git", + "git+https://github.com/Dao-AILab/causal-conv1d.git", + ) + session.run("python", "-m", "pytest", "tests/gpu", *_cov_args()) + + +# Container: nvcr.io/nvidia/nemo:26.02 or later +@nox.session(venv_backend="none") +def gpu_megatron(session): + session.run("python", "-m", "pip", "install", "-e", ".[hf,dev-test]") + session.run("python", "-m", "pytest", "tests/gpu_megatron", *_cov_args()) + + +# Container: nvcr.io/nvidia/pytorch:26.01-py3 or later +@nox.session(venv_backend="none") +def gpu_regression(session): + session.run("python", "-m", "pip", "install", "-e", ".[hf,dev-test]") + session.run("python", "-m", "pytest", "tests/gpu_regression", *_cov_args()) + + +# Container: nvcr.io/nvidia/tensorrt-llm/release:1.3.0rc10 or later +@nox.session(venv_backend="none") +def gpu_trtllm(session): + session.run("python", "-m", "pip", "install", "-e", ".[hf,dev-test]") + session.run("python", "-m", "pytest", "tests/gpu_trtllm", *_cov_args()) + + +# ─── Code quality ───────────────────────────────────────────────────────────── +@nox.session +def pre_commit_all(session): + session.install("-e", ".[all,dev-lint]") + session.run("pre-commit", "run", "--all-files", "--show-diff-on-failure") + + +@nox.session +def pre_commit_diff(session): + session.install("-e", ".[all,dev-lint]") + session.run("pre-commit", "run", "--from-ref", "origin/main", "--to-ref", "HEAD") + + +# ─── Docs ───────────────────────────────────────────────────────────────────── +@nox.session +def docs(session): + session.install("-e", ".[all,dev-docs]") + shutil.rmtree("docs/build", ignore_errors=True) + shutil.rmtree("docs/source/reference/generated", ignore_errors=True) + with session.chdir("docs"): + session.run( + "sphinx-build", + "source", + "build/html", + "--fail-on-warning", + "--show-traceback", + "--keep-going", + ) + + +@nox.session +def docs_debug(session): + session.install("-e", ".[all,dev-docs]") + shutil.rmtree("docs/build", ignore_errors=True) + shutil.rmtree("docs/source/reference/generated", ignore_errors=True) + with session.chdir("docs"): + session.run("sphinx-autobuild", "source", "build/html", "--host", "0.0.0.0") + + +# ─── Wheel build ────────────────────────────────────────────────────────────── +@nox.session +def build_wheel(session): + shutil.rmtree("build", ignore_errors=True) + session.install("twine") + session.run("pip", "wheel", "--no-deps", "--wheel-dir=dist", ".") + wheels = glob.glob("dist/*.whl") + session.run("twine", "check", *wheels) + (modelopt_wheel,) = glob.glob("dist/nvidia_modelopt-*.whl") + session.install(modelopt_wheel, "-f", "dist") + with session.chdir("dist"): + session.run("python", "-c", "import modelopt; print(modelopt.__version__)") diff --git a/pyproject.toml b/pyproject.toml index 2993759ec10..cf27836f8c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -82,7 +82,7 @@ hf = [ "peft>=0.17.0", "sentencepiece>=0.2.1", # Also implicitly used in test_unified_export_megatron, test_vllm_fakequant_megatron_export "tiktoken", - "transformers>=4.56", # Should match modelopt/torch/__init__.py and tox.ini + "transformers>=4.56", # Should match modelopt/torch/__init__.py and noxfile.py "wonderwords", ] @@ -112,17 +112,17 @@ dev-docs = [ "sphinx-togglebutton>=0.3.2", ] dev-test = [ - "coverage[toml]>=7.13.0", # a1_coverage.pth for subprocess tracking requires this + "coverage[toml]>=7.13.0", # a1_coverage.pth for subprocess tracking requires this "pytest", "pytest-cov", "pytest-instafail", "pytest-timeout", "timm", - "torchprofile==0.0.4", # optional dependency for modelopt.torch + "torchprofile==0.0.4", # optional dependency for modelopt.torch "torchvision", "torch-geometric", - "tox>4.18", - "tox-current-env>=0.0.12", + "uv", + "nox", ] # Compound extras via self-references all = ["nvidia-modelopt[onnx,hf,puzzletron]"] @@ -209,6 +209,7 @@ extend-ignore = [ [tool.ruff.lint.per-file-ignores] "__init__.py" = ["F401", "F403"] "examples/*" = ["D"] +"noxfile.py" = ["D", "E501"] "tests/*" = ["B017", "D", "E402", "PT012"] "*/_[a-zA-Z]*" = ["D"] # Private packages (_abc/*.py) or modules (_xyz.py) "*.ipynb" = [ @@ -280,7 +281,7 @@ module = ["examples.*"] disable_error_code = ["attr-defined"] [tool.bandit] -exclude_dirs = [".github/", "examples/", "tests/"] +exclude_dirs = [".github/", "examples/", "noxfile.py", "tests/"] # Do not change `skips`. It should be consistent with NVIDIA's Wheel-CI-CD bandit.yml config. # Use of `# nosec BXXX` requires special approval skips = [ diff --git a/tools/launcher/tests/conftest.py b/tools/launcher/tests/conftest.py index da98e8ad6cb..6d6cb56f635 100644 --- a/tools/launcher/tests/conftest.py +++ b/tools/launcher/tests/conftest.py @@ -20,8 +20,8 @@ uv pip install pytest uv run python3 -m pytest tests/ -v -Or via tox from Model-Optimizer root: - tox -e py312-launcher +Or via nox from Model-Optimizer root: + nox -s "unit-3.12(torch_211-tf_latest)" """ import os diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 4f77033b29b..00000000000 --- a/tox.ini +++ /dev/null @@ -1,145 +0,0 @@ -[tox] -envlist= - pre-commit-all - py312-torch211-tf_latest-unit - cuda13-gpu - cuda13-gpu_regression -skipsdist = True -toxworkdir = /tmp/{env:USER}-modelopt-tox -passenv = - SETUPTOOLS_SCM_PRETEND_VERSION - -############################ -# CPU Unit test environments -############################ -[testenv:{py310,py311,py312,py313}-torch{28,29,210,211}-tf_{min,latest}-unit] -deps = - # torch version auto-selected based on torchvision version - torch28: torchvision~=0.23.0 - torch29: torchvision~=0.24.0 - torch210: torchvision~=0.25.0 - torch211: torchvision~=0.26.0 - - -e .[all,dev-test] - - # Should match pyproject.toml - tf_min: transformers~=4.56.0 -commands = - python -m pytest tests/unit {env:COV_ARGS:} - - -##################################################################### -# Environment to run unit tests with subset of dependencies installed -##################################################################### -[testenv:{py310,py311,py312,py313}-partial-unit-{onnx,torch,torch_deploy}] -allowlist_externals = - bash, rm -deps = - # Make sure torch 2.10 is used - torchvision~=0.26.0 - - # ONNX unit tests heavily rely on torch / torchvision - onnx: .[onnx,dev-test] - onnx: torchvision - - # Install megatron-core to test torch-only install can still import plugins - torch: megatron-core - torch: .[dev-test] - - torch_deploy: .[onnx,torch,dev-test] -commands = - onnx: python -m pytest tests/unit/onnx - torch: python -m pytest tests/unit/torch --ignore tests/unit/torch/deploy --ignore tests/unit/torch/puzzletron - torch_deploy: python -m pytest tests/unit/torch/deploy - - -########################################################### -# GPU test environments (Should be used with --current-env) -########################################################### -# Container: nvcr.io/nvidia/pytorch:26.01-py3 or later -[testenv:cuda13-gpu] -commands_pre = - # Install deps here so that it gets installed even in --current-env - python -m pip install --no-build-isolation git+https://github.com/Dao-AILab/fast-hadamard-transform.git - python -m pip install -e .[all,dev-test] - - # Install cupy-cuda13x for INT4 ONNX quantization (default is cupy-cuda12x) - python -m pip uninstall -y cupy-cuda12x - python -m pip install cupy-cuda13x - - # Install mamba and causal-conv1d for Nemotron tests - python -m pip install --no-build-isolation git+https://github.com/state-spaces/mamba.git - python -m pip install --no-build-isolation git+https://github.com/Dao-AILab/causal-conv1d.git -commands = - python -m pytest tests/gpu {env:COV_ARGS:} - -[testenv:cuda13-gpu_regression] -commands_pre = - python -m pip install -e .[hf,dev-test] -commands = - python -m pytest tests/gpu_regression {env:COV_ARGS:} - -# Container: nvcr.io/nvidia/nemo:26.02 or later -# NOTE: tox is bypassed for this env in CI (see gpu_tests.yml) because tox-current-env is -# incompatible with uv venvs, and any new tox env would lack NeMo/Megatron packages from /opt/venv. -# [testenv:cuda13-gpu_megatron] -# commands_pre = -# python -m pip install -e .[hf,dev-test] -# commands = -# python -m pytest tests/gpu_megatron {env:COV_ARGS:} - -# Container: nvcr.io/nvidia/tensorrt-llm/release:1.2.0 or later -[testenv:cuda13-gpu_trtllm] -commands_pre = - # Install deps here so that it gets installed even in --current-env - python -m pip install -e .[hf,dev-test] -commands = - python -m pytest tests/gpu_trtllm {env:COV_ARGS:} - -############################################# -# Code quality checks on all files or on diff -############################################# -[testenv:{pre-commit}-{all,diff}] -deps = - -e .[all,dev-lint] -commands = - all: pre-commit run --all-files --show-diff-on-failure {posargs} - diff: pre-commit run --from-ref origin/main --to-ref HEAD {posargs} - - -######################### -# Run documentation build -######################### -[testenv:{build,debug}-docs] -allowlist_externals = - rm -deps = - -e .[all,dev-docs] -changedir = docs -commands_pre = - rm -rf build - rm -rf source/reference/generated -commands = - sphinx-build source build/html --fail-on-warning --show-traceback --keep-going - debug: sphinx-autobuild source build/html --host 0.0.0.0 - - -################# -# Run wheel build -################# -[testenv:build-wheel] -allowlist_externals = - bash, cd, rm -deps = - twine -commands = - # Clean build directory to avoid any stale files getting into the wheel - rm -rf build - - # Build and check wheel - pip wheel --no-deps --wheel-dir=dist . - twine check dist/* - - # Install and test the wheel - bash -c "find dist -name 'nvidia_modelopt-*.whl' | xargs pip install -f dist" - bash -c "cd dist; python -c 'import modelopt; print(modelopt.__version__);'"