mirror of
https://github.com/NVIDIA/OpenShell.git
synced 2026-10-02 07:34:45 +08:00
macOS ships Bash 3.2 which errors on `"${arr[@]}"` when the array is
empty under `set -u`. Use `${arr[@]+"${arr[@]}"}` to safely expand
VERIFY_ARGS only when it has elements.
Signed-off-by: Florent Benoit <fbenoit@redhat.com>
70 lines
2.1 KiB
TOML
70 lines
2.1 KiB
TOML
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
# Python development, build, lint, and format tasks
|
|
|
|
["python:dev"]
|
|
description = "Install the Python SDK in development mode"
|
|
depends = ["python:proto"]
|
|
env = { SETUPTOOLS_SCM_PRETEND_VERSION_FOR_OPENSHELL = "0.0.0" }
|
|
run = "uv sync --group dev"
|
|
hide = true
|
|
|
|
["build:python:wheel"]
|
|
description = "Build the pure-Python SDK wheel"
|
|
depends = ["python:proto"]
|
|
run = """
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
WHEEL_OUTPUT_DIR=${WHEEL_OUTPUT_DIR:-target/wheels}
|
|
rm -rf "$WHEEL_OUTPUT_DIR"
|
|
mkdir -p "$WHEEL_OUTPUT_DIR"
|
|
|
|
uv build --wheel --out-dir "$WHEEL_OUTPUT_DIR"
|
|
|
|
VERIFY_ARGS=()
|
|
if [ -n "${SETUPTOOLS_SCM_PRETEND_VERSION_FOR_OPENSHELL:-}" ]; then
|
|
VERIFY_ARGS+=(--expected-version "$SETUPTOOLS_SCM_PRETEND_VERSION_FOR_OPENSHELL")
|
|
fi
|
|
uv run --no-project python tasks/scripts/verify-python-wheel.py "$WHEEL_OUTPUT_DIR" ${VERIFY_ARGS[@]+"${VERIFY_ARGS[@]}"}
|
|
"""
|
|
hide = true
|
|
|
|
["python:build"]
|
|
description = "Alias for build:python:wheel"
|
|
depends = ["build:python:wheel"]
|
|
hide = true
|
|
|
|
["python:lint"]
|
|
description = "Lint Python code with ruff"
|
|
depends = ["python:proto"]
|
|
env = { SETUPTOOLS_SCM_PRETEND_VERSION_FOR_OPENSHELL = "0.0.0", UV_NO_SYNC = "1" }
|
|
run = "uv run ruff check {{vars.python_paths}}"
|
|
hide = true
|
|
|
|
["python:format"]
|
|
description = "Format Python code with ruff"
|
|
env = { SETUPTOOLS_SCM_PRETEND_VERSION_FOR_OPENSHELL = "0.0.0" }
|
|
run = "uv run ruff format {{vars.python_paths}}"
|
|
hide = true
|
|
|
|
["python:format:check"]
|
|
description = "Check Python formatting with ruff"
|
|
env = { SETUPTOOLS_SCM_PRETEND_VERSION_FOR_OPENSHELL = "0.0.0" }
|
|
run = "uv run ruff format --check {{vars.python_paths}}"
|
|
hide = true
|
|
|
|
["python:typecheck"]
|
|
description = "Type check Python code with ty"
|
|
depends = ["python:proto"]
|
|
env = { SETUPTOOLS_SCM_PRETEND_VERSION_FOR_OPENSHELL = "0.0.0" }
|
|
run = "uv run ty check {{vars.python_paths}}"
|
|
hide = true
|
|
|
|
["python:proto"]
|
|
description = "Generate Python protobuf stubs from .proto files"
|
|
env = { SETUPTOOLS_SCM_PRETEND_VERSION_FOR_OPENSHELL = "0.0.0" }
|
|
run = "uv run --frozen python tasks/scripts/generate_python_proto.py"
|
|
hide = true
|