Skip to content
Merged
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
17 changes: 10 additions & 7 deletions .github/workflows/build-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,33 +36,36 @@ jobs:
with:
python-version: "3.10"

- name: setup poetry
run: |
curl -sSL https://install.python-poetry.org | python -
- name: Cache Hugging Face
id: cache-hf
uses: actions/cache@v4
with:
path: ~/.cache/huggingface
key: docs-cache-hf

- name: Install pandoc
run: |
sudo apt install pandoc

- name: Install dependencies
run: |
poetry install --with docs
pip install .[docs]

- name: Run tests
if: github.event_name != 'workflow_dispatch'
run: |
echo "Testing documentation build..."
make test-docs
python -m sphinx build -b doctest docs/source docs/build/html

- name: Build documentation
if: ${{ github.ref == 'refs/heads/dev' }} && github.event_name != 'workflow_dispatch'
run: |
make docs
python -m sphinx build -b html docs/source docs/build/html

- name: build multiversion documentation
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
run: |
make multi-version-docs
sphinx-multiversion docs/source docs/build/html

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/reusable-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Reusable Test Workflow

on:
workflow_call:
inputs:
test_command:
required: true
type: string
description: 'Command to run tests'

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
python-version: [ "3.10", "3.11", "3.12" ]
include:
- os: windows-latest
python-version: "3.10"

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Cache Hugging Face
id: cache-hf
uses: actions/cache@v4
with:
path: ~/.cache/huggingface
key: ${{ runner.os }}-hf

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

- name: Install dependencies
run: |
pip install .[test]

- name: Run tests
run: |
${{ inputs.test_command }}
31 changes: 3 additions & 28 deletions .github/workflows/test-inference.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,6 @@ on:

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
python-version: [ "3.10", "3.11", "3.12" ]
include:
- os: windows-latest
python-version: "3.10"

steps:
- name: Checkout code
uses: actions/checkout@v4

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

- name: Install dependencies
run: |
pip install .
pip install pytest pytest-asyncio

- name: Run tests
run: |
pytest tests/pipeline/test_inference.py
uses: ./.github/workflows/reusable-test.yaml
with:
test_command: pytest -n auto tests/pipeline/test_inference.py
31 changes: 3 additions & 28 deletions .github/workflows/test-nodes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,6 @@ on:

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
python-version: [ "3.10", "3.11", "3.12" ]
include:
- os: windows-latest
python-version: "3.10"

steps:
- name: Checkout code
uses: actions/checkout@v4

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

- name: Install dependencies
run: |
pip install .
pip install pytest pytest-asyncio
- name: Run tests
run: |
pytest tests/nodes
uses: ./.github/workflows/reusable-test.yaml
with:
test_command: pytest -n auto tests/nodes
31 changes: 3 additions & 28 deletions .github/workflows/test-optimization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,6 @@ on:

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
python-version: [ "3.10", "3.11", "3.12" ]
include:
- os: windows-latest
python-version: "3.10"

steps:
- name: Checkout code
uses: actions/checkout@v4

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

- name: Install dependencies
run: |
pip install .
pip install pytest pytest-asyncio

- name: Run tests
run: |
pytest tests/pipeline/test_optimization.py
uses: ./.github/workflows/reusable-test.yaml
with:
test_command: pytest -n auto tests/pipeline/test_optimization.py
31 changes: 3 additions & 28 deletions .github/workflows/test-presets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,6 @@ on:

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
python-version: [ "3.10", "3.11", "3.12" ]
include:
- os: windows-latest
python-version: "3.10"

steps:
- name: Checkout code
uses: actions/checkout@v4

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

- name: Install dependencies
run: |
pip install .
pip install pytest pytest-asyncio

- name: Run tests
run: |
pytest tests/pipeline/test_presets.py
uses: ./.github/workflows/reusable-test.yaml
with:
test_command: pytest -n auto tests/pipeline/test_presets.py
9 changes: 2 additions & 7 deletions .github/workflows/typing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,9 @@ jobs:
python-version: "3.10"
cache: "pip"

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.poetry/bin" >> $GITHUB_PATH

- name: Install dependencies
run: |
poetry install --with typing
pip install .[typing]

- name: Run mypy
run: make typing
run: mypy autointent
31 changes: 3 additions & 28 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,6 @@ on:

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
python-version: [ "3.10", "3.11", "3.12" ]
include:
- os: windows-latest
python-version: "3.10"

steps:
- name: Checkout code
uses: actions/checkout@v4

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

- name: Install dependencies
run: |
pip install .
pip install pytest pytest-asyncio

- name: Run tests
run: |
pytest --ignore=tests/nodes --ignore=tests/pipeline
uses: ./.github/workflows/reusable-test.yaml
with:
test_command: pytest -n auto --ignore=tests/nodes --ignore=tests/pipeline
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ poetry = poetry run

.PHONY: install
install:
poetry install --with dev,test,typing,docs
poetry install --extras "dev test typing docs"

.PHONY: test
test:
Expand All @@ -24,7 +24,7 @@ lint:

.PHONY: sync
sync:
poetry sync --with dev,test,typing,docs
poetry sync --extras "dev test typing docs"

.PHONY: docs
docs:
Expand Down
5 changes: 3 additions & 2 deletions autointent/context/data_handler/_stratification.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from numpy import typing as npt
from sklearn.model_selection import train_test_split
from skmultilearn.model_selection import IterativeStratification
from transformers import set_seed
from transformers import set_seed # type: ignore[attr-defined]

from autointent import Dataset
from autointent.custom_types import LabelType
Expand Down Expand Up @@ -128,7 +128,8 @@ def _split_multilabel(self, dataset: HFDataset, test_size: float) -> Sequence[np
Returns:
A sequence containing indices for train and test splits.
"""
set_seed(self.random_seed) # workaround for buggy nature of IterativeStratification from skmultilearn
if self.random_seed is not None:
set_seed(self.random_seed) # workaround for buggy nature of IterativeStratification from skmultilearn
splitter = IterativeStratification(
n_splits=2,
order=2,
Expand Down
23 changes: 22 additions & 1 deletion autointent/modules/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,25 @@ def _create_modules_dict(modules: list[type[T]]) -> dict[str, type[T]]:
)


__all__ = [] # type: ignore[var-annotated]
__all__ = [
"AdaptiveDecision",
"ArgmaxDecision",
"BaseDecision",
"BaseEmbedding",
"BaseModule",
"BaseRegex",
"BaseScorer",
"DNNCScorer",
"DescriptionScorer",
"JinoosDecision",
"KNNScorer",
"LinearScorer",
"LogregAimedEmbedding",
"MLKnnScorer",
"RerankScorer",
"RetrievalAimedEmbedding",
"SimpleRegex",
"SklearnScorer",
"ThresholdDecision",
"TunableDecision",
]
Loading
Loading