Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
4ac65ff
chore: add build deps
BobTheBuidler Sep 30, 2025
acce3fc
Update setup.py
BobTheBuidler Sep 30, 2025
9574198
Rename __init__.py to __init__.py
BobTheBuidler Sep 30, 2025
c746be4
Rename main.py to main.py
BobTheBuidler Sep 30, 2025
f9ca755
Rename _utils.py to _utils.py
BobTheBuidler Sep 30, 2025
908ec37
Rename py.typed to py.typed
BobTheBuidler Sep 30, 2025
77d2094
Update test_hexbytes.py
BobTheBuidler Sep 30, 2025
fcac0b1
Update test_import_and_version.py
BobTheBuidler Sep 30, 2025
390c77c
Create compile.yaml
BobTheBuidler Sep 30, 2025
3510218
Update compile.yaml
BobTheBuidler Sep 30, 2025
648d247
Update setup.py
BobTheBuidler Sep 30, 2025
f31d06c
Update main.py
BobTheBuidler Sep 30, 2025
8adfdc2
Update main.py
BobTheBuidler Sep 30, 2025
b749aa5
Update main.py
BobTheBuidler Sep 30, 2025
d5aa758
Update main.py
BobTheBuidler Sep 30, 2025
2839826
Update .gitignore
BobTheBuidler Sep 30, 2025
512b58c
chore: compile C files for source control
github-actions[bot] Sep 30, 2025
d0c74e8
comiple
BobTheBuidler Sep 30, 2025
8872a62
microoptimize __getitem__
BobTheBuidler Sep 30, 2025
3570529
fix compile err
BobTheBuidler Sep 30, 2025
df3e297
Update .gitignore
BobTheBuidler Sep 30, 2025
cbcc7b6
Delete build directory
BobTheBuidler Sep 30, 2025
5b7bfcd
fix mypy err
BobTheBuidler Sep 30, 2025
919d553
fix mypy err
BobTheBuidler Sep 30, 2025
5f450b5
chore: compile C files for source control
github-actions[bot] Sep 30, 2025
38f05f2
benchmarks
BobTheBuidler Sep 30, 2025
4da50ae
Merge branch 'master' of https://github.com/BobTheBuidler/hexbytes
BobTheBuidler Sep 30, 2025
f293141
chore: compile C files for source control
github-actions[bot] Sep 30, 2025
93b9fe4
Create __init__.py
BobTheBuidler Sep 30, 2025
a7e70a2
chore: compile C files for source control
github-actions[bot] Sep 30, 2025
d7cfb56
Update setup.py
BobTheBuidler Sep 30, 2025
13ce430
chore: compile C files for source control
github-actions[bot] Sep 30, 2025
cbdcc53
Update benchmark.yaml
BobTheBuidler Sep 30, 2025
735b8d2
Update codspeed.yaml
BobTheBuidler Sep 30, 2025
020f06d
chore: compile C files for source control
github-actions[bot] Sep 30, 2025
2dac808
Update benchmark.yaml
BobTheBuidler Sep 30, 2025
398a213
chore: compile C files for source control
github-actions[bot] Sep 30, 2025
3373a25
fix broken benchmarks
BobTheBuidler Sep 30, 2025
6b828d4
chore: compile C files for source control
github-actions[bot] Sep 30, 2025
1ae7b82
Update test__utils_benchmarks.py
BobTheBuidler Sep 30, 2025
6a83b63
chore: compile C files for source control
github-actions[bot] Sep 30, 2025
8a92df1
Update test_main_benchmarks.py
BobTheBuidler Sep 30, 2025
c500ced
chore: compile C files for source control
github-actions[bot] Sep 30, 2025
ffe0636
Update test_main_benchmarks.py
BobTheBuidler Sep 30, 2025
288dcd0
chore: compile C files for source control
github-actions[bot] Sep 30, 2025
76c03d9
run comparison benchmarks (#2)
BobTheBuidler Sep 30, 2025
78565ce
black .
BobTheBuidler Sep 30, 2025
4da7ed0
chore: drop python3.8 (#4)
BobTheBuidler Sep 30, 2025
cc1314f
chore: compile C files for source control
github-actions[bot] Sep 30, 2025
3c496dd
feat(cicd): tox github action (#3)
BobTheBuidler Sep 30, 2025
ba5b861
Create release.yaml
BobTheBuidler Sep 30, 2025
ba17d87
chore: compile C files for source control
github-actions[bot] Sep 30, 2025
a5cee88
fix comment
BobTheBuidler Sep 30, 2025
c7c2ec9
chore: compile C files for source control
github-actions[bot] Sep 30, 2025
76b6c74
feat: microoptimize `__repr__` (#11)
BobTheBuidler Sep 30, 2025
5ef715f
chore: compile C files for source control
github-actions[bot] Sep 30, 2025
14b36ce
fix: TypeError in `HexBytes.__new__` if called from subclass (#10)
BobTheBuidler Sep 30, 2025
56ac7cb
chore: bump version to 1.3.2
BobTheBuidler Sep 30, 2025
a68fc53
chore: compile C files for source control
github-actions[bot] Sep 30, 2025
e4d966f
fix(cicd): missing dep in release workflow
BobTheBuidler Sep 30, 2025
04c6a8e
fix(cicd): missing dep in release workflow
BobTheBuidler Sep 30, 2025
aa1b04c
chore: compile C files for source control
github-actions[bot] Sep 30, 2025
ac67e29
Update README.md
BobTheBuidler Oct 1, 2025
092cede
chore: compile C files for source control
github-actions[bot] Oct 1, 2025
72fb548
Update README.md
BobTheBuidler Oct 1, 2025
554bb2a
chore: compile C files for source control
github-actions[bot] Oct 1, 2025
a7d1cc1
chore(cicd): limit tox action concurrency
BobTheBuidler Oct 5, 2025
b0df506
chore: compile C files for source control
github-actions[bot] Oct 5, 2025
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
114 changes: 114 additions & 0 deletions .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Pytest Benchmarks

on:
pull_request:
branches: [master]
push:
branches: [master]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
benchmark:
name: Run Benchmarks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[dev] pytest-codspeed pytest-benchmark
- name: Remove Python files from test env
run: rm -r faster_hexbytes
- name: Run Pytest Benchmark & Save Output
run: pytest --benchmark-only --benchmark-json=benchmark.json benchmarks/
- name: Upload Pytest Benchmark Results
uses: actions/upload-artifact@v4
with:
name: pytest-benchmark-results
path: benchmark.json
- name: Parse Pytest Benchmark Output
run: python scripts/benchmark/parse_benchmark_output.py benchmark.json pytest_benchmark_results.json
- name: Compare Pytest Benchmark Results
run: python scripts/benchmark/compare_benchmark_results.py pytest_benchmark_results.json pytest_benchmark_diff.json
- name: Generate Markdown Benchmark Results
run: python scripts/benchmark/generate_benchmark_markdown.py
- name: Commit and Push Markdown Benchmark Results
continue-on-error: true
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git fetch origin ${{ github.head_ref || github.ref_name }}
git checkout ${{ github.head_ref || github.ref_name }}
git add benchmarks/results/*.md
if git diff --cached --quiet; then
echo "No changes to commit."
else
git commit -m "Update benchmark results [skip ci]"
git push origin HEAD:${{ github.head_ref || github.ref_name }}
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Markdown Benchmark Results
uses: actions/upload-artifact@v4
with:
name: markdown-benchmark-results
path: benchmarks/results/*.md
- name: Upload Pytest Benchmark Diff
uses: actions/upload-artifact@v4
with:
name: pytest-benchmark-diff
path: pytest_benchmark_diff.json
- name: Post Pytest Benchmark Diff as PR Comment
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const diff = JSON.parse(fs.readFileSync('pytest_benchmark_diff.json', 'utf8'));
let body = '### Pytest Benchmark Diff\n\n';
const repo = `${context.repo.owner}/${context.repo.repo}`;
const branch = context.payload.pull_request ? context.payload.pull_request.head.ref : context.ref.replace('refs/heads/', '');
for (const [submodule, groupDiffs] of Object.entries(diff)) {
let submoduleFile = "unknown";
let benchmarkFile = "unknown";
const m = submodule.match(/^faster_hexbytes\.(.+)$/);
if (m) {
submoduleFile = `faster_hexbytes/${m[1]}.py`;
benchmarkFile = `benchmarks/test_${m[1]}_benchmarks.py`;
}
const submoduleUrl = `https://github.com/${repo}/blob/${branch}/${submoduleFile}`;
const benchmarkUrl = `https://github.com/${repo}/blob/${branch}/${benchmarkFile}`;
body += `#### [${submodule}](${submoduleUrl}) - [view benchmarks](${benchmarkUrl})\n`;
body += '| Function | Reference Mean | Faster Mean | % Change | Speedup (%) | x Faster | Faster |\n';
body += '|----------|---------------|-------------|----------|-------------|----------|--------|\n';
for (const [group, data] of Object.entries(groupDiffs).sort(([a], [b]) => a.localeCompare(b))) {
if (data.percent_change !== null && data.percent_change !== undefined) {
let emoji = '➖';
if (data.percent_change > 0) emoji = '✅';
else if (data.percent_change < 0) emoji = '❌';
const percentChange = data.percent_change !== undefined && data.percent_change !== null
? `${data.percent_change.toFixed(2)}%` : '';
const speedupPercent = data.speedup_percent !== undefined && data.speedup_percent !== null
? `${data.speedup_percent.toFixed(2)}%` : '';
const speedupX = data.speedup_x !== undefined && data.speedup_x !== null && isFinite(data.speedup_x)
? `${data.speedup_x.toFixed(2)}x` : '';
body += `| \`${group}\` | ${data.reference_mean} | ${data.faster_mean} | ${percentChange} | ${speedupPercent} | ${speedupX} | ${emoji} |\n`;
} else if (data.note) {
body += `| \`${group}\` | | | | | | ➖ |\n`;
}
}
body += '\n';
}
github.rest.issues.createComment({
...context.repo,
issue_number: context.issue.number,
body
});
if: github.event_name == 'pull_request'
33 changes: 33 additions & 0 deletions .github/workflows/codspeed.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CodSpeed Benchmarks

on:
pull_request:
branches: [master]
push:
branches: [master]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
benchmark:
name: Run CodSpeed Benchmarks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[dev] pytest-codspeed
- name: Remove Python files from test env
run: rm -r faster_hexbytes
- name: Run CodSpeed
uses: CodSpeedHQ/action@v3
with:
run: pytest --codspeed -k "test_faster_" benchmarks/
50 changes: 50 additions & 0 deletions .github/workflows/compile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Compile

on:
pull_request:
branches:
- master
push:
branches:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-ubuntu:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
# Check out the PR branch
ref: ${{ github.head_ref }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"

- name: Install Faster Hexbytes
env:
MYPYC_STRICT_DUNDER_TYPING: 1
run: pip install .

- name: Check for changes
run: |
if [[ -n $(git status --porcelain) ]]; then
echo "changes_detected=true" >> $GITHUB_ENV
else
echo "changes_detected=false" >> $GITHUB_ENV
fi

- name: Commit changes
if: env.changes_detected == 'true'
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "chore: compile C files for source control"
git push
199 changes: 199 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
name: Build and Publish Wheels

on:
release:
branches:
- master
types: [published]

jobs:
build_wheels:
name: Build wheels using cibuildwheel
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# ----------------------------------------------------
# manylinux 64-bit
# ----------------------------------------------------
- os: ubuntu-latest
build_type: manylinux-x64
cibw_build: "*manylinux*"
cibw_archs_linux: x86_64
artifact_name: "wheels-ubuntu-latest-manylinux-x64"

# ----------------------------------------------------
# manylinux 32-bit
# ----------------------------------------------------
- os: ubuntu-latest
build_type: manylinux-x86
cibw_build: "*manylinux*"
cibw_archs_linux: i686
artifact_name: "wheels-ubuntu-latest-manylinux-x86"

# ----------------------------------------------------
# musllinux 64-bit
# ----------------------------------------------------
- os: ubuntu-latest
build_type: musllinux-x64
cibw_build: "*musllinux*"
cibw_archs_linux: x86_64
artifact_name: "wheels-ubuntu-latest-musllinux-x64"

# ----------------------------------------------------
# musllinux 32-bit
# ----------------------------------------------------
- os: ubuntu-latest
build_type: musllinux-x86
cibw_build: "*musllinux*"
cibw_archs_linux: i686
artifact_name: "wheels-ubuntu-latest-musllinux-x86"

# ----------------------------------------------------
# macOS (64-bit only)
# ----------------------------------------------------
- os: macos-latest
build_type: macos
cibw_build: ""
cibw_archs_linux: ""
artifact_name: "wheels-macos-latest"

# ----------------------------------------------------
# Windows 64-bit
# ----------------------------------------------------
- os: windows-latest
build_type: winx64
cibw_build: ""
cibw_archs_windows: AMD64
artifact_name: "wheels-windows-latest-x64"

# ----------------------------------------------------
# Windows 32-bit
# ----------------------------------------------------
- os: windows-latest
build_type: winx86
cibw_build: ""
cibw_archs_windows: x86
artifact_name: "wheels-windows-latest-x86"

steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install cibuildwheel
run: |
python -m pip install --upgrade pip setuptools wheel cibuildwheel

- name: Build wheels
env:
# Skip PyPy
CIBW_SKIP: pp*
# On Linux: manylinux / musllinux arches
CIBW_ARCHS_LINUX: ${{ matrix.cibw_archs_linux || '' }}
# On Windows: AMD64 / x86
CIBW_ARCHS_WINDOWS: ${{ matrix.cibw_archs_windows || '' }}
# Which wheels to build for Linux (manylinux vs. musllinux)
CIBW_BUILD: ${{ matrix.cibw_build || '' }}
run: |
python -m cibuildwheel --output-dir wheelhouse

- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: wheelhouse/*.whl

publish_sdist_and_wheels:
name: Publish wheels to PyPI
needs: build_wheels
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine mypy==1.18.2 hexbytes==1.3.1

- name: Build sdist
run: |
python setup.py sdist

# ----------------------------------------------------
# Download wheels built on each runner
# ----------------------------------------------------
- name: Download manylinux 64-bit wheels
uses: actions/download-artifact@v4
with:
name: "wheels-ubuntu-latest-manylinux-x64"
path: wheelhouse/linux-many-x64

- name: Download manylinux 32-bit wheels
uses: actions/download-artifact@v4
with:
name: "wheels-ubuntu-latest-manylinux-x86"
path: wheelhouse/linux-many-x86

- name: Download musllinux 64-bit wheels
uses: actions/download-artifact@v4
with:
name: "wheels-ubuntu-latest-musllinux-x64"
path: wheelhouse/linux-musl-x64

- name: Download musllinux 32-bit wheels
uses: actions/download-artifact@v4
with:
name: "wheels-ubuntu-latest-musllinux-x86"
path: wheelhouse/linux-musl-x86

- name: Download macOS wheels
uses: actions/download-artifact@v4
with:
name: "wheels-macos-latest"
path: wheelhouse/macos

- name: Download Windows 64-bit wheels
uses: actions/download-artifact@v4
with:
name: "wheels-windows-latest-x64"
path: wheelhouse/windows-x64

- name: Download Windows 32-bit wheels
uses: actions/download-artifact@v4
with:
name: "wheels-windows-latest-x86"
path: wheelhouse/windows-x86

# ----------------------------------------------------
# Publish all built artifacts to PyPI
# ----------------------------------------------------
- name: Publish sdist and wheels to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload \
dist/* \
wheelhouse/linux-many-x64/*.whl \
wheelhouse/linux-many-x86/*.whl \
wheelhouse/linux-musl-x64/*.whl \
wheelhouse/linux-musl-x86/*.whl \
wheelhouse/macos/*.whl \
wheelhouse/windows-x64/*.whl \
wheelhouse/windows-x86/*.whl
Loading