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: 9 additions & 8 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches: [ main, release* ]
pull_request:
branches: [ main, release* ]
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -15,6 +19,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: astral-sh/ruff-action@v4.0.0
with:
version: "0.14.x"
args: 'check .'
- uses: astral-sh/ruff-action@v4.0.0
with:
version: "0.14.x"
Expand All @@ -27,16 +35,9 @@ jobs:
with:
python-version: "3.11"
cache: "pip"
- name: Checkout sequince-dev/sequince
uses: actions/checkout@v7
with:
repository: sequince-dev/sequince
ssh-key: ${{ secrets.SEQUINCE_DEPLOY_KEY }}
path: sequince
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install ./sequince
python -m pip install . "mypy>=1.10"
python -m pip install . "sequince==0.1.0b1" "mypy>=1.10"
- name: Type check
run: mypy
40 changes: 20 additions & 20 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,30 @@ on:
release:
types: [published]

permissions:
contents: read

jobs:
build:
name: Build distribution
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.x"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v7
with:
name: python-package-distributions
path: dist/
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Install build and metadata validation tools
run: python -m pip install build twine
- name: Build source distribution and wheel
run: python -m build
- name: Validate distribution metadata
run: python -m twine check --strict dist/*
- uses: actions/upload-artifact@v7
with:
name: python-package-distributions
path: dist/
if-no-files-found: error

pypi-publish:
name: Upload release to PyPI
Expand Down
69 changes: 52 additions & 17 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,79 @@ on:
branches: [ main, release* ]
pull_request:
branches: [ main, release* ]
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Install build and metadata validation tools
run: python -m pip install build twine
- name: Build source distribution and wheel
run: python -m build
- name: Validate distribution metadata
run: python -m twine check --strict dist/*
- uses: actions/upload-artifact@v7
with:
name: python-package-distributions
path: dist/
if-no-files-found: error

tests:
name: Python ${{ matrix.python-version }} (${{ matrix.os }})
name: Python ${{ matrix.python-version }} (Sequince ${{ matrix.sequince }})
needs: build

strategy:
fail-fast: false
matrix:
os: [Ubuntu]
python-version: ["3.11", "3.12", "3.13"]
runs-on: ${{ matrix.os }}-latest
sequince: ["0.1.0b1"]
include:
- python-version: "3.13"
sequince: main
runs-on: ubuntu-latest
env:
JAX_PLATFORMS: cpu

steps:
- name: Checkout repository and submodules
- name: Checkout tests and dependency groups
uses: actions/checkout@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Checkout sequince-dev/sequince
uses: actions/checkout@v7
- name: Download distributions
uses: actions/download-artifact@v8
with:
repository: sequince-dev/sequince
ssh-key: ${{ secrets.SEQUINCE_DEPLOY_KEY }}
path: sequince
name: python-package-distributions
path: dist/
- name: Install dependencies
env:
SEQUINCE_VERSION: ${{ matrix.sequince }}
run: |
python -m pip install --upgrade pip
# Install pytorch CPU version for testing
pip install torch --index-url https://download.pytorch.org/whl/cpu
# Install backends for orng
# Can't use cupy since it requires CUDA toolkit to be installed
pip install ./sequince
pip install -e . --group test
python -m pip install torch --index-url https://download.pytorch.org/whl/cpu
if [ "$SEQUINCE_VERSION" = main ]; then
python -m pip install "sequince @ git+https://github.com/sequince-dev/sequince.git@main"
else
python -m pip install "sequince==$SEQUINCE_VERSION"
fi
python -m pip install dist/*.whl --group test
python -m pip check
- name: Verify backend imports
run: python -c "import sklearn, torch, zuko, jax, flowjax, equinox"
- name: Test with pytest
run: |
python -m pytest tests/
run: python -m pytest tests/ -ra
6 changes: 5 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ and tool configuration are defined in `pyproject.toml`.

When developing against a local Sequince checkout, install it first, for example
with `python -m pip install -e ../sequince`, before installing sequince-density.
CI also installs Sequince from a checkout before running the tests.
CI tests the built wheel against Sequince 0.1.0b1 on Python 3.11–3.13, with
an additional Python 3.13 compatibility run against Sequince's `main` branch.
All density backends are installed and checked for import errors before pytest
runs. Both test and release workflows build a source distribution and wheel,
then validate their metadata with `twine check --strict`.

Use Pixi for the documentation environment, as described below. Generated lock
files and local environments should stay out of pull requests.
Expand Down
3 changes: 2 additions & 1 deletion src/sequince_density/flows/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import annotations

import inspect
from types import ModuleType
from typing import Any

from sequince.transforms import IdentityTransform, ParticleTransform
Expand All @@ -15,7 +16,7 @@ class Flow:
while remaining compatible with ``sequince.transforms.FlowTransform``.
"""

xp = None
xp: ModuleType | None = None

def __init__(
self,
Expand Down
Loading