diff --git a/.github/workflows/python-bindings.yml b/.github/workflows/python-bindings.yml index 663b178bd..68ed41d0f 100644 --- a/.github/workflows/python-bindings.yml +++ b/.github/workflows/python-bindings.yml @@ -87,32 +87,58 @@ jobs: - name: Setup virtual environment working-directory: crates/terraphim_automata_py + shell: bash run: | + unset CONDA_PREFIX uv venv - source .venv/bin/activate + if [[ "$RUNNER_OS" == "Windows" ]]; then + source .venv/Scripts/activate + else + source .venv/bin/activate + fi - name: Install maturin working-directory: crates/terraphim_automata_py + shell: bash run: | - source .venv/bin/activate + if [[ "$RUNNER_OS" == "Windows" ]]; then + source .venv/Scripts/activate + else + source .venv/bin/activate + fi uv pip install maturin - name: Build Python package working-directory: crates/terraphim_automata_py + shell: bash run: | - source .venv/bin/activate - maturin develop + if [[ "$RUNNER_OS" == "Windows" ]]; then + source .venv/Scripts/activate + else + source .venv/bin/activate + fi + maturin develop --target native - name: Install test dependencies working-directory: crates/terraphim_automata_py + shell: bash run: | - source .venv/bin/activate + if [[ "$RUNNER_OS" == "Windows" ]]; then + source .venv/Scripts/activate + else + source .venv/bin/activate + fi uv pip install pytest pytest-cov - name: Run tests working-directory: crates/terraphim_automata_py + shell: bash run: | - source .venv/bin/activate + if [[ "$RUNNER_OS" == "Windows" ]]; then + source .venv/Scripts/activate + else + source .venv/bin/activate + fi pytest python/tests/ -v --cov=terraphim_automata --cov-report=xml --cov-report=term - name: Upload coverage to Codecov @@ -151,26 +177,47 @@ jobs: - name: Setup virtual environment working-directory: crates/terraphim_automata_py + shell: bash run: | + unset CONDA_PREFIX uv venv - source .venv/bin/activate + if [[ "$RUNNER_OS" == "Windows" ]]; then + source .venv/Scripts/activate + else + source .venv/bin/activate + fi - name: Install maturin working-directory: crates/terraphim_automata_py + shell: bash run: | - source .venv/bin/activate + if [[ "$RUNNER_OS" == "Windows" ]]; then + source .venv/Scripts/activate + else + source .venv/bin/activate + fi uv pip install maturin - name: Build Python package (release mode) working-directory: crates/terraphim_automata_py + shell: bash run: | - source .venv/bin/activate - maturin develop --release + if [[ "$RUNNER_OS" == "Windows" ]]; then + source .venv/Scripts/activate + else + source .venv/bin/activate + fi + maturin develop --release --target native - name: Install benchmark dependencies working-directory: crates/terraphim_automata_py + shell: bash run: | - source .venv/bin/activate + if [[ "$RUNNER_OS" == "Windows" ]]; then + source .venv/Scripts/activate + else + source .venv/bin/activate + fi uv pip install pytest pytest-benchmark - name: Install Rust target for benchmarks @@ -179,8 +226,13 @@ jobs: - name: Run benchmarks working-directory: crates/terraphim_automata_py + shell: bash run: | - source .venv/bin/activate + if [[ "$RUNNER_OS" == "Windows" ]]; then + source .venv/Scripts/activate + else + source .venv/bin/activate + fi pytest python/benchmarks/ -v --benchmark-only \ --benchmark-json=benchmark-results.json \ --benchmark-columns=min,max,mean,stddev,median,ops diff --git a/crates/terraphim_automata_py/python/benchmarks/benchmark_autocomplete.py b/crates/terraphim_automata_py/python/benchmarks/benchmark_autocomplete.py index c102eeac6..d9d5f0c34 100644 --- a/crates/terraphim_automata_py/python/benchmarks/benchmark_autocomplete.py +++ b/crates/terraphim_automata_py/python/benchmarks/benchmark_autocomplete.py @@ -3,7 +3,6 @@ import json import pytest - from terraphim_automata import build_index diff --git a/crates/terraphim_automata_py/python/benchmarks/benchmark_matcher.py b/crates/terraphim_automata_py/python/benchmarks/benchmark_matcher.py index 85f12bb71..81a8c0d6b 100644 --- a/crates/terraphim_automata_py/python/benchmarks/benchmark_matcher.py +++ b/crates/terraphim_automata_py/python/benchmarks/benchmark_matcher.py @@ -3,7 +3,6 @@ import json import pytest - from terraphim_automata import extract_paragraphs, find_all_matches, replace_with_links diff --git a/crates/terraphim_automata_py/python/tests/test_autocomplete.py b/crates/terraphim_automata_py/python/tests/test_autocomplete.py index 06e2cf503..06f48e29e 100644 --- a/crates/terraphim_automata_py/python/tests/test_autocomplete.py +++ b/crates/terraphim_automata_py/python/tests/test_autocomplete.py @@ -1,7 +1,6 @@ """Tests for autocomplete functionality""" import pytest - from terraphim_automata import build_index # Sample thesaurus for testing diff --git a/crates/terraphim_automata_py/python/tests/test_matcher.py b/crates/terraphim_automata_py/python/tests/test_matcher.py index 4861deea9..e6d9423c3 100644 --- a/crates/terraphim_automata_py/python/tests/test_matcher.py +++ b/crates/terraphim_automata_py/python/tests/test_matcher.py @@ -1,7 +1,6 @@ """Tests for text matching and replacement functionality""" import pytest - from terraphim_automata import extract_paragraphs, find_all_matches, replace_with_links # Sample thesaurus for testing diff --git a/crates/terraphim_automata_py/python/tests/test_thesaurus.py b/crates/terraphim_automata_py/python/tests/test_thesaurus.py index 037da4f88..3d6c41d46 100644 --- a/crates/terraphim_automata_py/python/tests/test_thesaurus.py +++ b/crates/terraphim_automata_py/python/tests/test_thesaurus.py @@ -1,7 +1,6 @@ """Tests for thesaurus loading functionality""" import pytest - from terraphim_automata import build_index, load_thesaurus