@@ -103,27 +103,25 @@ jobs:
103103 # Export UV_PYTHON for all subsequent steps
104104 echo "UV_PYTHON=$PYTHON_PATH" >> "$GITHUB_ENV"
105105
106- - name : Generate lockfile and install dependencies
106+ - name : Create virtual environment
107107 run : |
108- # Create venv - uv should now use UV_PYTHON
109- uv venv
108+ # Create venv using the correct Python version from setup-python
109+ uv venv --python "$UV_PYTHON"
110110
111111 # Verify the venv is using the correct Python version
112112 echo "Python in venv:"
113- uv run python --version
113+ source .venv/bin/activate
114+ python --version
114115
115116 # Verify version matches what we expect
116- VENV_PYTHON_VERSION=$(uv run python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
117+ VENV_PYTHON_VERSION=$(python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
117118 if [[ "$VENV_PYTHON_VERSION" != "${{ matrix.python-version }}" ]]; then
118119 echo "ERROR: Python version mismatch!"
119120 echo "Expected: ${{ matrix.python-version }}"
120121 echo "Got: $VENV_PYTHON_VERSION"
121122 exit 1
122123 fi
123124
124- # Skip sync as it creates wrong Python version
125- # Just ensure the venv is created with correct Python
126-
127125 - name : Fix SQLite for macOS Python 3.13
128126 if : ${{ matrix.os == 'macOS-latest' && matrix.python-version == '3.13' }}
129127 run : |
@@ -159,58 +157,14 @@ jobs:
159157 echo "except ImportError:" >> "$SITE_PACKAGES/sitecustomize.py"
160158 echo " pass" >> "$SITE_PACKAGES/sitecustomize.py"
161159
162- - name : Install pecos rng build dependencies
163- run : |
164- uv pip install build nanobind scikit-build-core cmake ninja
165-
166- - name : Build PECOS RNG
167- run : |
168- cd clib/pecos-rng
169- # On macOS and Windows, use system compiler instead of LLVM for C++ extensions
170- if [[ "${{ matrix.os }}" == "macOS-latest" ]] || [[ "${{ runner.os }}" == "Windows" ]]; then
171- unset CC CXX
172- fi
173- uv pip install .
174-
175- - name : Install pecos-rslib with maturin
176- run : |
177- cd python/pecos-rslib
178- # On macOS and Windows, use system compiler for C dependencies in Rust crates
179- if [[ "${{ matrix.os }}" == "macOS-latest" ]] || [[ "${{ runner.os }}" == "Windows" ]]; then
180- unset CC CXX
181- fi
182- uv run maturin develop --uv
183-
184- - name : Install quantum-pecos and dependencies
160+ - name : Build PECOS
185161 run : |
186- # First install the core dependencies
187- uv pip install numpy scipy networkx matplotlib phir
188- # Then install quantum-pecos in editable mode
189- cd python/quantum-pecos
190- uv pip install -e .
191- # Verify installation
192- echo "Checking installed packages:"
193- uv pip list | grep -E "(numpy|scipy|networkx|matplotlib|phir|pecos|quantum)" || true
162+ # Use the Makefile to build everything, respecting existing venv
163+ UV_PYTHON="$UV_PYTHON" make build
194164
195165 - name : Run pre-commit checks
196166 run : uv run pre-commit run --all-files --show-diff-on-failure
197167
198- - name : Install test dependencies
199- run : |
200- cd python/quantum-pecos
201- # For Linux, unset CC/CXX to avoid LLVM LTO issues with llvmlite
202- if [[ "${{ runner.os }}" == "Linux" ]]; then
203- unset CC CXX
204- fi
205-
206- # Disable LTO for llvmlite build to avoid gold linker requirement
207- export CFLAGS="-fno-lto"
208- export CXXFLAGS="-fno-lto"
209- export LDFLAGS="-fno-lto"
210- export LLVMLITE_SKIP_LLVM_VERSION_CHECK=1
211-
212- uv pip install -e .[all,test] # Install with both all and test extras
213- uv pip install pytest pytest-cov # Explicitly install test requirements
214168
215169 - name : Debug environment
216170 run : |
@@ -227,19 +181,14 @@ jobs:
227181 uv run python -c "import sys; print('Python paths:'); print('\n'.join(sys.path))"
228182 uv run python -c "import numpy; print('numpy imported successfully')" || echo "Failed to import numpy"
229183 uv run python -c "import networkx; print('networkx imported successfully')" || echo "Failed to import networkx"
184+ uv run python -c "import pecos; print('pecos imported successfully')" || echo "Failed to import pecos"
230185
231186 - name : Run standard tests
232187 run : |
233- # Ensure dependencies are installed
234- uv pip install numpy scipy networkx matplotlib phir pytest pytest-cov
235- # Set PYTHONPATH to include both quantum-pecos and pecos-rslib src
236- export PYTHONPATH="$(pwd)/python/quantum-pecos/src:$(pwd)/python/pecos-rslib/src:${PYTHONPATH}"
237- # Run tests
238- uv run pytest python/tests --doctest-modules --junitxml=junit/test-results.xml --cov=pecos --cov-report=xml --cov-report=html
188+ # Use the Makefile to run standard Python tests (now includes PYTHONPATH)
189+ make pytest
239190
240191 - name : Run optional dependency tests
241192 run : |
242- # Set PYTHONPATH to include both quantum-pecos and pecos-rslib src
243- export PYTHONPATH="$(pwd)/python/quantum-pecos/src:$(pwd)/python/pecos-rslib/src:${PYTHONPATH}"
244- # Run optional dependency tests
245- uv run pytest python/tests --doctest-modules --junitxml=junit/test-results-optional.xml --cov=pecos --cov-report=xml --cov-report=html -m optional_dependency
193+ # Use the Makefile to run optional dependency tests (now includes PYTHONPATH)
194+ make pytest-dep
0 commit comments