Skip to content

make import of pandas or polars optional #120

make import of pandas or polars optional

make import of pandas or polars optional #120

Workflow file for this run

name: test
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
# Standard tests with both pandas and polars
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install uv
run: |
pip install uv
- name: Create virtual environment and install dependencies
run: |
uv sync
- name: Lint with Ruff and Mypy
run: |
uv run ruff check --output-format=github .
uv run ruff format --diff
uv run mypy .
- name: Test with pytest
run: |
uv run pytest --cov --cov-report=xml tests/
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: ./coverage.xml
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
# Test optional dependencies scenarios
test-optional-deps:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.13"] # Test with oldest and newest supported versions
scenario: ["pandas-only", "polars-only", "both", "none"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install uv
run: |
pip install uv
- name: Test pandas-only scenario
if: matrix.scenario == 'pandas-only'
run: |
uv run --with "pandas>=1.5.1" python scripts/test_isolated_deps.py pandas
- name: Test polars-only scenario
if: matrix.scenario == 'polars-only'
run: |
uv run --with "polars>=1.7.0" python scripts/test_isolated_deps.py polars
- name: Test both libraries scenario
if: matrix.scenario == 'both'
run: |
uv run --with "pandas>=1.5.1" --with "polars>=1.7.0" python scripts/test_isolated_deps.py both
- name: Test no libraries scenario (expected to fail gracefully)
if: matrix.scenario == 'none'
run: |
uv run --no-project python scripts/test_isolated_deps.py none