Skip to content

Commit

Permalink
Migrate xz2 to liblzma (#78)
Browse files Browse the repository at this point in the history
* Honor individual compression features

* Migrate xz2 dep to liblzma

* Migrated xz2 to liblzma

* Update deps, update PyO3 to use new &Bound syntax

* Update flate2
  • Loading branch information
jguhlin authored May 8, 2024
1 parent 08101cb commit 410617a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ default = ["compression"]
compression = ["bzip2", "flate2", "xz2"]
python = ["pyo3/extension-module"]
python_test = ["pyo3"]
xz2 = ["liblzma"]

[dependencies]
buffer-redux = { version = "1", default_features = false }
bytecount = { version = "0.6", features = ["runtime-dispatch-simd"] }
bzip2 = { version = "0.4", optional = true }
flate2 = { version = "1.0.6", optional = true }
memchr = "2.2.1"
pyo3 = { version = "0.18", optional = true }
xz2 = { version = "0.1.6", optional = true }
flate2 = { version = "1.0.30", optional = true }
memchr = "2.7.2"
pyo3 = { version = "0.21.2", optional = true }
liblzma = { version = "0.3.1", optional = true }

[dev-dependencies]
criterion = "0.5"
Expand Down
2 changes: 1 addition & 1 deletion src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use bzip2::read::BzDecoder;
#[cfg(feature = "flate2")]
use flate2::read::MultiGzDecoder;
#[cfg(feature = "xz2")]
use xz2::read::XzDecoder;
use liblzma::read::XzDecoder;

use crate::errors::ParseError;
pub use crate::parser::fasta::Reader as FastaReader;
Expand Down
4 changes: 2 additions & 2 deletions src/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,13 @@ pub fn reverse_complement(seq: &str) -> String {
}

#[pymodule]
fn needletail(py: Python, m: &PyModule) -> PyResult<()> {
fn needletail(py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add_class::<PyFastxReader>()?;
m.add_wrapped(wrap_pyfunction!(parse_fastx_file))?;
m.add_wrapped(wrap_pyfunction!(parse_fastx_string))?;
m.add_wrapped(wrap_pyfunction!(normalize_seq))?;
m.add_wrapped(wrap_pyfunction!(reverse_complement))?;
m.add("NeedletailError", py.get_type::<NeedletailError>())?;
m.add("NeedletailError", py.get_type_bound::<NeedletailError>())?;

Ok(())
}

0 comments on commit 410617a

Please sign in to comment.