Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
pip install pytest pytest-benchmark
pip install .

- name: Run benchmarks
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
pip install pytest pytest-benchmark
pip install .

- name: Run benchmarks
Expand Down
94 changes: 51 additions & 43 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,113 +11,116 @@ on:
jobs:
build-and-test:
name: Testing with Python 3.${{ matrix.python_minor }} on Linux
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
matrix:
python_minor: [ "6" , "7" , "8" , "9" , "10" ]
python_minor: [ "9" , "10" , "11" , "12" , "13" ]

steps:
- uses: actions/checkout@v4.2.2
- name: Install cibuildwheel
run: |
python3 -m pip install --upgrade pip
python3 -m pip install cibuildwheel twine
python3 -m pip install cibuildwheel "twine>=6.1.0" "packaging>=24.2"

- name: 🛠 Build and Test Hexhamming Python C extension
run: cibuildwheel
env:
CIBW_BUILD: ${{ format('cp3{0}-manylinux_x86_64', matrix.python_minor) }}
CIBW_BEFORE_TEST: pip install -r requirements-dev.txt
CIBW_TEST_COMMAND: "pytest -s {project}"
CIBW_TEST_REQUIRES: pytest pytest-benchmark
CIBW_TEST_COMMAND: "pytest -s {project}/test"
CIBW_BUILD_VERBOSITY: 1

- name: Check built wheels
run: twine check wheelhouse/*
run: |
twine --version
twine check wheelhouse/*

sdist:
if: startsWith(github.ref, 'refs/tags')
needs: build-and-test
name: Source distribution
runs-on: macos-13
runs-on: macos-14

steps:
- uses: actions/checkout@v4.2.2
- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Install requirements
run: |
pip3 install --user check-manifest twine
python3 -m pip install --upgrade pip setuptools wheel
python3 -m pip install -r requirements-dev.txt
uv tool install check-manifest
uv tool install "twine>=6.1.0"
uv tool install build

- name: Run check-manifest
run: python3 -m check_manifest
run: check-manifest

- name: Build sdist
run: python3 -m build --sdist --outdir wheelhouse
run: uv build --sdist --out-dir wheelhouse

- name: Install from sdist
run: pip3 install --user wheelhouse/*.tar.gz
run: uv pip install --system wheelhouse/*.tar.gz

- name: Check sdist
run: python3 -m twine check wheelhouse/*
run: |
twine --version
twine check wheelhouse/*

- name: Upload sdist
uses: actions/upload-artifact@v4.4.3
with:
name: wheels
name: sdist
path: wheelhouse/*.tar.gz

wheels_macos:
if: startsWith(github.ref, 'refs/tags')
needs: [build-and-test, sdist]
name: Build macOS ${{ matrix.cibw_python }} ${{ matrix.cibw_arch }} wheels
runs-on: macos-13
runs-on: ${{ matrix.cibw_arch == 'arm64' && 'macos-14' || 'macos-13' }}
strategy:
fail-fast: true
matrix:
cibw_python: [ "cp38-*", "cp39-*", "cp310-*" ]
cibw_python: [ "cp39-*", "cp310-*", "cp311-*", "cp312-*", "cp313-*" ]
cibw_arch: [ "x86_64", "arm64" ]

steps:
- uses: actions/checkout@v4.2.2
- name: Install cibuildwheel
run: |
python3 -m pip install --upgrade pip
python3 -m pip install cibuildwheel twine
echo DEPLOYMENT_TARGET=10.9 >> $GITHUB_ENV

- name: Changing deployment target
if: matrix.cibw_arch == 'arm64'
run: echo DEPLOYMENT_TARGET=12.0 >> $GITHUB_ENV
python3 -m pip install cibuildwheel "twine>=6.1.0" "packaging>=24.2"

- name: 🛠 Build Hexhamming Python C extension
run: cibuildwheel
env:
CIBW_ENVIRONMENT: MACOSX_DEPLOYMENT_TARGET=${{ env.DEPLOYMENT_TARGET }}
CIBW_BUILD: ${{ matrix.cibw_python }}
CIBW_ARCHS_MACOS: ${{ matrix.cibw_arch }}
CIBW_TEST_SKIP: "*-macosx_arm64"
CC: /usr/bin/clang
CXX: /usr/bin/clang++
CFLAGS: "-Wno-implicit-function-declaration"
CIBW_BEFORE_TEST: pip install -r requirements-dev.txt
CIBW_TEST_COMMAND: "pytest -s {project}"
CIBW_TEST_REQUIRES: pytest pytest-benchmark
CIBW_TEST_COMMAND: "pytest -s {project}/test"
CIBW_BUILD_VERBOSITY: 1

- name: Check built wheels
run: twine check wheelhouse/*
run: |
twine --version
twine check wheelhouse/*

- name: Upload built wheels
uses: actions/upload-artifact@v4.4.3
with:
name: wheels
name: wheels-macos-${{ matrix.cibw_arch }}-${{ matrix.cibw_python }}
path: wheelhouse/*.whl
if-no-files-found: error

wheels_linux:
if: startsWith(github.ref, 'refs/tags')
needs: [build-and-test, sdist]
name: Build ${{ matrix.cibw_buildlinux }} ${{ matrix.cibw_arch }} wheels
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
fail-fast: true
matrix:
Expand All @@ -135,24 +138,26 @@ jobs:
- name: Install cibuildwheel
run: |
python3 -m pip install --upgrade pip
python3 -m pip install cibuildwheel twine
python3 -m pip install cibuildwheel "twine>=6.1.0" "packaging>=24.2"

- name: 🛠 Build Hexhamming Python C extension
run: cibuildwheel
env:
CIBW_BUILD: ${{ format('cp3*-{0}*', matrix.cibw_buildlinux) }}
CIBW_ARCHS_LINUX: ${{ matrix.cibw_arch }}
CIBW_BEFORE_TEST: pip install -r requirements-dev.txt
CIBW_TEST_COMMAND: "pytest -s {project}"
CIBW_TEST_REQUIRES: pytest pytest-benchmark
CIBW_TEST_COMMAND: "pytest -s {project}/test"
CIBW_BUILD_VERBOSITY: 1

- name: Check built wheels
run: twine check wheelhouse/*
run: |
twine --version
twine check wheelhouse/*

- name: Upload built wheels
uses: actions/upload-artifact@v4.4.3
with:
name: wheels
name: wheels-linux-${{ matrix.cibw_buildlinux }}-${{ matrix.cibw_arch }}
path: wheelhouse/*.whl
if-no-files-found: error

Expand All @@ -167,42 +172,45 @@ jobs:
- name: Install cibuildwheel
run: |
python3 -m pip install --upgrade pip
python3 -m pip install cibuildwheel twine
python3 -m pip install cibuildwheel "twine>=6.1.0" "packaging>=24.2"

- name: 🛠 Build Hexhamming Python C extension
run: cibuildwheel
env:
CIBW_BUILD: "cp36-* cp37-* cp38-* cp39-* cp310-*"
CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-*"
CIBW_ARCHS_WINDOWS: "AMD64"
CIBW_BEFORE_TEST: pip install -r requirements-dev.txt
CIBW_TEST_COMMAND: "pytest -s {project}"
CIBW_TEST_REQUIRES: pytest pytest-benchmark
CIBW_TEST_COMMAND: "pytest -s {project}/test"
CIBW_BUILD_VERBOSITY: 1

- name: Check built wheels
run: twine check wheelhouse/*
run: |
twine --version
twine check wheelhouse/*

- name: Upload built wheels
uses: actions/upload-artifact@v4.4.3
with:
name: wheels
name: wheels-windows
path: wheelhouse/*.whl
if-no-files-found: error

publish-wheels:
if: startsWith(github.ref, 'refs/tags')
needs: [wheels_macos, wheels_linux, wheels_windows]
name: Publish wheels
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- name: Collect sdist and wheels
uses: actions/download-artifact@v4.1.8
with:
name: wheels
pattern: '{sdist,wheels-*}'
path: wheelhouse
merge-multiple: true

- name: Install twine
run: python -m pip install twine
run: python -m pip install "twine>=6.1.0" "packaging>=24.2"

- name: 📦 Publish distribution to PyPI
env:
Expand Down
25 changes: 21 additions & 4 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
"THE BEERWARE LICENSE" (Revision 42):
Michael Recachinas <mrecachinas@gmail.com> wrote this software. As long as you retain
this notice, you can do whatever you want with this stuff. If we meet some
day, and you think this stuff is worth it, you can buy me a beer in return.
MIT License

Copyright (c) 2026 Michael Recachinas

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
11 changes: 8 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
include README.rst
include requirements-dev.txt
include pytest.ini
include LICENSE
include pyproject.toml

graft test
graft hexhamming
graft src

global-exclude *.pyc
global-exclude *.pyo
global-exclude *.so
global-exclude __pycache__
56 changes: 56 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[build-system]
requires = ["setuptools>=77.0.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "hexhamming"
version = "2.2.3"
description = "Fast Hamming distance calculation for hexadecimal strings"
readme = "README.rst"
license = "MIT"
authors = [
{ name = "Michael Recachinas", email = "m.recachinas@gmail.com" }
]
keywords = ["hamming", "distance", "simd"]
classifiers = [
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: Linux",
"Operating System :: Microsoft :: Windows",
"Programming Language :: C",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
requires-python = ">=3.8"

[project.urls]
Homepage = "https://github.com/mrecachinas/hexhamming"
Repository = "https://github.com/mrecachinas/hexhamming.git"

[dependency-groups]
dev = [
"ruff",
"pytest",
"pytest-benchmark",
]

[tool.setuptools]
zip-safe = false
packages = []

[tool.pytest.ini_options]
testpaths = ["test"]

[tool.check-manifest]
ignore = ["uv.lock"]

[tool.ruff]
line-length = 88
target-version = "py38"

[tool.ruff.format]
quote-style = "double"
3 changes: 0 additions & 3 deletions pytest.ini

This file was deleted.

3 changes: 0 additions & 3 deletions requirements-dev.txt

This file was deleted.

Loading