-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose rust merge and add intersection Update cbindgen, uncomment more code Scaffolding for error catching Add rust bindings as a submodule exception handling working Implement abundances Use __eq__ instead of __richcmp__ max hash should be an int Avoid init_once too many times, remove third-party
- Loading branch information
Showing
19 changed files
with
248 additions
and
1,021 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,6 @@ _minhash.so | |
.cache | ||
*.so | ||
.coverage | ||
sourmash_lib/_minhash.cpp | ||
.tox | ||
.eggs | ||
rust/target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "rust"] | ||
path = rust | ||
url = https://github.com/luizirber/sourmash-rust |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
include LICENSE Makefile Dockerfile LICENSE Makefile README.md requirements.txt | ||
include index.ipynb | ||
recursive-include sourmash_lib * | ||
recursive-include third-party *.cc *.h | ||
recursive-include rust *.rs *.toml *.h | ||
prune rust/target/debug | ||
prune rust/target/release | ||
exclude rust/.git | ||
prune .eggs | ||
global-exclude *.rlib | ||
global-exclude *.orig | ||
global-exclude *.pyc | ||
global-exclude *.so | ||
global-exclude *.git/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
from __future__ import print_function | ||
import sys | ||
from setuptools import setup | ||
from setuptools import Extension | ||
import os | ||
|
||
|
||
def build_native(spec): | ||
build = spec.add_external_build( | ||
cmd=['cargo', 'build', '--release'], | ||
path='./rust' | ||
) | ||
|
||
spec.add_cffi_module( | ||
module_path='sourmash_lib._lowlevel', | ||
dylib=lambda: build.find_dylib('sourmash', in_path='target/release'), | ||
header_filename=lambda: build.find_header('sourmash.h', in_path='target') | ||
) | ||
|
||
# retrieve VERSION from sourmash_lib/VERSION. | ||
thisdir = os.path.dirname(__file__) | ||
version_file = open(os.path.join(thisdir, 'sourmash_lib', 'VERSION')) | ||
VERSION = version_file.read().strip() | ||
|
||
EXTRA_COMPILE_ARGS = ['-std=c++11', '-pedantic'] | ||
EXTRA_LINK_ARGS=[] | ||
|
||
CLASSIFIERS = [ | ||
"Environment :: Console", | ||
"Environment :: MacOS X", | ||
|
@@ -29,19 +37,6 @@ | |
|
||
CLASSIFIERS.append("Development Status :: 5 - Production/Stable") | ||
|
||
if sys.platform == 'darwin': # Mac OS X? | ||
# force 64bit only builds | ||
EXTRA_COMPILE_ARGS.extend(['-arch', 'x86_64', '-mmacosx-version-min=10.7', | ||
'-stdlib=libc++']) | ||
|
||
else: # ...likely Linux | ||
if os.environ.get('SOURMASH_COVERAGE'): | ||
print('Turning on coverage analysis.') | ||
EXTRA_COMPILE_ARGS.extend(['-g', '--coverage', '-lgcov']) | ||
EXTRA_LINK_ARGS.extend(['--coverage', '-lgcov']) | ||
else: | ||
EXTRA_COMPILE_ARGS.append('-O3') | ||
|
||
SETUP_METADATA = \ | ||
{ | ||
"name": "sourmash", | ||
|
@@ -52,30 +47,21 @@ | |
"author_email": "[email protected]", | ||
"license": "BSD 3-clause", | ||
"packages": ["sourmash_lib"], | ||
"zip_safe": False, | ||
"platforms": 'any', | ||
"entry_points": {'console_scripts': [ | ||
'sourmash = sourmash_lib.__main__:main' | ||
] | ||
}, | ||
"ext_modules": [Extension("sourmash_lib._minhash", | ||
sources=["sourmash_lib/_minhash.pyx", | ||
"third-party/smhasher/MurmurHash3.cc"], | ||
depends=["sourmash_lib/kmer_min_hash.hh"], | ||
include_dirs=["./sourmash_lib", | ||
"./third-party/smhasher/"], | ||
language="c++", | ||
extra_compile_args=EXTRA_COMPILE_ARGS, | ||
extra_link_args=EXTRA_LINK_ARGS)], | ||
"install_requires": ["screed>=0.9", "ijson", "khmer>=2.1<3.0"], | ||
"setup_requires": ['Cython>=0.25.2', "setuptools>=18.0"], | ||
"setup_requires": ["setuptools>=18.0", 'milksnake', 'cffi'], | ||
"extras_require": { | ||
'test' : ['pytest', 'pytest-cov', 'numpy', 'matplotlib', 'scipy'], | ||
'demo' : ['jupyter', 'jupyter_client', 'ipython'], | ||
'doc' : ['sphinx'], | ||
}, | ||
"include_package_data": True, | ||
"package_data": { | ||
"sourmash_lib": ['*.pxd'] | ||
}, | ||
'milksnake_tasks': [build_native], | ||
"classifiers": CLASSIFIERS | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import sys | ||
|
||
|
||
PY2 = sys.version_info[0] == 2 | ||
|
||
if PY2: | ||
text_type = unicode | ||
int_types = (int, long) | ||
string_types = (str, unicode) | ||
range_type = xrange | ||
itervalues = lambda x: x.itervalues() | ||
NUL = '\x00' | ||
def implements_to_string(cls): | ||
cls.__unicode__ = cls.__str__ | ||
cls.__str__ = lambda x: x.__unicode__().encode('utf-8') | ||
return cls | ||
else: | ||
text_type = str | ||
int_types = (int,) | ||
string_types = (str,) | ||
range_type = range | ||
itervalues = lambda x: x.values() | ||
NUL = 0 | ||
implements_to_string = lambda x: x |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.