@@ -34,29 +34,47 @@ jobs:
3434 - name : Install uv
3535 uses : astral-sh/setup-uv@v4
3636
37+ - name : Create Python test venv
38+ shell : bash
39+ run : |
40+ uv venv .venv
41+
42+ - name : Install Python test tools
43+ shell : bash
44+ env :
45+ VENV_PY : ${{ runner.os == 'Windows' && '.venv/Scripts/python.exe' || '.venv/bin/python' }}
46+ run : |
47+ uv pip install --python "$VENV_PY" "maturin>=1.7,<2" "pytest>=8.0" "pytest-cov>=7.0.0"
48+
3749 - name : Build extension (Linux)
3850 if : runner.os == 'Linux'
51+ shell : bash
3952 env :
53+ VIRTUAL_ENV : .venv
54+ VENV_PY : .venv/bin/python
4055 CC : clang
4156 CXX : clang++
4257 RUSTFLAGS : -C link-arg=-fuse-ld=lld -C target-cpu=x86-64
43- run : uv run maturin develop --profile python-release
58+ run : |
59+ export PATH="$(dirname "$VENV_PY"):$PATH"
60+ "$VENV_PY" -m maturin develop --profile python-release --manifest-path infotheory_py/Cargo.toml
4461
4562 - name : Build extension (macOS/Windows)
4663 if : runner.os != 'Linux'
47- run : uv run maturin develop --profile python-release
48-
49- - name : Run tests (Linux)
50- if : runner.os == 'Linux'
64+ shell : bash
5165 env :
52- CC : clang
53- CXX : clang++
54- RUSTFLAGS : -C link-arg=-fuse-ld=lld -C target-cpu=x86-64
55- run : uv run --no-sync pytest --cov=infotheory_rs --cov-report=term-missing --cov-report=xml:target/python-coverage.xml --cov-fail-under=100 python/tests
66+ VIRTUAL_ENV : .venv
67+ VENV_PY : ${{ runner.os == 'Windows' && '.venv/Scripts/python.exe' || '.venv/bin/python' }}
68+ run : |
69+ export PATH="$(dirname "$VENV_PY"):$PATH"
70+ "$VENV_PY" -m maturin develop --profile python-release --manifest-path infotheory_py/Cargo.toml
5671
57- - name : Run tests (macOS/Windows)
58- if : runner.os != 'Linux'
59- run : uv run --no-sync pytest --cov=infotheory_rs --cov-report=term-missing --cov-report=xml:target/python-coverage.xml --cov-fail-under=100 python/tests
72+ - name : Run tests
73+ shell : bash
74+ env :
75+ VENV_PY : ${{ runner.os == 'Windows' && '.venv/Scripts/python.exe' || '.venv/bin/python' }}
76+ run : |
77+ "$VENV_PY" -m pytest --cov=infotheory_rs --cov-report=term-missing --cov-report=xml:target/python-coverage.xml --cov-fail-under=100 python/tests
6078
6179 - name : Upload Python coverage artifact
6280 uses : actions/upload-artifact@v4
@@ -66,27 +84,43 @@ jobs:
6684 if-no-files-found : error
6785
6886 - name : Build sdist
69- run : uv run maturin sdist
87+ shell : bash
88+ env :
89+ VENV_PY : ${{ runner.os == 'Windows' && '.venv/Scripts/python.exe' || '.venv/bin/python' }}
90+ run : |
91+ "$VENV_PY" -m maturin sdist --manifest-path infotheory_py/Cargo.toml
7092
7193 - name : Build wheel (Linux)
7294 if : runner.os == 'Linux'
95+ shell : bash
7396 env :
97+ VENV_PY : .venv/bin/python
7498 CC : clang
7599 CXX : clang++
76100 RUSTFLAGS : -C link-arg=-fuse-ld=lld -C target-cpu=x86-64
77- run : uv run maturin build --profile python-release
101+ run : |
102+ export PATH="$(dirname "$VENV_PY"):$PATH"
103+ "$VENV_PY" -m maturin build --profile python-release --manifest-path infotheory_py/Cargo.toml
78104
79105 - name : Build wheel (macOS/Windows)
80106 if : runner.os != 'Linux'
81- run : uv run maturin build --profile python-release
107+ shell : bash
108+ env :
109+ VENV_PY : ${{ runner.os == 'Windows' && '.venv/Scripts/python.exe' || '.venv/bin/python' }}
110+ run : |
111+ export PATH="$(dirname "$VENV_PY"):$PATH"
112+ "$VENV_PY" -m maturin build --profile python-release --manifest-path infotheory_py/Cargo.toml
82113
83114 - name : Install built wheel and import
84115 shell : bash
116+ env :
117+ WHEEL_VENV_PY : ${{ runner.os == 'Windows' && '.wheel-venv/Scripts/python.exe' || '.wheel-venv/bin/python' }}
85118 run : |
86119 set -euo pipefail
120+ uv venv .wheel-venv
87121 wheel="$(ls target/wheels/*.whl | head -n1)"
88- uv run --no-sync pip install "$wheel"
89- uv run --no-sync python -c "import infotheory_rs; print('ok')"
122+ uv pip install --python "$WHEEL_VENV_PY" "$wheel"
123+ "$WHEEL_VENV_PY" -c "import infotheory_rs; print('ok')"
90124
91125 test-vm-linux :
92126 name : Python VM smoke (Linux)
@@ -106,12 +140,28 @@ jobs:
106140 - name : Install uv
107141 uses : astral-sh/setup-uv@v4
108142
143+ - name : Create Python VM venv
144+ shell : bash
145+ run : |
146+ uv venv .venv
147+
148+ - name : Install Python VM test tools
149+ shell : bash
150+ run : |
151+ uv pip install --python .venv/bin/python "maturin>=1.7,<2" "pytest>=8.0"
152+
109153 - name : Build extension with VM feature
154+ shell : bash
110155 env :
156+ VIRTUAL_ENV : .venv
111157 CC : clang
112158 CXX : clang++
113159 RUSTFLAGS : -C link-arg=-fuse-ld=lld -C target-cpu=x86-64
114- run : uv run maturin develop --profile python-release --features python-extension,backend-rosa,backend-mamba,backend-rwkv,backend-zpaq,vm
160+ run : |
161+ export PATH=".venv/bin:$PATH"
162+ .venv/bin/python -m maturin develop --profile python-release --manifest-path infotheory_py/Cargo.toml --features python-extension,backend-rosa,backend-mamba,backend-rwkv,backend-zpaq,vm
115163
116164 - name : Run VM-featured Python smoke tests
117- run : uv run --no-sync pytest -q python/tests/test_vm.py
165+ shell : bash
166+ run : |
167+ .venv/bin/python -m pytest -q python/tests/test_vm.py
0 commit comments