From 4c13424dcdd6079182f789c9f5debd8d011d2dea Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Thu, 20 Nov 2025 15:53:17 -0600 Subject: [PATCH 1/5] ENH: Reference correct script name in documentation comments. --- ...kcross-manylinux-download-cache-and-build-module-wheels.sh | 3 ++- scripts/macpython-download-cache-and-build-module-wheels.sh | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/dockcross-manylinux-download-cache-and-build-module-wheels.sh b/scripts/dockcross-manylinux-download-cache-and-build-module-wheels.sh index a0ee4fd6..85471726 100755 --- a/scripts/dockcross-manylinux-download-cache-and-build-module-wheels.sh +++ b/scripts/dockcross-manylinux-download-cache-and-build-module-wheels.sh @@ -19,7 +19,8 @@ # For example, # # export ITK_PACKAGE_VERSION="v5.4.0" -# scripts/dockcross-manylinux-build-module-wheels.sh cp39 +# export ITKPYTHONPACKAGE_ORG="InsightSoftwareConsortium" +# scripts/dockcross-manylinux-download-cache-and-build-module-wheels cp39 # # `ITKPYTHONPACKAGE_ORG`: Github organization for fetching ITKPythonPackage build scripts. # diff --git a/scripts/macpython-download-cache-and-build-module-wheels.sh b/scripts/macpython-download-cache-and-build-module-wheels.sh index b7c5400e..0440a228 100755 --- a/scripts/macpython-download-cache-and-build-module-wheels.sh +++ b/scripts/macpython-download-cache-and-build-module-wheels.sh @@ -10,7 +10,8 @@ # Versions can be restricted by passing them in as arguments to the script. # For example, # -# scripts/macpython-build-module-wheels.sh 3.9 3.11 +# scripts/macpython-download-cache-and-build-module-wheels.sh 3.9 3.11 +# # Shared libraries can be included in the wheel by exporting them to DYLD_LIBRARY_PATH before # running this script. # @@ -21,7 +22,6 @@ # For example, # # export DYLD_LIBRARY_PATH="/path/to/libs" -# scripts/macpython-build-module-wheels.sh 3.7 3.9 # # `ITK_PACKAGE_VERSION`: ITKPythonBuilds archive tag to use for ITK build artifacts. # See https://github.com/InsightSoftwareConsortium/ITKPythonBuilds for available tags. From 9ecf24af1b9db1f63dff85f8b2726bca9d9f3e76 Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Thu, 20 Nov 2025 16:49:21 -0600 Subject: [PATCH 2/5] STYLE: Move TBB variable setting local to where it was needed. --- CMakeLists.txt | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 08d4b757..28f0e96b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,19 +17,6 @@ message(STATUS "SuperBuild - ITKPythonPackage_WHEEL_NAME:${ITKPythonPackage_WHEE option(ITKPythonPackage_USE_TBB "Build and use oneTBB in the ITK python package" ON) -if(ITK_SOURCE_DIR) - set(TBB_DIR "${ITK_SOURCE_DIR}/../oneTBB-prefix/lib/cmake/TBB") -else() - set(TBB_DIR "${CMAKE_BINARY_DIR}/../oneTBB-prefix/lib/cmake/TBB") -endif() -set(tbb_args ) -if(ITKPythonPackage_USE_TBB) - set(tbb_args - -DModule_ITKTBB:BOOL=ON - -DTBB_DIR:PATH=${TBB_DIR} - ) -endif() - if(ITKPythonPackage_SUPERBUILD) #----------------------------------------------------------------------------- @@ -111,6 +98,18 @@ if(ITKPythonPackage_SUPERBUILD) endif() if(ITKPythonPackage_USE_TBB) + if(ITK_SOURCE_DIR) + set(TBB_DIR "${ITK_SOURCE_DIR}/../oneTBB-prefix/lib/cmake/TBB") + else() + set(TBB_DIR "${CMAKE_BINARY_DIR}/../oneTBB-prefix/lib/cmake/TBB") + endif() + set(tbb_args ) + if(ITKPythonPackage_USE_TBB) + set(tbb_args + -DModule_ITKTBB:BOOL=ON + -DTBB_DIR:PATH=${TBB_DIR} + ) + endif() set(tbb_cmake_cache_args) if(CMAKE_OSX_DEPLOYMENT_TARGET) From 285c3aabc0260e0764ab8b6a18069f05c4f04c04 Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Thu, 20 Nov 2025 16:55:46 -0600 Subject: [PATCH 3/5] ENH: Add explicit PEP 404 version conformance check Fail early if the version is incompatible with PEP 440. --- itkVersion.py | 11 ++++++++--- scripts/update_python_version.py | 4 ++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/itkVersion.py b/itkVersion.py index 0d526221..d73dbe78 100644 --- a/itkVersion.py +++ b/itkVersion.py @@ -1,5 +1,7 @@ -VERSION = "6.0b1" +from packaging.version import Version +# Version needs to be python PEP 440 compliant (no leading v) +VERSION = '6.0b1'.removeprefix("v") def get_versions(): """Returns versions for the ITK Python package. @@ -20,7 +22,10 @@ def get_versions(): # '4.11.0.dev20170208+139.g922f2d9' get_versions()['package-version'] """ + + Version(VERSION) # Raise InvalidVersion exception if not PEP 440 compliant + versions = {} - versions["version"] = VERSION - versions["package-version"] = VERSION.split("+")[0] + versions['version'] = VERSION + versions['package-version'] = VERSION.split('+')[0] return versions diff --git a/scripts/update_python_version.py b/scripts/update_python_version.py index ca5950d9..f69207d3 100755 --- a/scripts/update_python_version.py +++ b/scripts/update_python_version.py @@ -8,6 +8,7 @@ import os import subprocess from datetime import datetime +from packaging.version import Version argparser = argparse.ArgumentParser(description=__doc__) argparser.add_argument("itkSourceDir") @@ -61,6 +62,9 @@ os.chdir(itkPythonPackageDir) itkVersionPath = os.path.join(itkPythonPackageDir, "itkVersion.py") + +Version(VERSION) # Raise InvalidVersion exception if not PEP 440 compliant + if not os.path.exists(itkVersionPath): print("Expected file " + itkVersionPath + " not found!") sys.exit(1) From 1d11561b92fa13dbc96e588be81c3267cffdb12c Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Thu, 20 Nov 2025 16:56:37 -0600 Subject: [PATCH 4/5] DOC: Minor comment fix --- scripts/macpython-download-cache-and-build-module-wheels.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/macpython-download-cache-and-build-module-wheels.sh b/scripts/macpython-download-cache-and-build-module-wheels.sh index 0440a228..297e827d 100755 --- a/scripts/macpython-download-cache-and-build-module-wheels.sh +++ b/scripts/macpython-download-cache-and-build-module-wheels.sh @@ -12,7 +12,7 @@ # # scripts/macpython-download-cache-and-build-module-wheels.sh 3.9 3.11 # -# Shared libraries can be included in the wheel by exporting them to DYLD_LIBRARY_PATH before +# Shared libraries can be included in the wheel by setting DYLD_LIBRARY_PATH before # running this script. # # =========================================== From a91178fb66184f12324a35b30bfeec6acc725c2b Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Thu, 20 Nov 2025 16:57:04 -0600 Subject: [PATCH 5/5] STYLE: Remove unused import statement. --- scripts/pyproject_configure.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/pyproject_configure.py b/scripts/pyproject_configure.py index 487329da..55ba9c2c 100755 --- a/scripts/pyproject_configure.py +++ b/scripts/pyproject_configure.py @@ -28,7 +28,6 @@ import os import re import sys -import textwrap sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))