- bump dependencies
- bump git action versions
This commit is contained in:
34
.github/workflows/publish.yml
vendored
34
.github/workflows/publish.yml
vendored
@@ -27,10 +27,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.13'
|
||||||
- name: Build wheels
|
- name: Build wheels
|
||||||
uses: PyO3/maturin-action@v1
|
uses: PyO3/maturin-action@v1
|
||||||
with:
|
with:
|
||||||
@@ -39,7 +39,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
|
||||||
@@ -55,10 +55,10 @@ jobs:
|
|||||||
# - runner: windows-latest
|
# - runner: windows-latest
|
||||||
# target: x86
|
# target: x86
|
||||||
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.13'
|
||||||
architecture: ${{ matrix.platform.target }}
|
architecture: ${{ matrix.platform.target }}
|
||||||
- name: Build wheels
|
- name: Build wheels
|
||||||
uses: PyO3/maturin-action@v1
|
uses: PyO3/maturin-action@v1
|
||||||
@@ -67,7 +67,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
|
||||||
@@ -83,10 +83,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.13'
|
||||||
- name: Build wheels
|
- name: Build wheels
|
||||||
uses: PyO3/maturin-action@v1
|
uses: PyO3/maturin-action@v1
|
||||||
with:
|
with:
|
||||||
@@ -94,7 +94,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
|
||||||
@@ -103,14 +103,14 @@ jobs:
|
|||||||
needs: [ publish_pytest ]
|
needs: [ publish_pytest ]
|
||||||
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
|
||||||
@@ -120,7 +120,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:
|
||||||
@@ -135,12 +135,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
|
||||||
|
|||||||
6
.github/workflows/pytest.yml
vendored
6
.github/workflows/pytest.yml
vendored
@@ -7,13 +7,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python-version: ["3.10", "3.12"]
|
python-version: ["3.10", "3.12", "3.13"]
|
||||||
os: [ubuntu-latest, windows-latest, macOS-latest]
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v6
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
- name: Install
|
- name: Install
|
||||||
|
|||||||
26
Cargo.toml
26
Cargo.toml
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "tiffwrite"
|
name = "tiffwrite"
|
||||||
version = "2025.9.1"
|
version = "2025.12.0"
|
||||||
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>"]
|
||||||
@@ -18,20 +18,20 @@ name = "tiffwrite"
|
|||||||
crate-type = ["cdylib", "rlib"]
|
crate-type = ["cdylib", "rlib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
colorcet = "0.2.1"
|
colorcet = "0.2"
|
||||||
colorgrad = "0.7.2"
|
colorgrad = "0.8"
|
||||||
chrono = "0.4.41"
|
chrono = "0.4"
|
||||||
css-color = "0.2.8"
|
css-color = "0.2"
|
||||||
flate2 = "1.1.1"
|
flate2 = "1"
|
||||||
ndarray = "0.16.1"
|
ndarray = "0.17"
|
||||||
num = "0.4.3"
|
num = "0.4"
|
||||||
numpy = { version = "0.25.0", optional = true }
|
numpy = { version = "0.27", optional = true }
|
||||||
rayon = "1.10.0"
|
rayon = "1"
|
||||||
thiserror = "2.0.16"
|
thiserror = "2"
|
||||||
zstd = "0.13.3"
|
zstd = "0.13"
|
||||||
|
|
||||||
[dependencies.pyo3]
|
[dependencies.pyo3]
|
||||||
version = "0.25.1"
|
version = "0.27"
|
||||||
features = ["extension-module", "abi3-py310", "generate-import-lib", "anyhow", "multiple-pymethods"]
|
features = ["extension-module", "abi3-py310", "generate-import-lib", "anyhow", "multiple-pymethods"]
|
||||||
optional = true
|
optional = true
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
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(transparent)]
|
||||||
|
ColorCet(#[from] colorcet::ColorcetError),
|
||||||
#[error("could not parse color: {0}")]
|
#[error("could not parse color: {0}")]
|
||||||
ColorParse(String),
|
ColorParse(String),
|
||||||
#[error("colorcet error: {0}")]
|
|
||||||
ColorCet(#[from] colorcet::ColorcetError),
|
|
||||||
#[error("could not covert ColorMap into LinearGradient")]
|
#[error("could not covert ColorMap into LinearGradient")]
|
||||||
Conversion
|
Conversion,
|
||||||
}
|
}
|
||||||
23
src/lib.rs
23
src/lib.rs
@@ -1,7 +1,8 @@
|
|||||||
|
pub mod error;
|
||||||
#[cfg(feature = "python")]
|
#[cfg(feature = "python")]
|
||||||
mod py;
|
mod py;
|
||||||
pub mod error;
|
|
||||||
|
|
||||||
|
use crate::error::Error;
|
||||||
use chrono::Utc;
|
use chrono::Utc;
|
||||||
use colorcet::ColorMap;
|
use colorcet::ColorMap;
|
||||||
use colorgrad::{Gradient, LinearGradient};
|
use colorgrad::{Gradient, LinearGradient};
|
||||||
@@ -23,7 +24,6 @@ use std::{
|
|||||||
};
|
};
|
||||||
use zstd::zstd_safe::CompressionLevel;
|
use zstd::zstd_safe::CompressionLevel;
|
||||||
use zstd::{DEFAULT_COMPRESSION_LEVEL, stream::Encoder};
|
use zstd::{DEFAULT_COMPRESSION_LEVEL, stream::Encoder};
|
||||||
use crate::error::Error;
|
|
||||||
|
|
||||||
const TAG_SIZE: usize = 20;
|
const TAG_SIZE: usize = 20;
|
||||||
const OFFSET_SIZE: usize = 8;
|
const OFFSET_SIZE: usize = 8;
|
||||||
@@ -60,7 +60,11 @@ impl IFD {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write(&mut self, ijtifffile: &mut IJTiffFile, where_to_write_offset: u64) -> Result<u64, Error> {
|
fn write(
|
||||||
|
&mut self,
|
||||||
|
ijtifffile: &mut IJTiffFile,
|
||||||
|
where_to_write_offset: u64,
|
||||||
|
) -> Result<u64, Error> {
|
||||||
let mut tags = self.tags.drain().collect::<Vec<_>>();
|
let mut tags = self.tags.drain().collect::<Vec<_>>();
|
||||||
tags.sort();
|
tags.sort();
|
||||||
ijtifffile.file.seek(SeekFrom::End(0))?;
|
ijtifffile.file.seek(SeekFrom::End(0))?;
|
||||||
@@ -748,7 +752,10 @@ impl IJTiffFile {
|
|||||||
/// set colormap from named colormap (see [colorcet](https://crates.io/crates/colorcet))
|
/// set colormap from named colormap (see [colorcet](https://crates.io/crates/colorcet))
|
||||||
pub fn set_colormap<S: AsRef<str>>(&mut self, name: S) -> Result<(), Error> {
|
pub fn set_colormap<S: AsRef<str>>(&mut self, name: S) -> Result<(), Error> {
|
||||||
let name = name.as_ref();
|
let name = name.as_ref();
|
||||||
let colormap: LinearGradient = name.parse::<ColorMap>()?.try_into().map_err(|_| Error::Conversion)?;
|
let colormap: LinearGradient = name
|
||||||
|
.parse::<ColorMap>()?
|
||||||
|
.try_into()
|
||||||
|
.map_err(|_| Error::Conversion)?;
|
||||||
let mut colormap = colormap
|
let mut colormap = colormap
|
||||||
.colors(256)
|
.colors(256)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
@@ -896,7 +903,13 @@ impl IJTiffFile {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_frame(&mut self, frame: CompressedFrame, c: usize, z: usize, t: usize) -> Result<(), Error> {
|
fn write_frame(
|
||||||
|
&mut self,
|
||||||
|
frame: CompressedFrame,
|
||||||
|
c: usize,
|
||||||
|
z: usize,
|
||||||
|
t: usize,
|
||||||
|
) -> Result<(), Error> {
|
||||||
let mut offsets = Vec::new();
|
let mut offsets = Vec::new();
|
||||||
let mut bytecounts = Vec::new();
|
let mut bytecounts = Vec::new();
|
||||||
for tile in frame.bytes {
|
for tile in frame.bytes {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use crate::{Colors, Compression, IJTiffFile, Tag};
|
use crate::{Colors, Compression, IJTiffFile, Tag};
|
||||||
use num::{Complex, FromPrimitive, Rational32};
|
use num::{Complex, FromPrimitive, Rational32};
|
||||||
use numpy::PyReadonlyArray2;
|
use numpy::{AllowTypeChange, PyArrayLike2};
|
||||||
use pyo3::exceptions::PyValueError;
|
use pyo3::exceptions::PyValueError;
|
||||||
use pyo3::prelude::*;
|
use pyo3::prelude::*;
|
||||||
|
|
||||||
@@ -338,7 +338,7 @@ macro_rules! impl_save {
|
|||||||
impl PyIJTiffFile {
|
impl PyIJTiffFile {
|
||||||
fn $t(
|
fn $t(
|
||||||
&mut self,
|
&mut self,
|
||||||
frame: PyReadonlyArray2<$T>,
|
frame: PyArrayLike2<$T, AllowTypeChange>,
|
||||||
c: usize,
|
c: usize,
|
||||||
t: usize,
|
t: usize,
|
||||||
z: usize,
|
z: usize,
|
||||||
|
|||||||
Reference in New Issue
Block a user