also publish on pypi
This commit is contained in:
117
.github/workflows/publish.yml
vendored
117
.github/workflows/publish.yml
vendored
@@ -6,6 +6,123 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
jobs:
|
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:
|
crates_io_publish:
|
||||||
name: Publish (crates.io)
|
name: Publish (crates.io)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ome-metadata"
|
name = "ome-metadata"
|
||||||
version = "0.2.0"
|
version = "0.2.1"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
rust-version = "1.85.1"
|
rust-version = "1.85.1"
|
||||||
authors = ["Wim Pomp <w.pomp@nki.nl>"]
|
authors = ["Wim Pomp <w.pomp@nki.nl>"]
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections import UserDict, UserList
|
||||||
from . import ome_metadata_rs as rs # noqa
|
from . import ome_metadata_rs as rs # noqa
|
||||||
|
|
||||||
|
|
||||||
class Ome(dict):
|
class Ome(UserDict):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def from_xml(xml: str) -> Ome:
|
def from_xml(xml: str) -> Ome:
|
||||||
"""Create the OME structure from an XML string"""
|
"""Create the OME structure from an XML string"""
|
||||||
@@ -27,7 +28,7 @@ class Ome(dict):
|
|||||||
return new
|
return new
|
||||||
|
|
||||||
|
|
||||||
class OmeList(list):
|
class OmeList(UserList):
|
||||||
def __getitem__(self, item: int) -> Ome | OmeList | int | float | str:
|
def __getitem__(self, item: int) -> Ome | OmeList | int | float | str:
|
||||||
new = super().__getitem__(item)
|
new = super().__getitem__(item)
|
||||||
if isinstance(new, dict):
|
if isinstance(new, dict):
|
||||||
|
|||||||
@@ -2778,6 +2778,7 @@ macro_rules! impl_enum_variants {
|
|||||||
($($t:ty $(,)?)*) => {
|
($($t:ty $(,)?)*) => {
|
||||||
$(
|
$(
|
||||||
impl $t {
|
impl $t {
|
||||||
|
/// all possible variants of this enum that can be constructed or converted into
|
||||||
pub fn variants() -> Vec<Self> {
|
pub fn variants() -> Vec<Self> {
|
||||||
Self::iter().collect::<Vec<_>>()
|
Self::iter().collect::<Vec<_>>()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user