diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0c2779fcf5..2d968a4622 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -54,7 +54,7 @@ repos: - id: shellcheck args: ["--severity=warning"] - repo: https://github.com/rapidsai/pre-commit-hooks - rev: v1.3.3 + rev: v1.4.3 hooks: - id: verify-copyright args: [--fix, --spdx] @@ -81,6 +81,21 @@ repos: exclude: | (?x) ^pyproject[.]toml$ + - id: verify-hardcoded-version + exclude: | + (?x) + (^|/)devcontainer[.]json$| + (^|/)dependencies[.]yaml$| + ^[.]github/(workflows|ISSUE_TEMPLATE)/| + (^|/)pom[.]xml$| + ^[.]pre-commit-config[.]yaml$| + ^conda/environments/| + (^|/)VERSION$| + (^|/)RAPIDS_BRANCH$| + [.](md|rst|avro|parquet|png|orc|gz|pkl|sas7bdat|msgpack|pickle|jpg|bz2|zlib)$| + ^docs/cuopt/source/cuopt-python/routing/routing-example[.]ipynb$| + ^docs/cuopt/source/versions1[.]json$| + ^helmchart/cuopt-server/(Chart[.]yaml|values[.]yaml)$ - repo: local hooks: - id: update-versions diff --git a/ci/release/update-version.sh b/ci/release/update-version.sh index ba1bc066f8..3d6c356b3d 100755 --- a/ci/release/update-version.sh +++ b/ci/release/update-version.sh @@ -125,10 +125,6 @@ for DEP in "${DEPENDENCIES[@]}"; do done done -# Update project.json -PROJECT_FILE="docs/cuopt/source/project.json" -sed_runner 's/\("version": "\)[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]"/\1'${NEXT_FULL_TAG}'"/g' "${PROJECT_FILE}" - # Update README.md version badge sed_runner 's/badge\/version-[0-9]\+\.[0-9]\+\.[0-9]\+-blue/badge\/version-'${NEXT_FULL_TAG}'-blue/g' README.md diff --git a/docs/cuopt/source/conf.py b/docs/cuopt/source/conf.py index 8ecabc4d89..919567fb88 100644 --- a/docs/cuopt/source/conf.py +++ b/docs/cuopt/source/conf.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 @@ -11,6 +11,10 @@ import subprocess import sys import os +import tempfile +import json +from sphinx.util.fileutil import copy_asset_file +from pathlib import Path # Run cuopt server help command and save output subprocess.run( @@ -166,7 +170,7 @@ # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ["_static"] html_css_files = ["swagger-nvidia.css"] -html_extra_path = ["project.json", "versions1.json"] +html_extra_path = ["versions1.json"] # -- Options for Breathe (Doxygen) ---------------------------------------- @@ -330,6 +334,20 @@ def skip_unwanted_inherited_members(app, what, name, obj, skip, options): return skip +def write_project_json(app, _builder): + json_data = { + "name": "cuopt", + "version": cuopt.__version__, + "url": "https://github.com/nvidia/cuopt", + "description": "NVIDIA cuOpt is an optimization engine", + } + with tempfile.TemporaryDirectory() as d: + path = Path(d) / "project.json" + with open(path, "w") as f: + json.dump(json_data, f) + copy_asset_file(path, app.outdir / "project.json") + + intersphinx_mapping = { "python": ("https://docs.python.org/3", None), } @@ -363,3 +381,4 @@ def skip_unwanted_inherited_members(app, what, name, obj, skip, options): def setup(app): app.setup_extension("sphinx.ext.autodoc") app.connect("autodoc-skip-member", skip_unwanted_inherited_members) + app.connect("write-started", write_project_json) diff --git a/docs/cuopt/source/project.json b/docs/cuopt/source/project.json deleted file mode 100644 index 9b30480261..0000000000 --- a/docs/cuopt/source/project.json +++ /dev/null @@ -1 +0,0 @@ -{"name": "cuopt", "version": "26.04.00", "url": "https://github.com/nvidia/cuopt", "description": "NVIDIA cuOpt is a optimization engine"}