Skip to content

Commit 29681c2

Browse files
Use verify-hardcoded-version pre-commit hook
1 parent 894b035 commit 29681c2

File tree

4 files changed

+35
-8
lines changed

4 files changed

+35
-8
lines changed

.pre-commit-config.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ repos:
5454
- id: shellcheck
5555
args: ["--severity=warning"]
5656
- repo: https://github.com/rapidsai/pre-commit-hooks
57-
rev: v1.3.3
57+
rev: v1.4.2
5858
hooks:
5959
- id: verify-copyright
6060
args: [--fix, --spdx]
@@ -81,6 +81,21 @@ repos:
8181
exclude: |
8282
(?x)
8383
^pyproject[.]toml$
84+
- id: verify-hardcoded-version
85+
exclude: |
86+
(?x)
87+
(^|/)devcontainer[.]json$|
88+
(^|/)dependencies[.]yaml$|
89+
^[.]github/(workflows|ISSUE_TEMPLATE)/|
90+
(^|/)pom[.]xml$|
91+
^[.]pre-commit-config[.]yaml$|
92+
^conda/environments/|
93+
(^|/)VERSION$|
94+
(^|/)RAPIDS_BRANCH$|
95+
[.](md|rst|avro|parquet|png|orc|gz|pkl|sas7bdat|msgpack|pickle|jpg|bz2|zlib)$|
96+
^docs/cuopt/source/cuopt-python/routing/routing-example[.]ipynb$|
97+
^docs/cuopt/source/versions1[.]json$|
98+
^helmchart/cuopt-server/(Chart[.]yaml|values[.]yaml)$
8499
- repo: local
85100
hooks:
86101
- id: update-versions

ci/release/update-version.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,6 @@ for DEP in "${DEPENDENCIES[@]}"; do
125125
done
126126
done
127127

128-
# Update project.json
129-
PROJECT_FILE="docs/cuopt/source/project.json"
130-
sed_runner 's/\("version": "\)[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]"/\1'${NEXT_FULL_TAG}'"/g' "${PROJECT_FILE}"
131-
132128
# Update README.md version badge
133129
sed_runner 's/badge\/version-[0-9]\+\.[0-9]\+\.[0-9]\+-blue/badge\/version-'${NEXT_FULL_TAG}'-blue/g' README.md
134130

docs/cuopt/source/conf.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

44

@@ -11,6 +11,9 @@
1111
import subprocess
1212
import sys
1313
import os
14+
import tempfile
15+
import json
16+
from sphinx.util.fileutil import copy_asset_file
1417

1518
# Run cuopt server help command and save output
1619
subprocess.run(
@@ -166,7 +169,7 @@
166169
# so a file named "default.css" will overwrite the builtin "default.css".
167170
html_static_path = ["_static"]
168171
html_css_files = ["swagger-nvidia.css"]
169-
html_extra_path = ["project.json", "versions1.json"]
172+
html_extra_path = ["versions1.json"]
170173

171174

172175
# -- Options for Breathe (Doxygen) ----------------------------------------
@@ -330,6 +333,19 @@ def skip_unwanted_inherited_members(app, what, name, obj, skip, options):
330333
return skip
331334

332335

336+
def write_project_json(app, builder):
337+
json_data = {
338+
"name": "cuopt",
339+
"version": cuopt.__version__,
340+
"url": "https://github.com/nvidia/cuopt",
341+
"description": "NVIDIA cuOpt is a optimization engine",
342+
}
343+
with tempfile.NamedTemporaryFile("w+") as f:
344+
json.dump(json_data, f)
345+
f.flush()
346+
copy_asset_file(f.name, app.outdir / "project.json")
347+
348+
333349
intersphinx_mapping = {
334350
"python": ("https://docs.python.org/3", None),
335351
}
@@ -363,3 +379,4 @@ def skip_unwanted_inherited_members(app, what, name, obj, skip, options):
363379
def setup(app):
364380
app.setup_extension("sphinx.ext.autodoc")
365381
app.connect("autodoc-skip-member", skip_unwanted_inherited_members)
382+
app.connect("write-started", write_project_json)

docs/cuopt/source/project.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)