- less restrictive dependency versions
- update publish action
This commit is contained in:
38
.github/workflows/publish.yml
vendored
38
.github/workflows/publish.yml
vendored
@@ -24,10 +24,10 @@ jobs:
|
|||||||
- runner: ubuntu-latest
|
- runner: ubuntu-latest
|
||||||
target: ppc64le
|
target: ppc64le
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- uses: actions/setup-python@v5
|
- uses: actions/setup-python@v6
|
||||||
with:
|
with:
|
||||||
python-version: '3.10'
|
python-version: '3.12'
|
||||||
- name: Build wheels
|
- name: Build wheels
|
||||||
uses: PyO3/maturin-action@v1
|
uses: PyO3/maturin-action@v1
|
||||||
with:
|
with:
|
||||||
@@ -36,7 +36,7 @@ jobs:
|
|||||||
sccache: 'true'
|
sccache: 'true'
|
||||||
manylinux: auto
|
manylinux: auto
|
||||||
- name: Upload wheels
|
- name: Upload wheels
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v6
|
||||||
with:
|
with:
|
||||||
name: wheels-linux-${{ matrix.platform.target }}
|
name: wheels-linux-${{ matrix.platform.target }}
|
||||||
path: dist
|
path: dist
|
||||||
@@ -48,13 +48,13 @@ jobs:
|
|||||||
platform:
|
platform:
|
||||||
- runner: windows-latest
|
- runner: windows-latest
|
||||||
target: x64
|
target: x64
|
||||||
# - runner: windows-latest
|
- runner: windows-11-arm
|
||||||
# target: x86
|
target: aarch64
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- uses: actions/setup-python@v5
|
- uses: actions/setup-python@v6
|
||||||
with:
|
with:
|
||||||
python-version: '3.10'
|
python-version: '3.12'
|
||||||
architecture: ${{ matrix.platform.target }}
|
architecture: ${{ matrix.platform.target }}
|
||||||
- name: Build wheels
|
- name: Build wheels
|
||||||
uses: PyO3/maturin-action@v1
|
uses: PyO3/maturin-action@v1
|
||||||
@@ -63,7 +63,7 @@ jobs:
|
|||||||
args: --release --out dist
|
args: --release --out dist
|
||||||
sccache: 'true'
|
sccache: 'true'
|
||||||
- name: Upload wheels
|
- name: Upload wheels
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v6
|
||||||
with:
|
with:
|
||||||
name: wheels-windows-${{ matrix.platform.target }}
|
name: wheels-windows-${{ matrix.platform.target }}
|
||||||
path: dist
|
path: dist
|
||||||
@@ -78,10 +78,10 @@ jobs:
|
|||||||
- runner: macos-14
|
- runner: macos-14
|
||||||
target: aarch64
|
target: aarch64
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- uses: actions/setup-python@v5
|
- uses: actions/setup-python@v6
|
||||||
with:
|
with:
|
||||||
python-version: '3.10'
|
python-version: '3.12'
|
||||||
- name: Build wheels
|
- name: Build wheels
|
||||||
uses: PyO3/maturin-action@v1
|
uses: PyO3/maturin-action@v1
|
||||||
with:
|
with:
|
||||||
@@ -89,7 +89,7 @@ jobs:
|
|||||||
args: --release --out dist
|
args: --release --out dist
|
||||||
sccache: 'true'
|
sccache: 'true'
|
||||||
- name: Upload wheels
|
- name: Upload wheels
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v6
|
||||||
with:
|
with:
|
||||||
name: wheels-macos-${{ matrix.platform.target }}
|
name: wheels-macos-${{ matrix.platform.target }}
|
||||||
path: dist
|
path: dist
|
||||||
@@ -97,14 +97,14 @@ jobs:
|
|||||||
sdist:
|
sdist:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- name: Build sdist
|
- name: Build sdist
|
||||||
uses: PyO3/maturin-action@v1
|
uses: PyO3/maturin-action@v1
|
||||||
with:
|
with:
|
||||||
command: sdist
|
command: sdist
|
||||||
args: --out dist
|
args: --out dist
|
||||||
- name: Upload sdist
|
- name: Upload sdist
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v6
|
||||||
with:
|
with:
|
||||||
name: wheels-sdist
|
name: wheels-sdist
|
||||||
path: dist
|
path: dist
|
||||||
@@ -114,7 +114,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [linux, windows, macos, sdist]
|
needs: [linux, windows, macos, sdist]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v7
|
||||||
- name: Publish to PyPI
|
- name: Publish to PyPI
|
||||||
uses: PyO3/maturin-action@v1
|
uses: PyO3/maturin-action@v1
|
||||||
env:
|
env:
|
||||||
@@ -128,12 +128,12 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 25
|
timeout-minutes: 25
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
|
|
||||||
- name: cargo-release Cache
|
- name: cargo-release Cache
|
||||||
id: cargo_release_cache
|
id: cargo_release_cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v5
|
||||||
with:
|
with:
|
||||||
path: ~/.cargo/bin/cargo-release
|
path: ~/.cargo/bin/cargo-release
|
||||||
key: ${{ runner.os }}-cargo-release
|
key: ${{ runner.os }}-cargo-release
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -71,3 +71,4 @@ docs/_build/
|
|||||||
# Pyenv
|
# Pyenv
|
||||||
.python-version
|
.python-version
|
||||||
/Cargo.lock
|
/Cargo.lock
|
||||||
|
/tests/om/
|
||||||
|
|||||||
13
Cargo.toml
13
Cargo.toml
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ome-metadata"
|
name = "ome-metadata"
|
||||||
version = "0.3.1"
|
version = "0.3.2"
|
||||||
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>"]
|
||||||
@@ -8,6 +8,7 @@ license = "MIT"
|
|||||||
description = "Ome metadata as a rust/python structure."
|
description = "Ome metadata as a rust/python structure."
|
||||||
homepage = "https://github.com/wimpomp/ome-metadata"
|
homepage = "https://github.com/wimpomp/ome-metadata"
|
||||||
repository = "https://github.com/wimpomp/ome-metadata"
|
repository = "https://github.com/wimpomp/ome-metadata"
|
||||||
|
documentation = "https://docs.rs/ome-metadata"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
keywords = ["bioformats", "imread", "ome", "metadata"]
|
keywords = ["bioformats", "imread", "ome", "metadata"]
|
||||||
categories = ["multimedia::images", "science"]
|
categories = ["multimedia::images", "science"]
|
||||||
@@ -19,13 +20,13 @@ name = "ome_metadata"
|
|||||||
crate-type = ["cdylib", "rlib"]
|
crate-type = ["cdylib", "rlib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
enum-utils = "0.1.2"
|
enum-utils = "0.1"
|
||||||
serde = { version = "1.0.219", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
thiserror = "2.0.16"
|
thiserror = "2"
|
||||||
quick-xml = { version = "0.38.0", features = ["serialize"] }
|
quick-xml = { version = "0.38", features = ["serialize"] }
|
||||||
|
|
||||||
[dependencies.pyo3]
|
[dependencies.pyo3]
|
||||||
version = "0.24.2"
|
version = "0.27"
|
||||||
features = ["extension-module", "abi3-py310", "generate-import-lib", "anyhow"]
|
features = ["extension-module", "abi3-py310", "generate-import-lib", "anyhow"]
|
||||||
optional = true
|
optional = true
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
use quick_xml::DeError;
|
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
#[error("io error: {0}")]
|
#[error(transparent)]
|
||||||
IO(#[from] std::io::Error),
|
IO(#[from] std::io::Error),
|
||||||
#[error("serde error: {0}")]
|
#[error(transparent)]
|
||||||
SerdeXml(#[from] DeError),
|
SerdeXml(#[from] quick_xml::DeError),
|
||||||
#[error("size of {0} is unknown")]
|
#[error("size of {0} is unknown")]
|
||||||
SizeOfUnknown(String),
|
SizeOfUnknown(String),
|
||||||
#[error("no conversion to K by multiplication only")]
|
#[error("no conversion to K by multiplication only")]
|
||||||
|
|||||||
@@ -1817,7 +1817,7 @@ pub struct Pixels {
|
|||||||
#[serde(rename = "BinData")]
|
#[serde(rename = "BinData")]
|
||||||
pub bin_data: Option<BinData>,
|
pub bin_data: Option<BinData>,
|
||||||
#[serde(rename = "TiffData")]
|
#[serde(rename = "TiffData")]
|
||||||
pub tiff_data: Option<TiffData>,
|
pub tiff_data: Vec<TiffData>,
|
||||||
#[serde(rename = "MetadataOnly")]
|
#[serde(rename = "MetadataOnly")]
|
||||||
pub metadata_only: Option<MetadataOnly>,
|
pub metadata_only: Option<MetadataOnly>,
|
||||||
#[serde(rename = "Plane")]
|
#[serde(rename = "Plane")]
|
||||||
|
|||||||
14
src/py.rs
14
src/py.rs
@@ -6,14 +6,12 @@ use crate::ome::{
|
|||||||
use pyo3::exceptions::PyValueError;
|
use pyo3::exceptions::PyValueError;
|
||||||
use pyo3::prelude::*;
|
use pyo3::prelude::*;
|
||||||
|
|
||||||
|
|
||||||
impl From<crate::error::Error> for PyErr {
|
impl From<crate::error::Error> for PyErr {
|
||||||
fn from(err: crate::error::Error) -> PyErr {
|
fn from(err: crate::error::Error) -> PyErr {
|
||||||
PyErr::new::<PyValueError, _>(err.to_string())
|
PyErr::new::<PyValueError, _>(err.to_string())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
macro_rules! impl_enum_into_py_object {
|
macro_rules! impl_enum_into_py_object {
|
||||||
($($s:ident: $t:ty $(,)?)*) => {
|
($($s:ident: $t:ty $(,)?)*) => {
|
||||||
$(
|
$(
|
||||||
@@ -81,6 +79,11 @@ impl_enum_into_py_object! {
|
|||||||
Time: UnitsTime
|
Time: UnitsTime
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[pyfunction]
|
||||||
|
fn ome(text: &str) -> PyResult<Ome> {
|
||||||
|
Ok(text.parse()?)
|
||||||
|
}
|
||||||
|
|
||||||
#[pymodule]
|
#[pymodule]
|
||||||
#[pyo3(name = "ome_metadata_rs")]
|
#[pyo3(name = "ome_metadata_rs")]
|
||||||
fn ome_metadata_rs(m: &Bound<'_, PyModule>) -> PyResult<()> {
|
fn ome_metadata_rs(m: &Bound<'_, PyModule>) -> PyResult<()> {
|
||||||
@@ -91,11 +94,6 @@ fn ome_metadata_rs(m: &Bound<'_, PyModule>) -> PyResult<()> {
|
|||||||
m.add_class::<Pressure>()?;
|
m.add_class::<Pressure>()?;
|
||||||
m.add_class::<Temperature>()?;
|
m.add_class::<Temperature>()?;
|
||||||
m.add_class::<Time>()?;
|
m.add_class::<Time>()?;
|
||||||
|
m.add_function(wrap_pyfunction!(ome, m)?)?;
|
||||||
#[pyfn(m)]
|
|
||||||
fn ome(text: &str) -> PyResult<Ome> {
|
|
||||||
Ok(text.parse()?)
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user