Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 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
9dc06e7
feat(cicd): normalize C files for diffchecking (#12)
BobTheBuidler Oct 7, 2025
915a16f
feat(cicd): only run runners on code changes (#13)
BobTheBuidler Oct 7, 2025
5b5cf49
Update benchmark results [skip ci]
github-actions[bot] Oct 7, 2025
33e64b4
feat(test): add workflow_dispatch trigger to tox workflow (#14)
BobTheBuidler Oct 8, 2025
3cae667
feat(cicd): use caching in github actions workflows (#15)
BobTheBuidler Oct 8, 2025
46be7b9
Update benchmark results [skip ci]
github-actions[bot] Oct 8, 2025
eea8646
feat(test): test on Python3.14, 3.13t, 3.14t (#16)
BobTheBuidler Oct 8, 2025
e76a7bc
feat(cicd): build C files for source control on py3.14 (#18)
BobTheBuidler Oct 8, 2025
5aecfba
Add renovate.json (#19)
renovate[bot] Oct 8, 2025
1f07526
fix(test): run cronjob daily
BobTheBuidler Oct 8, 2025
8bc655f
chore(deps): update dependency win to v5.1.0 (#23)
renovate[bot] Oct 8, 2025
50acbfb
chore(deps): update actions/download-artifact action to v5 (#25)
renovate[bot] Oct 10, 2025
a7a844e
chore(deps): update actions/github-script action to v8 (#26)
renovate[bot] Oct 10, 2025
431949f
chore(deps): update dependency towncrier to v25 (#29)
renovate[bot] Oct 10, 2025
a65db6a
chore(deps): update actions/setup-python action to v6 (#27)
renovate[bot] Oct 10, 2025
6682f79
chore(deps): update actions/checkout action to v5 (#24)
renovate[bot] Oct 10, 2025
df492f1
Update benchmark results [skip ci]
github-actions[bot] Oct 10, 2025
c88832e
chore(deps): update codspeedhq/action action to v4 (#28)
renovate[bot] Oct 10, 2025
e2e89f7
feat(test): test on 32-bit systems (#30)
BobTheBuidler Oct 10, 2025
4faf995
chore: skip mypycify cmd in setup.py if not installing (#32)
BobTheBuidler Oct 11, 2025
a59f3f7
Update benchmark results [skip ci]
github-actions[bot] Oct 11, 2025
05238a4
feat(cicd): cache .mypy_cache for runners (#33)
BobTheBuidler Oct 14, 2025
21706c5
chore(deps): update actions/setup-python action to v6 (#31)
renovate[bot] Oct 14, 2025
a1d37ac
feat(test): limit cronjob to 4 runners (#35)
BobTheBuidler Oct 14, 2025
a99ffaa
feat: set mypyc flag strict_dunder_typing=True (#37)
BobTheBuidler Oct 15, 2025
3d5be8d
Update benchmark results [skip ci]
github-actions[bot] Oct 15, 2025
b24533a
chore: set mypyc group name (#36)
BobTheBuidler Oct 15, 2025
53d3878
Update benchmark results [skip ci]
github-actions[bot] Oct 15, 2025
015cadb
fix(test): dont queue workers unless cronjob
BobTheBuidler Oct 15, 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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ common: &common
key: cache-v1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}

orbs:
win: circleci/windows@5.0.0
win: circleci/windows@5.1.0

windows-wheel-steps:
windows-wheel-setup: &windows-wheel-setup
Expand Down
146 changes: 146 additions & 0 deletions .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
name: Pytest Benchmarks

on:
pull_request:
branches: [master]
paths:
- '**.py'
- '.github/workflows/benchmark.yaml'
- 'pyproject.toml'
- 'setup.py'
push:
branches: [master]
paths:
- '**.py'
- '.github/workflows/benchmark.yaml'
- 'pyproject.toml'
- 'setup.py'
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@v5

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.13"
cache: pip
cache-dependency-path: |
setup.py
pyproject.toml

- name: Cache .mypy_cache
uses: actions/cache@v4
with:
path: .mypy_cache
key: mypy-cache-${{ runner.os }}-x64-${{ hashFiles('**/*.py', 'pyproject.toml') }}

- 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@v8
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'
58 changes: 58 additions & 0 deletions .github/workflows/codspeed.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CodSpeed Benchmarks

on:
pull_request:
branches: [master]
paths:
- '**.py'
- '.github/workflows/codspeed.yaml'
- 'pyproject.toml'
- 'setup.py'
push:
branches: [master]
paths:
- '**.py'
- '.github/workflows/codspeed.yaml'
- 'pyproject.toml'
- 'setup.py'
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@v5

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.13"
cache: pip
cache-dependency-path: |
setup.py
pyproject.toml

- name: Cache .mypy_cache
uses: actions/cache@v4
with:
path: .mypy_cache
key: mypy-cache-${{ runner.os }}-x64-${{ hashFiles('**/*.py', 'pyproject.toml') }}

- 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@v4
with:
mode: instrumentation
run: pytest --codspeed -k "test_faster_" benchmarks/
83 changes: 83 additions & 0 deletions .github/workflows/compile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Compile

on:
pull_request:
branches:
- master
paths-ignore:
- '.github/workflows/**'
- '!.github/workflows/compile.yaml'
push:
branches:
- master
paths-ignore:
- '.github/workflows/**'
- '!.github/workflows/compile.yaml'

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

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

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.14"
cache: pip
cache-dependency-path: |
setup.py
pyproject.toml

- name: Cache .mypy_cache
uses: actions/cache@v4
with:
path: .mypy_cache
key: mypy-cache-${{ runner.os }}-x64-${{ hashFiles('**/*.py', 'pyproject.toml') }}

- name: Delete existing build files
run: rm -rf build

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

- name: Normalize C files for diffchecking
# This makes it much easier to diffcheck changes in the C files
run: |
# Insert DIFFCHECK_PLACEHOLDER macro at the top if not present
for f in build/*.c; do
if ! grep -q 'DIFFCHECK_PLACEHOLDER' "$f"; then
sed -i '1i#ifndef DIFFCHECK_PLACEHOLDER\n#define DIFFCHECK_PLACEHOLDER 0\n#endif' "$f"
fi
done
# Replace line number in CPy_AddTraceback with macro
sed -i 's/\(CPy_AddTraceback([^,]*, *[^,]*, *\)[0-9]\+\(, *[^)]*)\)/\1DIFFCHECK_PLACEHOLDER\2/g' build/*.c
# Replace index in CPyStatics[...] with macro
sed -i 's/CPyStatics\[[0-9]\+\]/CPyStatics[DIFFCHECK_PLACEHOLDER]/g' build/*.c

- 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
Loading
Loading