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
25 changes: 8 additions & 17 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,27 @@ name: Documentation
on:
push:
branches: [ main]
pull_request:
branches: [ main]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
- uses: actions/checkout@v4

- name: Set up uv
uses: astral-sh/setup-uv@v6
with:
python-version: "3.11"

- name: Install modelskill
run: |
pip install .[docs]
enable-cache: true

- name: Install dependencies
run: uv sync --dev

- name: Build documentation
run: |
make docs

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: docs
path: docs/_site/

- name: Publish to GitHub Pages
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3.6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
58 changes: 25 additions & 33 deletions .github/workflows/full_test.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,37 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Full test

on:
push:
branches: [ main]
branches: [main]
pull_request:
branches: [main]

jobs:
build:

runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.10", "3.13"]
python-version: ["3.10", "3.13"]

steps:
- uses: actions/checkout@v3
- uses: astral-sh/ruff-action@v2 # Fail fast if there are any linting errors
with:
version: 0.6.2
src: "modelskill"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov

- name: Install modelskill
run: |
pip install .[test]
- name: Test with pytest
run: |
pytest --cov=modelskill --ignore tests/notebooks/
- name: Static type check
run: make typecheck
- name: Test docstrings with pytest
run: |
pytest ./modelskill/metrics.py --doctest-modules
- uses: actions/checkout@v4

- uses: astral-sh/ruff-action@v2
with:
version: 0.6.2
src: src

- name: Set up uv
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python-version }}
enable-cache: true

- name: Install dependencies
run: uv sync --group test --no-dev

- name: Type check
run: make typecheck

- name: Test
run: make test
19 changes: 10 additions & 9 deletions .github/workflows/notebooks_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,22 @@ on:
branches: [ main]
pull_request:
branches: [ main ]
types: [review_requested, ready_for_review]
workflow_dispatch:

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
- uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@v6
with:
python-version: '3.11'
- name: Install modelskill
enable-cache: true
- name: Install dependencies
run: uv sync --group test --group notebooks --no-dev
- name: Test notebooks
run: |
pip install .[test,notebooks]
- name: Test notebooks
run: |
pytest --durations=0 tests/notebooks/
uv run pytest tests/notebooks/
49 changes: 34 additions & 15 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,52 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package

on:
release:
types: [created]
types: [published]
workflow_dispatch:

jobs:
deploy:

test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.10", "3.13"]

steps:
- uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Install dependencies
run: uv sync --group test --no-dev
- name: Test with pytest
run: |
uv run pytest --ignore tests/performance/ --ignore tests/notebooks/ --disable-warnings

deploy:
needs: test
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write


steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
- uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@v6
with:
python-version: '3.11'
enable-cache: true
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build wheel twine
- name: Install modelskill
run: pip install .[test]
- name: Test
run: pytest
- name: Build
run: python -m build
run: uv sync --group test --no-dev
- name: Build
run: uv build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,6 @@ notebooks/Untitled.ipynb

docs/_site/
docs/_extensions/
docs/api/*.qmd
docs/api/*.qmd

uv.lock
20 changes: 10 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
LIB = modelskill
LIB = src

check: lint typecheck test doctest

build: typecheck test
python -m build
uv build

lint:
ruff check $(LIB)
uv run ruff check $(LIB)

format:
ruff format $(LIB)
uv run ruff format $(LIB)

test:
pytest --disable-warnings
uv run pytest --disable-warnings

typecheck:
mypy $(LIB)/ --config-file pyproject.toml
uv run mypy $(LIB)/ --config-file pyproject.toml

doctest:
pytest ./modelskill/metrics.py --doctest-modules
uv run pytest ./modelskill/metrics.py --doctest-modules

coverage:
pytest --cov-report html --cov=$(LIB) tests/
uv run pytest --cov-report html --cov=$(LIB) tests/

docs: FORCE
set -e; \
cd docs; \
quartodoc build; \
quarto render; \
uv run quartodoc build; \
uv run quarto render; \
if [ ! -f _site/index.html ]; then \
echo "Error: index.html not found. Quarto render failed."; \
exit 1; \
Expand Down
14 changes: 3 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build]
include = [
"modelskill/**/*",
]

[tool.hatch.metadata]
allow-direct-references = true
requires = ["uv_build>=0.8.9,<0.9.0"]
build-backend = "uv_build"

[project]
name = "modelskill"
Expand Down Expand Up @@ -46,7 +38,7 @@ classifiers = [
"Topic :: Scientific/Engineering",
]

[project.optional-dependencies]
[dependency-groups]
docs = [
"quarto-cli==1.5.57",
"quartodoc==0.9.1",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading