Files
OpenShell/tasks/python.toml
krishicks 9c41f057c3 fix(python): stabilize development tasks under jj (#3354)
setuptools-scm can select jj's Git-bridge dev tag when uv resolves the local
package. Pin a development-only version for every Python task that performs
that resolution.

The 0.0.0 value is valid local editable-package metadata for development tasks;
it is neither a release version nor a Git tag. Wheel builds remain unpinned and
derive their published version from the actual release tag.

Signed-off-by: Kris Hicks <khicks@nvidia.com>
2026-09-16 16:24:38 +00:00

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[@]}"
"""
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