Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
224 changes: 224 additions & 0 deletions .github/workflows/dependency-testing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
name: Dependency Compatibility Testing

on:
push:
branches: [main]
paths:
- 'pyproject.toml'
- 'requirements/**'
- 'tox.ini'
- 'validmind/**'
- 'tests/**'
pull_request:
branches: ['*']
paths:
- 'pyproject.toml'
- 'requirements/**'
- 'tox.ini'
- 'validmind/**'
- 'tests/**'
schedule:
# Run weekly on Sundays at 2 AM UTC to catch new dependency releases
- cron: '0 2 * * 0'
workflow_dispatch:
inputs:
test_type:
description: 'Type of dependency test to run'
required: true
default: 'all'
type: choice
options:
- 'all'
- 'min-versions'
- 'max-versions'
- 'python-versions'
- 'pip-freeze'

permissions:
contents: read

jobs:
dependency-matrix:
name: Test Python ${{ matrix.python-version }} with ${{ matrix.deps-type }} dependencies
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
deps-type: ['min', 'max', 'default']
exclude:
# Skip some combinations to reduce CI time
- python-version: '3.10'
deps-type: 'default'
- python-version: '3.11'
deps-type: 'default'

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential

- name: Install tox
run: |
python -m pip install --upgrade pip
pip install tox

- name: Run dependency tests
run: |
tox -e py$(echo ${{ matrix.python-version }} | tr -d .)-deps-${{ matrix.deps-type }}
env:
# Limit OpenMP threads to prevent CI resource issues
OMP_NUM_THREADS: 1
MKL_NUM_THREADS: 1

pip-freeze-testing:
name: Test Client Pip Freeze Environments
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' && github.event.inputs.test_type == 'pip-freeze' || github.event_name == 'schedule'

steps:
- uses: actions/checkout@v4

- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip'

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential

- name: Install tox
run: |
python -m pip install --upgrade pip
pip install tox

- name: Test pip freeze environments
run: |
tox -e pip-freeze-test
env:
OMP_NUM_THREADS: 1
MKL_NUM_THREADS: 1

min-versions-only:
name: Test Minimum Dependency Versions
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' && github.event.inputs.test_type == 'min-versions'

steps:
- uses: actions/checkout@v4

- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip'

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential

- name: Install tox
run: |
python -m pip install --upgrade pip
pip install tox

- name: Test minimum versions
run: |
make test-deps-min
env:
OMP_NUM_THREADS: 1
MKL_NUM_THREADS: 1

max-versions-only:
name: Test Maximum Dependency Versions
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' && github.event.inputs.test_type == 'max-versions'

steps:
- uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential

- name: Install tox
run: |
python -m pip install --upgrade pip
pip install tox

- name: Test maximum versions
run: |
make test-deps-max
env:
OMP_NUM_THREADS: 1
MKL_NUM_THREADS: 1

python-versions-only:
name: Test All Python Versions with Default Dependencies
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' && github.event.inputs.test_type == 'python-versions'

steps:
- uses: actions/checkout@v4

- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip'

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential

- name: Install tox
run: |
python -m pip install --upgrade pip
pip install tox

- name: Test all Python versions
run: |
make test-python-versions
env:
OMP_NUM_THREADS: 1
MKL_NUM_THREADS: 1

report-status:
name: Report Dependency Testing Status
runs-on: ubuntu-latest
needs: [dependency-matrix]
if: always()

steps:
- name: Report results
run: |
echo "Dependency testing completed"
echo "Matrix job status: ${{ needs.dependency-matrix.result }}"

if [[ "${{ needs.dependency-matrix.result }}" == "failure" ]]; then
echo "❌ Some dependency combinations failed"
exit 1
else
echo "✅ All dependency combinations passed"
fi
8 changes: 8 additions & 0 deletions .github/workflows/python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ jobs:
- name: Unit Tests
run: make test

- name: Test Minimum Dependencies (Python 3.9)
run: |
poetry run tox -e py39-min

- name: Test Latest Dependencies (Python 3.9)
run: |
poetry run tox -e py39-max

# Tests that we can build the docs
- name: Generate Docs
run: make docs
Expand Down
6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@
"python.analysis.typeCheckingMode": "off",
"python.analysis.extraPaths": [
"./tests"
]
],
"cursorpyright.analysis.extraPaths": [
"./tests"
],
"cursorpyright.analysis.typeCheckingMode": "off"
}
22 changes: 21 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,30 @@ verify-exposed-credentials:
ensure-clean-notebooks:
poetry run python scripts/ensure_clean_notebooks.py

# Dependency testing with tox
test-deps-min:
poetry run tox -e py39-min,py310-min,py311-min,py312-min

test-deps-max:
poetry run tox -e py39-max,py310-max,py311-max,py312-max

test-python-versions:
poetry run tox -e py39,py310,py311,py312

test-freeze-env:
ifdef FREEZE_FILE
FREEZE_FILE=$(FREEZE_FILE) poetry run tox -e freeze
else
@echo "Usage: make test-freeze-env FREEZE_FILE=path/to/requirements.txt"
endif

test-tox-all:
poetry run tox

# Quick target to run all checks
check: copyright format lint test verify-copyright verify-exposed-credentials ensure-clean-notebooks

.PHONY: docs quarto-docs
.PHONY: docs quarto-docs test-deps-min test-deps-max test-python-versions test-freeze-env test-tox-all

notebook:
@python notebooks/templates/e2e_template.py
Expand Down
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,35 @@ The value of `tag` corresponds to one of the options provided by Poetry: <https:

## Generating API Reference Docs

## Dependency Testing

Test compatibility across different Python versions and dependency combinations:

```bash
# Test all Python versions with default dependencies
make test-python-versions

# Test minimum supported dependency versions
make test-deps-min

# Test latest dependency versions
make test-deps-max

# Test with a specific pip freeze file
make test-freeze-env FREEZE_FILE=requirements.txt

# Run all tox environments
make test-tox-all
```

### Available tox environments:
- `py{39,310,311,312}` - Test with default Poetry-managed dependencies
- `py{39,310,311,312}-min` - Test with minimum supported dependency versions
- `py{39,310,311,312}-max` - Test with latest dependency versions
- `freeze` - Test with specific pip freeze file (requires `FREEZE_FILE` env var)

## Documentation

The [API reference documentation](https://docs.validmind.ai/validmind/validmind.html) you see in our docs site is generated in HTML format with `pdoc` with the following
command:

Expand Down
Loading
Loading