also publish on pypi

This commit is contained in:
Wim Pomp
2025-04-30 12:52:12 +02:00
parent a3a40fecb4
commit cbb135e13e
4 changed files with 122 additions and 3 deletions

View File

@@ -6,6 +6,123 @@ permissions:
contents: read
jobs:
linux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: x86
- runner: ubuntu-latest
target: aarch64
- runner: ubuntu-latest
target: armv7
- runner: ubuntu-latest
target: s390x
- runner: ubuntu-latest
target: ppc64le
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist
sccache: 'true'
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.platform.target }}
path: dist
windows:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: windows-latest
target: x64
# - runner: windows-latest
# target: x86
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
architecture: ${{ matrix.platform.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.platform.target }}
path: dist
macos:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: macos-latest
target: x86_64
- runner: macos-14
target: aarch64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.platform.target }}
path: dist
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: dist
release:
name: Release
runs-on: ubuntu-latest
needs: [linux, windows, macos, sdist]
steps:
- uses: actions/download-artifact@v4
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
command: upload
args: --non-interactive --skip-existing wheels-*/*
crates_io_publish:
name: Publish (crates.io)
runs-on: ubuntu-latest

View File

@@ -1,6 +1,6 @@
[package]
name = "ome-metadata"
version = "0.2.0"
version = "0.2.1"
edition = "2024"
rust-version = "1.85.1"
authors = ["Wim Pomp <w.pomp@nki.nl>"]

View File

@@ -1,9 +1,10 @@
from __future__ import annotations
from collections import UserDict, UserList
from . import ome_metadata_rs as rs # noqa
class Ome(dict):
class Ome(UserDict):
@staticmethod
def from_xml(xml: str) -> Ome:
"""Create the OME structure from an XML string"""
@@ -27,7 +28,7 @@ class Ome(dict):
return new
class OmeList(list):
class OmeList(UserList):
def __getitem__(self, item: int) -> Ome | OmeList | int | float | str:
new = super().__getitem__(item)
if isinstance(new, dict):

View File

@@ -2778,6 +2778,7 @@ macro_rules! impl_enum_variants {
($($t:ty $(,)?)*) => {
$(
impl $t {
/// all possible variants of this enum that can be constructed or converted into
pub fn variants() -> Vec<Self> {
Self::iter().collect::<Vec<_>>()
}