From 0967a507218f3ae54e53c1ed1fee9a5cc8452c2a Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Wed, 30 Oct 2024 12:24:37 -0400 Subject: [PATCH 1/2] BUG: Fix pixi caching of Python Debug builds The associated paths were wrong. --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 66a44159ec1..17dfea70223 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -117,12 +117,12 @@ cmd = '''cmake -DCMAKE_BUILD_TYPE:STRING=Debug -DBUILD_TESTING:BOOL=ON''' description = "Configure ITK Python - Debug" -outputs = ["build-debug/CMakeFiles/"] +outputs = ["build-debug-python/CMakeFiles/"] [tool.pixi.feature.python.tasks.build-debug-python] cmd = "cmake --build build-debug-python" description = "Build ITK Python - Debug" -outputs = ["build-debug/lib/**"] +outputs = ["build-debug-python/lib/**"] depends-on = ["configure-debug-python"] [tool.pixi.feature.python.tasks.test-debug-python] From 73841d0a89bc96dea8b74f72f9ec4603460ad10e Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Wed, 30 Oct 2024 12:25:14 -0400 Subject: [PATCH 2/2] ENH: Add Pixi python-exe and python-exe-debug tasks Facilitate development and debugging. --- .../docs/contributing/build_test_itk.md | 18 ++++++++++++++++++ pyproject.toml | 12 ++++++++++++ 2 files changed, 30 insertions(+) diff --git a/Documentation/docs/contributing/build_test_itk.md b/Documentation/docs/contributing/build_test_itk.md index 712782007ce..704799c84ff 100644 --- a/Documentation/docs/contributing/build_test_itk.md +++ b/Documentation/docs/contributing/build_test_itk.md @@ -59,6 +59,24 @@ cd src/ITK pixi run test-python ``` +To run a python interpreter with the locally built `itk` Python package: + +```shell +pixi run python-exe +``` + +A Python script can also be passed in, e.g. + +```shell +pixi run python-exe ./test.py +``` + +To run a python interpreter with a locally built `itk` Python package with debug symbols, + +```shell +pixi run python-exe-debug +``` + ### Further testing and development Additional pixi tasks to run specific steps of the `configure`, `build`, `test` development process or create builds with other [CMake build types] are listed with diff --git a/pyproject.toml b/pyproject.toml index 17dfea70223..d276d9a7622 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -108,6 +108,12 @@ cmd = "ctest -j3 --test-dir build-python" description = "Test ITK Python" depends-on = ["build-python"] +[tool.pixi.feature.python.tasks.python-exe] +cmd = '''cp ./build-python/Wrapping/Generators/Python/WrapITK.pth $(python -c "import site; print(next(p for p in site.getsitepackages() if \'site-packages\' in p))") && + python''' +description = "Run a Python executable with the development ITK Python package" +depends-on = ["build-python"] + [tool.pixi.feature.python.tasks.configure-debug-python] cmd = '''cmake -Bbuild-debug-python @@ -130,6 +136,12 @@ cmd = "ctest -j3 --test-dir build-debug-python" description = "Test ITK Python - Debug" depends-on = ["build-debug-python"] +[tool.pixi.feature.python.tasks.python-exe-debug] +cmd = '''cp ./build-python/Wrapping/Generators/Python/WrapITK.pth $(python -c "import site; print(next(p for p in site.getsitepackages() if \'site-packages\' in p))") && + python''' +description = "Run a Python executable with the development ITK Python Debug build package" +depends-on = ["build-debug-python"] + [tool.pixi.environments] dev = ["dev"] cxx = ["dev", "cxx"]