Skip to content

Commit

Permalink
Make the sourmash crate library-only (#812)
Browse files Browse the repository at this point in the history
* fix test data paths
* split draff and smrs out of sourmash
* depend only on primal_check
* move sourmash crate into src/core
* add README for rust crate
* update main README
  • Loading branch information
luizirber committed Jan 5, 2020
1 parent 6bcf1ee commit 9c778e0
Show file tree
Hide file tree
Showing 44 changed files with 233 additions and 1,998 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/rust.yml
Expand Up @@ -180,7 +180,7 @@ jobs:
args: -- -D warnings

wasm-pack:
name: Check if wasm-pack builds a valid package
name: Check if wasm-pack builds a valid package for the sourmash crate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
Expand All @@ -193,7 +193,7 @@ jobs:
command: install
args: --force wasm-pack
- name: run wasm-pack
run: wasm-pack build
run: wasm-pack build src/core -d ../../pkg

wasm32-wasi:
name: Run tests under wasm32-wasi
Expand Down Expand Up @@ -240,11 +240,11 @@ jobs:
toolchain: stable
override: true

- name: Make sure we can publish the crate
- name: Make sure we can publish the sourmash crate
uses: actions-rs/cargo@v1
with:
command: publish
args: --dry-run
args: --dry-run --manifest-path src/core/Cargo.toml

minimum_rust_version:
runs-on: ubuntu-latest
Expand Down
89 changes: 4 additions & 85 deletions Cargo.toml
@@ -1,86 +1,5 @@
[package]
name = "sourmash"
version = "0.3.0"
authors = ["Luiz Irber <luiz.irber@gmail.com>"]
description = "MinHash sketches for genomic data"
repository = "https://github.com/luizirber/sourmash-rust"
keywords = ["minhash", "bioinformatics"]
categories = ["science", "algorithms", "data-structures"]
license = "BSD-3-Clause"
edition = "2018"
autoexamples = false
autobins = false

[lib]
name = "sourmash"
crate-type = ["cdylib", "rlib"]
bench = false

[profile.release]
lto=true

[features]
from-finch = ["finch"]

[workspace]

#[build-dependencies]
#cbindgen = "~0.6.7"

[dependencies]
byteorder = "1.3.2"
cfg-if = "0.1.10"
clap = { version = "2.33.0", features = ["yaml"] }
env_logger = "0.7.1"
exitfailure = "0.5.1"
failure = "0.1.6"
failure_derive = "0.1.6"
finch = { version = "0.3.0", optional = true }
fixedbitset = "0.2.0"
log = "0.4.8"
md5 = "0.7.0"
murmurhash3 = "0.0.5"
once_cell = "1.2.0"
serde = "1.0.103"
serde_derive = "1.0.103"
serde_json = "1.0.44"
#ukhs = { git = "https://github.com/luizirber/ukhs", branch = "feature/alternative_backends", features = ["boomphf_mphf"], default-features = false}
primal = "0.2.3"
#pdatastructs = { git = "https://github.com/luizirber/pdatastructs.rs", branch = "succinct_wasm" }
itertools = "0.8.2"
typed-builder = "0.4.0"
csv = "1.1.1"
tempfile = "3.1.0"

[dependencies.needletail]
version = "0.3.2"
default-features = false
#features = ["compression"]

[target.'cfg(all(target_arch = "wasm32", target_vendor="unknown"))'.dependencies.wasm-bindgen]
version = "0.2.55"
features = ["serde-serialize"]

[target.'cfg(not(all(target_arch = "wasm32", target_vendor="unknown")))'.dependencies.niffler]
version = "1.0"
default-features = false

[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
proptest = "0.9.4"

[dev-dependencies]
criterion = "0.3.0"
rand = "0.7.2"
tempfile = "3.1.0"
assert_matches = "1.3.0"
assert_cmd = "0.12.0"
predicates = "1.0.2"

[[bench]]
name = "index"
harness = false

[[bin]]
name = "smrs"
path = "src/bin/smrs.rs"
bench = false
members = [
"src/core",
]
default-members = ["src/core"]
11 changes: 8 additions & 3 deletions Makefile
Expand Up @@ -27,9 +27,14 @@ test: all
doc: .PHONY
cd doc && make html

include/sourmash.h: src/lib.rs src/ffi/minhash.rs src/ffi/signature.rs src/ffi/nodegraph.rs src/errors.rs
include/sourmash.h: src/core/src/lib.rs \
src/core/src/ffi/minhash.rs \
src/core/src/ffi/signature.rs \
src/core/src/ffi/nodegraph.rs \
src/core/src/errors.rs
rustup override set nightly
RUST_BACKTRACE=1 cbindgen --clean -c cbindgen.toml -o $@
cd src/core && \
RUST_BACKTRACE=1 cbindgen -c cbindgen.toml -o ../../$@
rustup override set stable

coverage: all
Expand All @@ -49,7 +54,7 @@ last-tag:
git fetch -p -q; git tag -l | sort -V | tail -1

wasm:
wasm-pack build
wasm-pack build src/core -d ../../pkg

wasi:
cargo wasi build
Expand Down
13 changes: 6 additions & 7 deletions README.md
Expand Up @@ -9,10 +9,6 @@
[![DOI](http://joss.theoj.org/papers/10.21105/joss.00027/status.svg)](http://joss.theoj.org/papers/10.21105/joss.00027)
<a href="https://github.com/dib-lab/sourmash/blob/master/LICENSE"><img alt="License: 3-Clause BSD" src="https://img.shields.io/badge/License-BSD%203--Clause-blue.svg"></a>

🦀
[![](http://meritbadge.herokuapp.com/sourmash)](https://crates.io/crates/sourmash)
[![Rust API Documentation on docs.rs](https://docs.rs/sourmash/badge.svg)](https://docs.rs/sourmash)

---

Compute MinHash signatures for nucleotide (DNA/RNA) and protein sequences.
Expand Down Expand Up @@ -45,7 +41,7 @@ We recommend using bioconda to install sourmash:
```
conda install -c conda-forge -c bioconda sourmash
```
This will install the latest stable version of sourmash 2.
This will install the latest stable version of sourmash 3.

You can also use pip to install sourmash:

Expand Down Expand Up @@ -95,7 +91,10 @@ After installation, `sourmash` is the main command-line entry point;
run it with `python -m sourmash`, or do `pip install -e /path/to/repo` to
do a developer install in a virtual environment.

The `sourmash/` directory contains the library code.
The `sourmash/` directory contains the Python library and command-line interface code.

The `src/core/` directory contains the Rust library implementing core
functionality.

Tests require py.test and can be run with `make test`.

Expand All @@ -104,4 +103,4 @@ Please see [the developer notes](doc/developer.md) for more information.
----

CTB
Dec 2018
Jan 2020
60 changes: 0 additions & 60 deletions src/bin/draff.rs

This file was deleted.

66 changes: 0 additions & 66 deletions src/bin/draff.yml

This file was deleted.

0 comments on commit 9c778e0

Please sign in to comment.