Skip to content

Commit

Permalink
rename pyo3_branchwater to sourmash_plugin_branchwater
Browse files Browse the repository at this point in the history
  • Loading branch information
ctb committed Nov 29, 2023
1 parent cca04be commit 031e799
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 73 deletions.
46 changes: 23 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
```
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// Python interface Rust code for pyo3_branchwater.
/// Python interface Rust code for sourmash_plugin_branchwater.
use pyo3::prelude::*;

#[macro_use]
Expand Down Expand Up @@ -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)?)?;
Expand Down
86 changes: 43 additions & 43 deletions src/python/sourmash_plugin_branchwater/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// Utility functions for pyo3_branchwater.
/// Utility functions for sourmash_plugin_branchwater.
use rayon::prelude::*;
use sourmash::encodings::HashFunctions;

Expand Down

0 comments on commit 031e799

Please sign in to comment.