From 652bfe20e91bee28c1d26149932d92ff2683f942 Mon Sep 17 00:00:00 2001 From: "C. Titus Brown" Date: Sun, 26 Oct 2025 06:59:28 -0700 Subject: [PATCH 1/3] MRG: fix compile problems on Mac OS X --- bbhash_table.pyx | 3 +++ setup.py | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bbhash_table.pyx b/bbhash_table.pyx index 7ae4111..4e5b323 100644 --- a/bbhash_table.pyx +++ b/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/setup.py b/setup.py index d508619..a8bf769 100644 --- a/setup.py +++ b/setup.py @@ -9,9 +9,6 @@ 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( From 7193eed8486ceca71595c3a316ea02c17a09c79d Mon Sep 17 00:00:00 2001 From: "C. Titus Brown" Date: Sun, 26 Oct 2025 09:50:20 -0700 Subject: [PATCH 2/3] add pyproject.toml --- Makefile | 16 +++++++--- pyproject.toml | 33 ++++++++++++++++++++ setup.py | 38 ------------------------ BooPHF.h => src/BooPHF.h | 0 bbhash.pyx => src/bbhash.pyx | 0 bbhash_table.pyx => src/bbhash_table.pyx | 0 test_bbhash.py => tests/test_bbhash.py | 0 test_table.py => tests/test_table.py | 0 8 files changed, 45 insertions(+), 42 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py rename BooPHF.h => src/BooPHF.h (100%) rename bbhash.pyx => src/bbhash.pyx (100%) rename bbhash_table.pyx => src/bbhash_table.pyx (100%) rename test_bbhash.py => tests/test_bbhash.py (100%) rename test_table.py => tests/test_table.py (100%) 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 a8bf769..0000000 --- a/setup.py +++ /dev/null @@ -1,38 +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'] - - -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 100% rename from bbhash_table.pyx rename to src/bbhash_table.pyx 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 From 476b83b65dff0c7da0da1513bc1183f4c287c19a Mon Sep 17 00:00:00 2001 From: "C. Titus Brown" Date: Sun, 26 Oct 2025 09:53:56 -0700 Subject: [PATCH 3/3] update test workflow --- .github/workflows/test.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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 .