Skip to content

Commit

Permalink
Prepare new core release (and upload to NPM) (#1643)
Browse files Browse the repository at this point in the history
* Bump rust version
* Wasm implementation is now more similar to how FFI is implemented
* wasm-pack 0.10.0 does not needed the patch for adding sourmash_bg.js
  • Loading branch information
luizirber authored Jul 8, 2021
1 parent 2542e6c commit 512d961
Show file tree
Hide file tree
Showing 9 changed files with 237 additions and 50 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ jobs:
toolchain: stable
target: wasm32-unknown-unknown

- uses: actions-rs/install@v0.1
- uses: actions-rs/cargo@v1
with:
crate: wasm-pack
version: latest
command: install
args: --force wasm-pack --version 0.10.0

- name: Prepare node for running tests
uses: actions/setup-node@v1
Expand All @@ -197,6 +197,14 @@ jobs:
- name: run wasm-pack build
run: wasm-pack build src/core -d ../../pkg

- name: Prepare package for NPM publishing
working-directory: pkg
run: npm pack

- uses: actions/upload-artifact@v2
with:
path: 'pkg/sourmash*.tgz'

wasm32-wasi:
name: Run tests under wasm32-wasi
runs-on: ubuntu-latest
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/rust_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: install
args: --force wasm-pack --version 0.8.1
args: --force wasm-pack --version 0.10.0
- name: run wasm-pack
run: wasm-pack build src/core -d ../../pkg
run: |
wasm-pack build src/core -d ../../pkg
- name: Prepare node for NPM publishing
uses: actions/setup-node@v1
Expand All @@ -29,7 +30,8 @@ jobs:
registry-url: https://registry.npmjs.org/

- name: Publish to NPM
run: '(cd pkg && npm publish)'
working-directory: pkg
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Expand Down
160 changes: 160 additions & 0 deletions src/core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.11.0] - 2021-07-07

Added:

- Add HyperLogLog implementation (#1223)

Changed:

- Update `MinHash.set_abundances` to remove hash if 0 abund; handle negative abundances. (#1575)
- Improving `MinHash.remove_many(...)` performance (#1571)
- Improved intersection and union calculations (#1475)
- Bump MSRV to 1.42 (and other dep fixes) (#1461)
- Rework the `find` functionality for `Index` classes (#1392)
- Rationalize `SourmashSignature.name` and `str(sig)` (#1179)

Fixed:

- Fix needless borrows as suggested by clippy (#1636)
- Fix Rust 1.59 lints (#1600)
- Clean up clippy lints from 1.52 (#1505)
- Fix clippy lints introduced in 1.51 (#1407)
- CI/Rust: update and fix cbindgen config (#1473)
- pin needletail version to keep MSRV at 1.37 (#1393)
- Update proptest requirement from 0.9.6 to 1.0.0 (#1344)
- Fix clippy lints introduced in 1.50 and update nix configs (#1332)
- Update finch requirement from 0.3.0 to 0.4.1 (#1290)
- update rand for test, and activate "js" feature for getrandom (#1275)
- Fix new clippy warnings from Rust 1.49 (#1267)
- CI: small build fixes (#1252)

Removed:

- Remove 10x support in compute (#1229)

## [0.10.0] - 2020-10-08

Added:

- Add `clear` option to set_abundances(...) method (#1046)

Changed:

- Replace mx by scaled (#1139)

Fixed:

- Fix Rust panic error in signature creation (#1172)
- Update typed-builder requirement from 0.6.0 to 0.7.0 (#1121)
- update CI for latest branch name change (#1150)
- Update typed-builder requirement from 0.6.0 to 0.7.0 (#1121)

## [0.9.0] - 2020-07-13

Added:

- Cache md5sum calculation (#1058)
- Expose more of the API for wasm (signature and ComputeParameters) (#1058)
- Getters and setters for ComputeParameters (#1058)

Changed:

- Migrate from failure to thiserror (#1058)
- Bump MSRV to 1.37 (#1058)

Fixed:

- Use the derive feature in serde instead of serde_derive (#1058)
- Use nohash-hasher crate instead of previous NoHashHasher from finch.
- Update typed-builder to 0.6.0 (#1058)
- stricter niffler versions and add new gz feature to it (#1070)

## [0.8.0] - 2020-06-26

Added:

- compute-optimized MinHash (for small scaled or large cardinalities) (#1045)

## [0.7.0] - 2020-05-12

Changed:

- Hide internal representation in core (#986)

Fixed:

- update FFI and cbindgen (#986)

## [0.6.0] - 2020-04-28

Added:

- Nodegraph implementation based on khmer.Nodegraph (#799)

## [0.5.0] - 2020-02-08

Added:

- add_hash_with_abundance method in core library (#892)

Changed:

- More refactoring of MinHash comparison code (#882)
- Replace mins_push and abunds_push with set_abundances (#887)

Fixed:

- add_hash with num doesn't set abundances properly (#891)

## [0.4.0] - 2020-01-26

Added:

- Compute improvements: Parameter sets for defining signatures, add_protein implemented (#845)
- add_many for faster insertion of multiple hashes (#826)

Changed:

- Compare/similarity now have a downsample argument (#856)

Fixed:

- Improve sketching performance with lookup tables for complement and DNA validation (#861) (#865)
- Use tarpaulin instead of grcov (#862)
- set up publishing workflow for NPM and crates.io (#824)

## [0.3.0] - 2020-01-05

Added:

- Similarity with abundance method for MinHash (#808)
- Experimental support for indices in Rust (#773)
- Experimental SBT with MQF internal nodes in Rust (#772)

Changed:

- Make the sourmash crate library-only (#812)

Fixed:

- Use once_cell instead of lazy_static and lazy-init (#815)
- Fix mem leak in get_mins (#807)
- Fixes for WASI and WASM compilation (#771) (#723)

[unreleased]: https://github.com/sourmash-bio/sourmash/compare/r0.11.0...HEAD
[0.11.0]: https://github.com/sourmash-bio/sourmash/compare/r0.10.0...r0.11.0
[0.10.0]: https://github.com/sourmash-bio/sourmash/compare/r0.9.0...r0.10.0
[0.9.0]: https://github.com/sourmash-bio/sourmash/compare/r0.9.0...r0.10.0
[0.8.0]: https://github.com/sourmash-bio/sourmash/compare/r0.8.0...r0.9.0
[0.7.0]: https://github.com/sourmash-bio/sourmash/compare/r0.7.0...r0.8.0
[0.6.0]: https://github.com/sourmash-bio/sourmash/compare/r0.6.0...r0.7.0
[0.5.0]: https://github.com/sourmash-bio/sourmash/compare/r0.5.0...r0.6.0
[0.4.0]: https://github.com/sourmash-bio/sourmash/compare/r0.4.0...r0.5.0
[0.3.0]: https://github.com/sourmash-bio/sourmash/compare/r0.3.0...r0.4.0
31 changes: 17 additions & 14 deletions src/core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sourmash"
version = "0.10.0"
version = "0.11.0"
authors = ["Luiz Irber <luiz.irber@gmail.com>"]
description = "MinHash sketches for genomic data"
repository = "https://github.com/dib-lab/sourmash"
Expand Down Expand Up @@ -44,19 +44,6 @@ primal-check = "0.3.1"
thiserror = "1.0"
typed-builder = "0.9.0"

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

[target.'cfg(all(target_arch = "wasm32", target_vendor="unknown"))'.dev-dependencies]
wasm-bindgen-test = "0.3.0"

[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies.assert_cmd]
version = "1.0.1"

[package.metadata.wasm-pack.profile.release]
wasm-opt = false # https://github.com/rustwasm/wasm-pack/issues/886

[dev-dependencies]
assert_matches = "1.3.0"
criterion = "0.3.2"
Expand All @@ -82,3 +69,19 @@ harness = false
[[bench]]
name = "minhash"
harness = false

## Wasm section. Crates only used for WASM, as well as specific configurations

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

[target.'cfg(all(target_arch = "wasm32", target_vendor="unknown"))'.dependencies.web-sys]
version = "0.3.51"
features = ["console", "File"]

[target.'cfg(all(target_arch = "wasm32", target_vendor="unknown"))'.dev-dependencies]
wasm-bindgen-test = "0.3.0"

[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies.assert_cmd]
version = "1.0.1"
4 changes: 0 additions & 4 deletions src/core/src/cmd.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#[cfg(all(target_arch = "wasm32", target_vendor = "unknown"))]
use wasm_bindgen::prelude::*;

use getset::{CopyGetters, Getters, Setters};
use typed_builder::TypedBuilder;

Expand Down Expand Up @@ -36,7 +33,6 @@ impl Signature {
}

#[allow(dead_code)]
#[cfg_attr(all(target_arch = "wasm32", target_vendor = "unknown"), wasm_bindgen)]
#[derive(TypedBuilder, CopyGetters, Getters, Setters)]
pub struct ComputeParameters {
#[getset(get = "pub", set = "pub")]
Expand Down
3 changes: 0 additions & 3 deletions src/core/src/encodings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ use std::iter::Iterator;
use std::str;

use once_cell::sync::Lazy;
#[cfg(all(target_arch = "wasm32", target_vendor = "unknown"))]
use wasm_bindgen::prelude::*;

use crate::Error;

#[cfg_attr(all(target_arch = "wasm32", target_vendor = "unknown"), wasm_bindgen)]
#[allow(non_camel_case_types)]
#[derive(Debug, Clone, Copy, PartialEq)]
#[repr(u32)]
Expand Down
4 changes: 0 additions & 4 deletions src/core/src/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ use rayon::prelude::*;
use serde::{Deserialize, Serialize};
use typed_builder::TypedBuilder;

#[cfg(all(target_arch = "wasm32", target_vendor = "unknown"))]
use wasm_bindgen::prelude::*;

use crate::encodings::{aa_to_dayhoff, aa_to_hp, revcomp, to_aa, HashFunctions, VALID};
use crate::index::storage::ToWriter;
use crate::sketch::Sketch;
Expand Down Expand Up @@ -242,7 +239,6 @@ impl SigsTrait for Sketch {
}
}

#[cfg_attr(all(target_arch = "wasm32", target_vendor = "unknown"), wasm_bindgen)]
#[derive(Serialize, Deserialize, Debug, Clone, TypedBuilder)]
pub struct Signature {
#[serde(default = "default_class")]
Expand Down
5 changes: 0 additions & 5 deletions src/core/src/sketch/minhash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ use crate::signature::SigsTrait;
use crate::sketch::hyperloglog::HyperLogLog;
use crate::Error;

#[cfg(all(target_arch = "wasm32", target_vendor = "unknown"))]
use wasm_bindgen::prelude::*;

pub fn max_hash_for_scaled(scaled: u64) -> u64 {
match scaled {
0 => 0,
Expand All @@ -35,7 +32,6 @@ pub fn scaled_for_max_hash(max_hash: u64) -> u64 {
}
}

#[cfg_attr(all(target_arch = "wasm32", target_vendor = "unknown"), wasm_bindgen)]
#[derive(Debug, TypedBuilder)]
pub struct KmerMinHash {
num: u32,
Expand Down Expand Up @@ -939,7 +935,6 @@ mod test {
//#############
// A MinHash implementation for low scaled or large cardinalities

#[cfg_attr(all(target_arch = "wasm32", target_vendor = "unknown"), wasm_bindgen)]
#[derive(Debug, TypedBuilder)]
pub struct KmerMinHashBTree {
num: u32,
Expand Down
Loading

0 comments on commit 512d961

Please sign in to comment.