Skip to content

Commit bfaceee

Browse files
authored
Build for Python 3.14 (#109)
1 parent a7daa6c commit bfaceee

File tree

9 files changed

+19
-24
lines changed

9 files changed

+19
-24
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
# This file is autogenerated by maturin v1.8.2
2-
# To update, run
3-
#
4-
# maturin generate-ci github
5-
#
61
name: build wheels
72

83
on:
@@ -33,6 +28,7 @@ jobs:
3328
- "3.11"
3429
- "3.12"
3530
- "3.13"
31+
- "3.14"
3632
steps:
3733
- uses: actions/checkout@v4
3834
- name: Build wheels
@@ -53,16 +49,17 @@ jobs:
5349
strategy:
5450
matrix:
5551
platform:
56-
- runner: macos-13
52+
- runner: macos-15
5753
target: x86_64
58-
- runner: macos-14
54+
- runner: macos-15
5955
target: aarch64
6056
python-version:
6157
- "3.9"
6258
- "3.10"
6359
- "3.11"
6460
- "3.12"
6561
- "3.13"
62+
- "3.14"
6663
steps:
6764
- uses: actions/checkout@v4
6865
- name: Build wheels

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ bytecount = { version = "0.6", features = ["runtime-dispatch-simd"] }
3131
bzip2 = { version = "0.4", optional = true }
3232
flate2 = { version = "1.0.30", optional = true }
3333
memchr = "2.7.2"
34-
pyo3 = { version = "0.24.1", optional = true }
34+
pyo3 = { version = "0.27.2", optional = true }
3535
liblzma = { version = "0.3.1", optional = true }
3636
zstd = { version = "0.13.2", optional = true }
3737

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["maturin>=1.8,<2.0"]
2+
requires = ["maturin>=1.10,<2.0"]
33
build-backend = "maturin"
44

55
[project]

src/parser/fasta.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ where
288288
}
289289

290290
impl<R: io::Read + Send> FastxReader for Reader<R> {
291-
fn next(&mut self) -> Option<Result<SequenceRecord, ParseError>> {
291+
fn next(&mut self) -> Option<Result<SequenceRecord<'_>, ParseError>> {
292292
if self.finished {
293293
return None;
294294
}

src/parser/fastq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ where
385385
}
386386

387387
impl<R: io::Read + Send> FastxReader for Reader<R> {
388-
fn next(&mut self) -> Option<Result<SequenceRecord, ParseError>> {
388+
fn next(&mut self) -> Option<Result<SequenceRecord<'_>, ParseError>> {
389389
// No more records to read
390390
if self.finished {
391391
return None;

src/parser/record.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl<'a> SequenceRecord<'a> {
8484

8585
/// Returns the cleaned up sequence of the record. For FASTQ it is the same as `raw_seq` but
8686
/// for FASTA it is `raw_seq` minus all the `\r\n`
87-
pub fn seq(&self) -> Cow<[u8]> {
87+
pub fn seq(&self) -> Cow<'_, [u8]> {
8888
match self.buf_pos {
8989
BufferPositionKind::Fasta(bp) => bp.seq(self.buffer),
9090
BufferPositionKind::Fastq(bp) => bp.seq(self.buffer).into(),

src/parser/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ pub trait FastxReader: Send {
120120
/// Gets the next record in the stream.
121121
/// This imitates the Iterator API but does not support any iterator functions.
122122
/// This returns None once we reached the EOF.
123-
fn next(&mut self) -> Option<Result<SequenceRecord, ParseError>>;
123+
fn next(&mut self) -> Option<Result<SequenceRecord<'_>, ParseError>>;
124124
/// Returns the current line/byte in the stream we are reading from
125125
fn position(&self) -> &Position;
126126
/// Returns whether the current stream uses Windows or Unix style line endings

src/python.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fn get_seq_snippet(seq: &str, max_len: usize) -> String {
3838
if seq.len() > max_len {
3939
let start = &seq[..max_len - 4];
4040
let end = &seq[seq.len() - 3..];
41-
format!("{}…{}", start, end)
41+
format!("{start}…{end}")
4242
} else {
4343
seq.to_string()
4444
}
@@ -156,7 +156,7 @@ impl Record {
156156
#[getter]
157157
pub fn description(&self) -> PyResult<Option<&str>> {
158158
if let Some(pos) = self.id.find(char::is_whitespace) {
159-
Ok(Some(&self.id[pos..].trim_start()))
159+
Ok(Some(self.id[pos..].trim_start()))
160160
} else {
161161
Ok(None)
162162
}
@@ -219,9 +219,8 @@ impl Record {
219219
let mut hasher = DefaultHasher::new();
220220
self.id.hash(&mut hasher);
221221
self.seq.hash(&mut hasher);
222-
match &self.qual {
223-
Some(qual) => qual.hash(&mut hasher),
224-
None => {}
222+
if let Some(qual) = &self.qual {
223+
qual.hash(&mut hasher);
225224
}
226225
Ok(hasher.finish())
227226
}
@@ -249,7 +248,7 @@ impl Record {
249248

250249
fn __repr__(&self) -> PyResult<String> {
251250
let id_snippet = match self.name() {
252-
Ok(name) if name != self.id => format!("{}…", name),
251+
Ok(name) if name != self.id => format!("{name}…"),
253252
Ok(name) => name.to_string(),
254253
Err(_) => self.id.clone(),
255254
};
@@ -259,8 +258,7 @@ impl Record {
259258
None => "None".to_string(),
260259
};
261260
Ok(format!(
262-
"Record(id={}, seq={}, qual={})",
263-
id_snippet, seq_snippet, quality_snippet
261+
"Record(id={id_snippet}, seq={seq_snippet}, qual={quality_snippet})"
264262
))
265263
}
266264
}
@@ -424,7 +422,7 @@ pub fn py_decode_phred(qual: &str, base_64: bool, py: Python<'_>) -> PyResult<Py
424422
PhredEncoding::Phred33
425423
};
426424
let scores = decode_phred(qual.as_bytes(), encoding)
427-
.map_err(|e| PyValueError::new_err(format!("Invalid Phred quality: {}", e)))?;
425+
.map_err(|e| PyValueError::new_err(format!("Invalid Phred quality: {e}")))?;
428426
Ok(PyTuple::new(py, &scores)?.into())
429427
}
430428

src/sequence.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ pub fn complement(n: u8) -> u8 {
107107
/// Taking in a sequence string, return the canonical form of the sequence
108108
/// (e.g. the lexigraphically lowest of either the original sequence or its
109109
/// reverse complement)
110-
pub fn canonical(seq: &[u8]) -> Cow<[u8]> {
110+
pub fn canonical(seq: &[u8]) -> Cow<'_, [u8]> {
111111
let mut buf: Vec<u8> = Vec::with_capacity(seq.len());
112112
// enough just keeps our comparisons from happening after they need to
113113
let mut enough = false;
@@ -136,7 +136,7 @@ pub fn canonical(seq: &[u8]) -> Cow<[u8]> {
136136
/// Find the lexigraphically smallest substring of `seq` of length `length`
137137
///
138138
/// There's probably a faster algorithm for this somewhere...
139-
pub fn minimizer(seq: &[u8], length: usize) -> Cow<[u8]> {
139+
pub fn minimizer(seq: &[u8], length: usize) -> Cow<'_, [u8]> {
140140
let reverse_complement: Vec<u8> = seq.iter().rev().map(|n| complement(*n)).collect();
141141
let mut minmer = Cow::Borrowed(&seq[..length]);
142142

0 commit comments

Comments
 (0)