diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 643b1b3..6f2768c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: - python: [3.7] + python: [3.12] name: Python ${{ matrix.python }} @@ -29,9 +29,6 @@ jobs: - name: Install coverage dependencies run: pip install pytest-cov - - name: Build - run: python setup.py build_ext --inplace - - name: Install pybbhash run: pip install -e . diff --git a/Makefile b/Makefile index d886b86..a2d2348 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ +.PHONY: dist wheel test + all: - python setup.py build_ext -i + pip install -e . clean: rm -fr bbhash.cpp bbhash.cpython-36m-darwin.so build/ bbhash.egg-info @@ -7,7 +9,13 @@ clean: test: all py.test -upload: - rm -fr dist - python setup.py sdist +upload: dist twine upload dist/bbhash-*.tar.gz + +dist: + rm -fr dist + python -m build -s + +wheel: + rm -fr dist + python -m build diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..1fb23e4 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,33 @@ +[build-system] +requires = [ + "setuptools", "cython" +] + +[project] +name = "bbhash" +version = "0.6.0" +readme = "README.md" +description = "A Python wrapper for the BBHash Minimal Perfect Hash Function" +license = "BSD-3-Clause" + +authors = [ + { name="C. Titus Brown" }, +] + +dependencies = [ + "numpy", +] + +requires-python = ">=3.11" + +[metadata] +license = { text = "BSD 3-Clause License" } + +[project.urls] +"Source" = "http://github.com/dib-lab/pybbhash" + +[tool.setuptools] +ext-modules = [ + { name = "bbhash", sources = ["src/bbhash.pyx"], language="c++", depends=["src/BooPHF.h"] }, + { name = "bbhash_table", sources = ["src/bbhash_table.pyx"], language="c++" } +] diff --git a/setup.py b/setup.py deleted file mode 100644 index d508619..0000000 --- a/setup.py +++ /dev/null @@ -1,41 +0,0 @@ -import sys -from setuptools import setup, Extension -from Cython.Distutils import build_ext - -# read the contents of your README file -from os import path -this_directory = path.abspath(path.dirname(__file__)) -with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f: - long_description = f.read() - -EXTRA_COMPILE_ARGS=['-std=c++11'] -if sys.platform == 'darwin': # Mac OS X? - EXTRA_COMPILE_ARGS.extend(['-arch', 'x86_64', '-mmacosx-version-min=10.7', - '-stdlib=libc++']) - - -setup( - name='bbhash', - version='0.5.4', - description="A Python wrapper for the BBHash Minimal Perfect Hash Function", - author="C. Titus Brown", - author_email="titus@idyll.org", - license="BSD 3-clause", - url="http://github.com/dib-lab/pybbhash", - setup_requires=["Cython>=0.29.21", "setuptools>=49", "numpy"], - install_requires=["numpy"], - ext_modules = - [Extension('bbhash', - sources=['bbhash.pyx'], - depends=['BooPHF.h'], - language='c++', - extra_compile_args=EXTRA_COMPILE_ARGS), - Extension('bbhash_table', - sources=['bbhash_table.pyx'], - language='c++', - extra_compile_args=EXTRA_COMPILE_ARGS)], - headers=['BooPHF.h'], - cmdclass = {'build_ext': build_ext}, - long_description=long_description, - long_description_content_type="text/markdown", -) diff --git a/BooPHF.h b/src/BooPHF.h similarity index 100% rename from BooPHF.h rename to src/BooPHF.h diff --git a/bbhash.pyx b/src/bbhash.pyx similarity index 100% rename from bbhash.pyx rename to src/bbhash.pyx diff --git a/bbhash_table.pyx b/src/bbhash_table.pyx similarity index 99% rename from bbhash_table.pyx rename to src/bbhash_table.pyx index 7ae4111..4e5b323 100644 --- a/bbhash_table.pyx +++ b/src/bbhash_table.pyx @@ -7,6 +7,9 @@ import bbhash import os from collections import defaultdict +# huh, ok. +STUFF="Hi" + class BBHashTable(object): """\ Retrieve values by MPHF lookup. diff --git a/test_bbhash.py b/tests/test_bbhash.py similarity index 100% rename from test_bbhash.py rename to tests/test_bbhash.py diff --git a/test_table.py b/tests/test_table.py similarity index 100% rename from test_table.py rename to tests/test_table.py