Debug slangpy compatibility issues by building slangpy from source with a local Slang build. Covers cloning, building, installing, and testing slangpy against your local Slang changes.
When debugging slangpy compatibility issues or testing Slang changes against slangpy, follow these steps to build slangpy from source using your local Slang build.
Prerequisites:
# From Slang repository root
cmake --preset default
cmake --build --preset debug # or --preset release
# Clone with submodules (required for slangpy build)
git clone https://github.com/shader-slang/slangpy.git external/slangpy
cd external/slangpy
git submodule update --init --recursive
Read external/slangpy/CLAUDE.md for general information about the repo.
On Windows:
cd external/slangpy
SET CMAKE_ARGS=-DSGL_LOCAL_SLANG=ON -DSGL_LOCAL_SLANG_DIR=../.. -DSGL_LOCAL_SLANG_BUILD_DIR=build/Debug
python.exe -m pip install -e .
On Linux/macOS:
cd external/slangpy
CMAKE_ARGS="-DSGL_LOCAL_SLANG=ON -DSGL_LOCAL_SLANG_DIR=../.. -DSGL_LOCAL_SLANG_BUILD_DIR=build/Debug" python -m pip install -e .
On Windows WSL:
cd external/slangpy
WSLENV+=:CMAKE_ARGS CMAKE_ARGS='-DSGL_LOCAL_SLANG=ON -DSGL_LOCAL_SLANG_DIR=../.. -DSGL_LOCAL_SLANG_BUILD_DIR=build/Debug' python.exe -m pip install -e .
# From external/slangpy directory
python -m pip install -r requirements-dev.txt --user
python -m pip install pytest-xdist --user
Write a test case under external/slangpy/slangpy/tests and run it with pytest.
The following example is to run all of the existing slangpy tests:
# From external/slangpy directory
python -m pytest slangpy/tests -ra -n auto --maxprocesses=3
python tools/ci.py unit-test-python
-DSGL_LOCAL_SLANG_BUILD_DIR=build/Release for Release builds-e flag installs in editable mode, allowing you to modify slangpy source-n auto for faster executionSLANG_BUILD_DIR path is correctpython -c "import slangpy; print(slangpy.__file__)"If $ARGUMENTS specifies a build type (debug or release), use that. Otherwise default to debug.
external/slangpy/