From c5a061f1c5309d6e2ab4d825647770069fc5e0ae Mon Sep 17 00:00:00 2001 From: Hajime Senuma Date: Sun, 22 Sep 2024 20:10:38 +0900 Subject: [PATCH 01/15] Add sdist check to gha (should fail) --- .github/workflows/build.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 444470d..eae6f4e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,10 +36,16 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - pip install --upgrade pip + python -m pip install --upgrade pip + pip install setuptools build pip install . pip install ".[test,type]" - name: Test with pytest run: python -m pytest - - name: Test type hints with mypy - run: mypy --strict tests + - name: Check source distribution + run: | + pip uninstall -y mmh3 + python -m build --sdist + python -m pip install dist/*.tar.gz + python -m pytest + \ No newline at end of file From e59f33f639a38fbab867d9aaa65a423f8b3a4dd8 Mon Sep 17 00:00:00 2001 From: Hajime Senuma Date: Sun, 22 Sep 2024 20:36:44 +0900 Subject: [PATCH 02/15] Include *.h for sdist --- pyproject.toml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index b0da9cf..6c59e98 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -70,6 +70,12 @@ ext-modules = [ {name = "mmh3", sources=["./src/mmh3/mmh3module.c", "./src/mmh3/murmurhash3.c"]} ] +[tool.setuptools.package-data] +mmh3 = [ + "./src/mmh3/murmurhash3.h", + "./src/mmh3/hashlib.h" +] + [tool.isort] profile = "black" src_paths = ["src/mmh3/__init__.pyi", "util", "tests", "benchmark", "docs"] From ca84d08bfdc02ddfe84980d65c57f7e05ea3afb0 Mon Sep 17 00:00:00 2001 From: Hajime Senuma Date: Sun, 22 Sep 2024 20:57:09 +0900 Subject: [PATCH 03/15] Try include-dirs for setuptools config --- .github/workflows/build.yml | 1 - pyproject.toml | 16 +++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eae6f4e..bb59ce1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -48,4 +48,3 @@ jobs: python -m build --sdist python -m pip install dist/*.tar.gz python -m pytest - \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 6c59e98..6051295 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,21 +65,15 @@ Repository = "https://github.com/hajimes/mmh3" Changelog = "https://github.com/hajimes/mmh3/blob/master/CHANGELOG.md" "Bug Tracker" = "https://github.com/hajimes/mmh3/issues" -[tool.setuptools] -ext-modules = [ - {name = "mmh3", sources=["./src/mmh3/mmh3module.c", "./src/mmh3/murmurhash3.c"]} -] - -[tool.setuptools.package-data] -mmh3 = [ - "./src/mmh3/murmurhash3.h", - "./src/mmh3/hashlib.h" -] - [tool.isort] profile = "black" src_paths = ["src/mmh3/__init__.pyi", "util", "tests", "benchmark", "docs"] +[tool.setuptools] +ext-modules = [ + {name = "mmh3", sources = ["./src/mmh3/mmh3module.c", "./src/mmh3/murmurhash3.c"], include-dirs = ["./src/mmh3"]} +] + [tool.pylint] ignore-paths = [ "^build", From c76785b9d62592dcc177910902d4f38383943450 Mon Sep 17 00:00:00 2001 From: Hajime Senuma Date: Sun, 22 Sep 2024 21:12:31 +0900 Subject: [PATCH 04/15] Try include-package-data = true --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 6051295..704a44a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -70,8 +70,9 @@ profile = "black" src_paths = ["src/mmh3/__init__.pyi", "util", "tests", "benchmark", "docs"] [tool.setuptools] +include-package-data = true ext-modules = [ - {name = "mmh3", sources = ["./src/mmh3/mmh3module.c", "./src/mmh3/murmurhash3.c"], include-dirs = ["./src/mmh3"]} + {name = "mmh3", sources = ["./src/mmh3/mmh3module.c", "./src/mmh3/murmurhash3.c"]} ] [tool.pylint] From 293c446cee04fb3e5fb416771c0c18457c403097 Mon Sep 17 00:00:00 2001 From: Hajime Senuma Date: Sun, 22 Sep 2024 21:18:42 +0900 Subject: [PATCH 05/15] Specify file names --- pyproject.toml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 704a44a..9c0c019 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -75,6 +75,12 @@ ext-modules = [ {name = "mmh3", sources = ["./src/mmh3/mmh3module.c", "./src/mmh3/murmurhash3.c"]} ] +[tool.setuptools.packages.find] +where = ["src/mmh3"] + +[tool.setuptools.package-data] +mmh3 = ["murmurhash3.h", "hashlib.h"] + [tool.pylint] ignore-paths = [ "^build", From 575a14d7d42c173cbfc109f6f756174c258391fb Mon Sep 17 00:00:00 2001 From: Hajime Senuma Date: Sun, 22 Sep 2024 21:30:34 +0900 Subject: [PATCH 06/15] Try another form --- pyproject.toml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9c0c019..3dd842a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -75,11 +75,8 @@ ext-modules = [ {name = "mmh3", sources = ["./src/mmh3/mmh3module.c", "./src/mmh3/murmurhash3.c"]} ] -[tool.setuptools.packages.find] -where = ["src/mmh3"] - [tool.setuptools.package-data] -mmh3 = ["murmurhash3.h", "hashlib.h"] +mmh3 = ["*.h"] [tool.pylint] ignore-paths = [ From 9e39aef398e6ca6e831fd39bdf30039145e32b07 Mon Sep 17 00:00:00 2001 From: Hajime Senuma Date: Sun, 22 Sep 2024 22:42:56 +0900 Subject: [PATCH 07/15] Check os platform --- .github/workflows/build.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bb59ce1..40e9e01 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,5 +46,9 @@ jobs: run: | pip uninstall -y mmh3 python -m build --sdist - python -m pip install dist/*.tar.gz + if [[ "${{ matrix.os }}" == "windows-2022" ]]; then + for %i in (dist\*.tar.gz) do python -m pip install %i + else + python -m pip install dist/*.tar.gz + fi python -m pytest From e6d6ad7288a13a020da1f1dd5d52d71d2648beea Mon Sep 17 00:00:00 2001 From: Hajime Senuma Date: Sun, 22 Sep 2024 23:22:28 +0900 Subject: [PATCH 08/15] Revise os detection --- .github/workflows/build.yml | 20 ++++++++++++++------ foo.sh | 5 +++++ 2 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 foo.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 40e9e01..ed3cceb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,13 +42,21 @@ jobs: pip install ".[test,type]" - name: Test with pytest run: python -m pytest - - name: Check source distribution + - name: Test type hints with mypy + run: mypy --strict tests + - name: Test building from the source distribution (Linux/macOS) + if: runner.os != "Windows" run: | pip uninstall -y mmh3 python -m build --sdist - if [[ "${{ matrix.os }}" == "windows-2022" ]]; then - for %i in (dist\*.tar.gz) do python -m pip install %i - else - python -m pip install dist/*.tar.gz - fi + python -m pip install dist/*.tar.gz python -m pytest + mypy --strict tests + - name: Test building from the source distribution (Windows) + if: runner.os == "Windows" + run: | + pip uninstall -y mmh3 + python -m build --sdist + for %i in (dist\*.tar.gz) do python -m pip install %i + python -m pytest + mypy --strict tests diff --git a/foo.sh b/foo.sh new file mode 100644 index 0000000..21c8026 --- /dev/null +++ b/foo.sh @@ -0,0 +1,5 @@ + if [[ "aas" == "windows-2022" ]]; then + for %i in (dist\*.tar.gz) do python -m pip install %i + else + python -m pip install dist/*.tar.gz + fi \ No newline at end of file From 6c9ea0cd8e6688a73b0d46c964c9660c32c6e614 Mon Sep 17 00:00:00 2001 From: Hajime Senuma Date: Sun, 22 Sep 2024 23:30:54 +0900 Subject: [PATCH 09/15] Use shell:bash --- .github/workflows/build.yml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ed3cceb..1936bc7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,19 +44,11 @@ jobs: run: python -m pytest - name: Test type hints with mypy run: mypy --strict tests - - name: Test building from the source distribution (Linux/macOS) - if: runner.os != "Windows" + - name: Test building from the source distribution + shell: bash run: | pip uninstall -y mmh3 python -m build --sdist python -m pip install dist/*.tar.gz python -m pytest mypy --strict tests - - name: Test building from the source distribution (Windows) - if: runner.os == "Windows" - run: | - pip uninstall -y mmh3 - python -m build --sdist - for %i in (dist\*.tar.gz) do python -m pip install %i - python -m pytest - mypy --strict tests From 70ef57d342244d7bc9c90cfd9968cb46591ca96c Mon Sep 17 00:00:00 2001 From: Hajime Senuma Date: Sun, 22 Sep 2024 23:37:09 +0900 Subject: [PATCH 10/15] Remove stub file --- foo.sh | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 foo.sh diff --git a/foo.sh b/foo.sh deleted file mode 100644 index 21c8026..0000000 --- a/foo.sh +++ /dev/null @@ -1,5 +0,0 @@ - if [[ "aas" == "windows-2022" ]]; then - for %i in (dist\*.tar.gz) do python -m pip install %i - else - python -m pip install dist/*.tar.gz - fi \ No newline at end of file From 01f4499a43f1f5e9f86c36bb4048ab7b6b844b0c Mon Sep 17 00:00:00 2001 From: Hajime Senuma Date: Sun, 22 Sep 2024 23:41:00 +0900 Subject: [PATCH 11/15] Add sdist building test to publish workflow --- .github/workflows/wheels.yml | 6 ++++++ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index c66e4e0..9c7dccd 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -78,6 +78,12 @@ jobs: python -m pip install --upgrade pip pip install setuptools build python -m build --sdist + - name: Test building from the source distribution + shell: bash + run: | + python -m pip install dist/*.tar.gz + python -m pytest + mypy --strict tests - uses: actions/upload-artifact@v4 with: path: dist/*.tar.gz diff --git a/pyproject.toml b/pyproject.toml index 3dd842a..6b4701b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta" [project] name = "mmh3" -version = "5.0.0" +version = "5.0.1-dev" description = "Python extension for MurmurHash (MurmurHash3), a set of fast and robust hash functions." readme = "README.md" license = {file = "LICENSE"} From fc6bd513ca3ceb77c54546a7c2088da6c839e2b1 Mon Sep 17 00:00:00 2001 From: Hajime Senuma Date: Mon, 23 Sep 2024 00:06:51 +0900 Subject: [PATCH 12/15] Add CHANGELOG description --- CHANGELOG.md | 8 ++++++++ README.md | 8 ++++++++ docs/CONTRIBUTORS.md | 2 ++ 3 files changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1742aea..17c659b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,13 @@ This project has adhered to [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html) since version 3.0.0. +## [5.0.1] - 2024-09-22 + +### Fixed + +- Fix the issue that the package cannot be built from the source distribution + ([#90](https://github.com/hajimes/mmh3/issues/90)). + ## [5.0.0] - 2024-09-18 ### Added @@ -260,6 +267,7 @@ only. [Softpedia collected mmh3 1.0 on April 27, 2011](https://web.archive.org/web/20110430172027/https://linux.softpedia.com/get/Programming/Libraries/mmh3-68314.shtml), it must have been uploaded to PyPI on or slightly before this date. +[5.0.1]: https://github.com/hajimes/mmh3/compare/v5.0.0...v5.0.1 [5.0.0]: https://github.com/hajimes/mmh3/compare/v4.1.0...v5.0.0 [4.1.0]: https://github.com/hajimes/mmh3/compare/v4.0.1...v4.1.0 [4.0.1]: https://github.com/hajimes/mmh3/compare/v4.0.0...v4.0.1 diff --git a/README.md b/README.md index c9a3c41..35167c0 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,13 @@ in the API Reference for more information. See [Changelog](https://mmh3.readthedocs.io/en/latest/changelog.html) for the complete changelog. +### [5.0.1] - 2024-09-22 + +#### Fixed + +- Fix the issue that the package cannot be built from the source distribution + ([#90](https://github.com/hajimes/mmh3/issues/90)). + ### [5.0.0] - 2024-09-18 #### Added @@ -240,5 +247,6 @@ is useful for OSINT and cybersecurity activities. - : Python bindings for xxHash (Yue Du) +[5.0.1]: https://github.com/hajimes/mmh3/compare/v5.0.0...v5.0.1 [5.0.0]: https://github.com/hajimes/mmh3/compare/v4.1.0...v5.0.0 [4.1.0]: https://github.com/hajimes/mmh3/compare/v4.0.1...v4.1.0 diff --git a/docs/CONTRIBUTORS.md b/docs/CONTRIBUTORS.md index 0f83661..c086ef1 100644 --- a/docs/CONTRIBUTORS.md +++ b/docs/CONTRIBUTORS.md @@ -49,6 +49,8 @@ bug reports, feature suggestions, and other contributions: [#25](https://github.com/hajimes/mmh3/issues/25). - [Jacques Dark](https://github.com/jqdark), [#12](https://github.com/hajimes/mmh3/issues/12). +- [Matej Spiller Muys](https://github.com/matejsp), + [#90](https://github.com/hajimes/mmh3/issues/90). - [Niklas Semmler](https://github.com/niklassemmler), [#7](https://github.com/hajimes/mmh3/issues/7). - [Ryan](https://github.com/ryanfwy), From 8c0c520d2b152ee135d618afae22e2857b27d3da Mon Sep 17 00:00:00 2001 From: Hajime Senuma Date: Mon, 23 Sep 2024 00:16:29 +0900 Subject: [PATCH 13/15] Fix PePy badge url --- README.md | 4 ++-- pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 35167c0..3f2b22a 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ [![PyPi Version](https://img.shields.io/pypi/v/mmh3.svg?style=flat-square&logo=pypi&logoColor=white)](https://pypi.org/project/mmh3/) [![Python Versions](https://img.shields.io/pypi/pyversions/mmh3.svg)](https://pypi.org/project/mmh3/) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/license/mit/) -[![Total Downloads](https://static.pepy.tech/badge/mmh3)](https://pepy.tech/project/mmh3?versions=*&versions=4.*&versions=3.*&versions=2.*) -[![Recent Downloads](https://static.pepy.tech/badge/mmh3/month)](https://pepy.tech/project/mmh3?versions=*&versions=4.*&versions=3.*&versions=2.*) +[![Total Downloads](https://static.pepy.tech/badge/mmh3)](https://www.pepy.tech/projects/mmh3?versions=*&versions=5.*&versions=4.*&versions=3.*&versions=2.*) +[![Recent Downloads](https://static.pepy.tech/badge/mmh3/month)](https://www.pepy.tech/projects/mmh3?versions=*&versions=5.*&versions=4.*&versions=3.*&versions=2.*) `mmh3` is a Python extension for [MurmurHash (MurmurHash3)](https://en.wikipedia.org/wiki/MurmurHash), a set of diff --git a/pyproject.toml b/pyproject.toml index 6b4701b..764113f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta" [project] name = "mmh3" -version = "5.0.1-dev" +version = "5.0.1-rc.1" description = "Python extension for MurmurHash (MurmurHash3), a set of fast and robust hash functions." readme = "README.md" license = {file = "LICENSE"} From 14edaedb1841b45540a9583b08cb853bf6960b4e Mon Sep 17 00:00:00 2001 From: Hajime Senuma Date: Mon, 23 Sep 2024 00:38:39 +0900 Subject: [PATCH 14/15] Delineate endian issue --- README.md | 5 +++-- docs/api.md | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3f2b22a..0fccd83 100644 --- a/README.md +++ b/README.md @@ -166,8 +166,9 @@ By default, `mmh3` returns **signed** values for the 32-bit and 64-bit versions and **unsigned** values for `hash128` due to historical reasons. To get the desired result, use the `signed` keyword argument. -Starting from version 4.0.0, `mmh3` returns the same values on big-endian -platforms as it does on little-endian ones, whereas the original C++ library is +Starting from version 4.0.0, **`mmh3` is endian-neutral**, meaning that its +hash functions return the same values on big-endian platforms as they do on +little-endian ones. In contrast, the original C++ library by Appleby is endian-sensitive. If you need results that comply with the original library on big-endian systems, please use version 3.\*. diff --git a/docs/api.md b/docs/api.md index 5c43efd..7e9dcf8 100644 --- a/docs/api.md +++ b/docs/api.md @@ -25,6 +25,13 @@ functions particularly useful: a `bytes` object, similar to the `hashlib` module in the Python Standard Library. It performs faster than the 32-bit variant on 64-bit machines. +Note that **`mmh3` is endian-neutral**, while the original C++ library is +endian-sensitive (see also +[Known Issues](https://github.com/hajimes/mmh3#known-issues)). +This feature of `mmh3` is essential when portability across different +architectures is required, such as when calculating hash footprints for web +services. + ## Basic Hash Functions The following functions are used to hash immutable types, specifically From ff549f016e1f7a50c2add7475e7fba93f1d5d2e3 Mon Sep 17 00:00:00 2001 From: Hajime Senuma Date: Mon, 23 Sep 2024 00:41:53 +0900 Subject: [PATCH 15/15] Fix publish workflow --- .github/workflows/wheels.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 9c7dccd..b35734b 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -81,6 +81,8 @@ jobs: - name: Test building from the source distribution shell: bash run: | + pip install ".[test,type]" + pip uninstall -y mmh3 python -m pip install dist/*.tar.gz python -m pytest mypy --strict tests