diff --git a/Cargo.lock b/Cargo.lock index 05c958c1..8ed2a6ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1235,29 +1235,6 @@ dependencies = [ "unindent", ] -[[package]] -name = "pyo3-branchwater" -version = "0.8.3" -dependencies = [ - "anyhow", - "assert_cmd", - "assert_matches", - "csv", - "env_logger", - "log", - "needletail", - "niffler", - "predicates", - "pyo3", - "rayon", - "serde", - "serde_json", - "simple-error", - "sourmash", - "tempfile", - "zip", -] - [[package]] name = "pyo3-build-config" version = "0.20.0" @@ -1657,6 +1634,29 @@ dependencies = [ "web-sys", ] +[[package]] +name = "sourmash_plugin_branchwater" +version = "0.8.3" +dependencies = [ + "anyhow", + "assert_cmd", + "assert_matches", + "csv", + "env_logger", + "log", + "needletail", + "niffler", + "predicates", + "pyo3", + "rayon", + "serde", + "serde_json", + "simple-error", + "sourmash", + "tempfile", + "zip", +] + [[package]] name = "spin" version = "0.9.8" diff --git a/Cargo.toml b/Cargo.toml index f25312d8..7cdef482 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] -name = "pyo3_branchwater" # CTB: should we change this, too? +name = "sourmash_plugin_branchwater" crate-type = ["cdylib"] [dependencies] diff --git a/Makefile b/Makefile index ba51f76c..10aefb90 100644 --- a/Makefile +++ b/Makefile @@ -16,8 +16,8 @@ wheel: $(PYTHON) -m maturin build -r sdist: - rm -f target/wheels/pyo3_branchwater-*.tar.gz + rm -f target/wheels/sourmash_plugin_branchwater-*.tar.gz $(PYTHON) -m maturin sdist upload_sdist: sdist - twine upload target/wheels/pyo3_branchwater-*.tar.gz + twine upload target/wheels/sourmash_plugin_branchwater-*.tar.gz diff --git a/README.md b/README.md index edebb161..3fdc4ddf 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ This quickstart demonstrates `multisearch` using You'll need rust, Python, and maturin to build, and sourmash to run. See [environment.yml](environment.yml) for a list of conda packages, and developer docs below for example command lines. -### 2. Install pyo3_branchwater. +### 2. Install sourmash_plugin_branchwater. Install this repo in developer mode: ``` diff --git a/pyproject.toml b/pyproject.toml index 9f11a47f..ebf000a2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,6 +30,13 @@ index = "sourmash_plugin_branchwater:Branchwater_Index" check = "sourmash_plugin_branchwater:Branchwater_Check" manysketch = "sourmash_plugin_branchwater:Branchwater_Manysketch" +[project.optional-dependencies] +test = [ + "pytest>=6.2.4,<7.5.0", + "pytest-cov>=2.12,<5.0", + "pytest-xdist", + "pandas", +] [tool.maturin] python-source = "src/python" diff --git a/src/lib.rs b/src/lib.rs index e7de2643..b0f289cc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,4 @@ -/// Python interface Rust code for pyo3_branchwater. +/// Python interface Rust code for sourmash_plugin_branchwater. use pyo3::prelude::*; #[macro_use] @@ -220,7 +220,7 @@ fn do_manysketch(filelist: String, param_str: String, output: String) -> anyhow: } #[pymodule] -fn pyo3_branchwater(_py: Python, m: &PyModule) -> PyResult<()> { +fn sourmash_plugin_branchwater(_py: Python, m: &PyModule) -> PyResult<()> { m.add_function(wrap_pyfunction!(do_manysearch, m)?)?; m.add_function(wrap_pyfunction!(do_fastgather, m)?)?; m.add_function(wrap_pyfunction!(do_fastmultigather, m)?)?; diff --git a/src/python/sourmash_plugin_branchwater/__init__.py b/src/python/sourmash_plugin_branchwater/__init__.py index 5163e4ef..ce035723 100755 --- a/src/python/sourmash_plugin_branchwater/__init__.py +++ b/src/python/sourmash_plugin_branchwater/__init__.py @@ -8,10 +8,10 @@ from . import pyo3_branchwater -__version__ = importlib.metadata.version("pyo3_branchwater") +__version__ = importlib.metadata.version("sourmash_plugin_branchwater") def print_version(): - notify(f"=> pyo3_branchwater {__version__}; cite Irber et al., doi: 10.1101/2022.11.02.514947\n") + notify(f"=> sourmash_plugin_branchwater {__version__}; cite Irber et al., doi: 10.1101/2022.11.02.514947\n") def get_max_cores(): @@ -32,7 +32,7 @@ def set_thread_pool(user_cores): num_threads = min(avail_threads, user_cores) if user_cores else avail_threads if user_cores and user_cores > avail_threads: notify(f"warning: only {avail_threads} threads available, using {avail_threads}") - actual_rayon_cores = pyo3_branchwater.set_global_thread_pool(num_threads) + actual_rayon_cores = sourmash_plugin_branchwater.set_global_thread_pool(num_threads) return actual_rayon_cores @@ -68,13 +68,13 @@ def main(self, args): notify(f"searching all sketches in '{args.query_paths}' against '{args.against_paths}' using {num_threads} threads") super().main(args) - status = pyo3_branchwater.do_manysearch(args.query_paths, - args.against_paths, - args.threshold, - args.ksize, - args.scaled, - args.moltype, - args.output) + status = sourmash_plugin_branchwater.do_manysearch(args.query_paths, + args.against_paths, + args.threshold, + args.ksize, + args.scaled, + args.moltype, + args.output) if status == 0: notify(f"...manysearch is done! results in '{args.output}'") return status @@ -115,14 +115,14 @@ def main(self, args): notify(f"gathering all sketches in '{args.query_sig}' against '{args.against_paths}' using {num_threads} threads") super().main(args) - status = pyo3_branchwater.do_fastgather(args.query_sig, - args.against_paths, - int(args.threshold_bp), - args.ksize, - args.scaled, - args.moltype, - args.output_gather, - args.output_prefetch) + status = sourmash_plugin_branchwater.do_fastgather(args.query_sig, + args.against_paths, + int(args.threshold_bp), + args.ksize, + args.scaled, + args.moltype, + args.output_gather, + args.output_prefetch) if status == 0: notify(f"...fastgather is done! gather results in '{args.output_gather}'") if args.output_prefetch: @@ -161,13 +161,13 @@ def main(self, args): notify(f"gathering all sketches in '{args.query_paths}' against '{args.against_paths}' using {num_threads} threads") super().main(args) - status = pyo3_branchwater.do_fastmultigather(args.query_paths, - args.against_paths, - int(args.threshold_bp), - args.ksize, - args.scaled, - args.moltype, - args.output) + status = sourmash_plugin_branchwater.do_fastmultigather(args.query_paths, + args.against_paths, + int(args.threshold_bp), + args.ksize, + args.scaled, + args.moltype, + args.output) if status == 0: notify(f"...fastmultigather is done!") return status @@ -203,13 +203,13 @@ def main(self, args): notify(f"indexing all sketches in '{args.siglist}'") super().main(args) - status = pyo3_branchwater.do_index(args.siglist, - args.ksize, - args.scaled, - args.moltype, - args.output, - args.save_paths, - False) # colors - currently must be false? + status = sourmash_plugin_branchwater.do_index(args.siglist, + args.ksize, + args.scaled, + args.moltype, + args.output, + args.save_paths, + False) # colors - currently must be false? if status == 0: notify(f"...index is done! results in '{args.output}'") return status @@ -227,7 +227,7 @@ def __init__(self, p): def main(self, args): notify(f"checking index '{args.index}'") super().main(args) - status = pyo3_branchwater.do_check(args.index, args.quick) + status = sourmash_plugin_branchwater.do_check(args.index, args.quick) if status == 0: notify(f"...index is ok!") return status @@ -266,13 +266,13 @@ def main(self, args): notify(f"searching all sketches in '{args.query_paths}' against '{args.against_paths}' using {num_threads} threads") super().main(args) - status = pyo3_branchwater.do_multisearch(args.query_paths, - args.against_paths, - args.threshold, - args.ksize, - args.scaled, - args.moltype, - args.output) + status = sourmash_plugin_branchwater.do_multisearch(args.query_paths, + args.against_paths, + args.threshold, + args.ksize, + args.scaled, + args.moltype, + args.output) if status == 0: notify(f"...multisearch is done! results in '{args.output}'") return status @@ -309,9 +309,9 @@ def main(self, args): notify(f"sketching all files in '{args.fromfile_csv}' using {num_threads} threads") super().main(args) - status = pyo3_branchwater.do_manysketch(args.fromfile_csv, - args.param_string, - args.output) + status = sourmash_plugin_branchwater.do_manysketch(args.fromfile_csv, + args.param_string, + args.output) if status == 0: notify(f"...manysketch is done! results in '{args.output}'") return status diff --git a/src/utils.rs b/src/utils.rs index 630868f6..0b278e0f 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,4 +1,4 @@ -/// Utility functions for pyo3_branchwater. +/// Utility functions for sourmash_plugin_branchwater. use rayon::prelude::*; use sourmash::encodings::HashFunctions;