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
6 changes: 3 additions & 3 deletions .github/workflows/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: 3.x
- uses: actions/cache@v4
- uses: actions/cache@v6
with:
path: .cache
key: ${{ github.ref }}
Expand Down
55 changes: 24 additions & 31 deletions .github/workflows/publish_pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,27 @@ name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
on: push

jobs:
check-version:
name: Verify tag matches package version
if: startsWith(github.ref, 'refs/tags/') # only relevant on tag pushes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Verify release tag matches pyproject version
run: |
TAG="${GITHUB_REF_NAME#v}"
VER="$(grep -m1 '^version = ' pyproject.toml | sed -E 's/.*"([^"]+)".*/\1/')"
echo "tag=$TAG pyproject=$VER"
test "$TAG" = "$VER"

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

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v7
with:
python-version: "3.x"
- name: Install pypa/build
Expand All @@ -22,7 +35,7 @@ jobs:
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: python-package-distributions
path: dist/
Expand All @@ -33,6 +46,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
- check-version
runs-on: ubuntu-latest
environment:
name: pypi
Expand All @@ -42,37 +56,23 @@ jobs:

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

github-release:
name: >-
Sign the Python 🐍 distribution 📦 with Sigstore
and upload them to GitHub Release
name: Create a GitHub Release
needs:
- publish-to-pypi
runs-on: ubuntu-latest

permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/gh-action-sigstore-python@v2.1.1
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
Expand All @@ -81,21 +81,13 @@ jobs:
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'

publish-to-testpypi:
name: Publish Python 🐍 distribution 📦 to TestPyPI
if: startsWith(github.ref, 'refs/tags/') # only publish on tag pushes
needs:
- build
- check-version
runs-on: ubuntu-latest

environment:
Expand All @@ -107,11 +99,12 @@ jobs:

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
repository-url: https://test.pypi.org/legacy/
skip-existing: true
2 changes: 1 addition & 1 deletion .github/workflows/spelling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v7
- name: Codespell
uses: codespell-project/actions-codespell@v2
with:
Expand Down
23 changes: 12 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,29 @@ name: Tests
on: push

jobs:
build:

test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# 3.14 blocked: pyenzyme pins fastobo<0.14, which has no 3.14 wheel.
python-version: ["3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
- name: Set up uv and Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@v9.0.0
with:
python-version: ${{ matrix.python-version }}
enable-cache: true

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install poetry
poetry install --with dev
# --locked fails if uv.lock is out of sync with pyproject.toml.
run: uv sync --locked --group dev

- name: Run tests with pytest
run: |
poetry run pytest --nbval --nbval-lax
# Skip live-API tests: CI runs from datacenter IPs that PubChem rate-limits.
# They still run locally by default with a plain `pytest`.
run: uv run pytest tests/ -m "not network"
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Run once per clone: uv run pre-commit install
repos:
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.11.31
hooks:
# Re-locks uv.lock whenever pyproject.toml changes, so the two can't drift.
- id: uv-lock
2 changes: 2 additions & 0 deletions mtphandler/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import json # noqa
import os # noqa
from importlib.metadata import version

from .mtp_logging import configure_logger
from .plate_manager import PlateManager # noqa

__version__ = version("mtphandler")

configure_logger()
2 changes: 1 addition & 1 deletion mtphandler/readers/multiskan_spectrum_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def read_multiskan_spectrum_1500(
if not temperature:
TEMP_PATTERN = r"\d{1,3}deg"
temperature = re.findall(TEMP_PATTERN, path)[0]
temperature = re.split("(\d+)", temperature)[1]
temperature = re.split(r"(\d+)", temperature)[1]
if not temperature:
raise ValueError("Could not find pH in path. Please specify 'ph'.")

Expand Down
17 changes: 15 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
[build-system]
requires = ["setuptools>=61"]
build-backend = "setuptools.build_meta"

[project]
name = "mtphandler"
version = "0.2.22"
version = "0.2.23"
description = "Python package for processing, enriching, and converting microtiter plate data into standardized EnzymeML time-course data, ready for data science."
readme = "README.md"
requires-python = ">=3.10,<3.14"
license = { text = "MIT License" }
license = "MIT"
authors = [{ name = "haeussma", email = "83341109+haeussma@users.noreply.github.com" }]

dependencies = [
Expand All @@ -19,8 +23,12 @@ dependencies = [
"mdmodels>=0.2.0",
]

[tool.setuptools.packages.find]
include = ["mtphandler*"]

[dependency-groups]
dev = [
"pre-commit>=3.7.0",
"mkdocs-material>=9.5.7",
"pytest>=8.0.0",
"devtools>=0.12.2",
Expand All @@ -32,3 +40,8 @@ dev = [
"notebook<7",
"jupyter-contrib-nbextensions>=0.7.0",
]

[tool.pytest.ini_options]
markers = [
"network: test hits a live external API (PubChem); excluded in CI datacenter runs",
]
1 change: 1 addition & 0 deletions tests/unit_tests/test_mtphandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ def test_define_molecule_with_non_integer_pubchem_cid(setup_handler):
)


@pytest.mark.network
def test_define_molecule_without_name(setup_handler):
# Initialize the class object
plate_manager, plate = setup_handler
Expand Down
Loading