Skip to content

Commit 7be9efb

Browse files
committed
Merge branch 'develop' into multi_weight_storage
2 parents 4443d96 + f6f0832 commit 7be9efb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+964
-263
lines changed

.clang-tidy

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,28 @@ FormatStyle: file
22

33
Checks: "
44
modernize-*,
5-
-modernize-use-trailing-return-type,
5+
readability-*,
6+
bugprone-*,
7+
performance-*,
8+
portability-*,
9+
clang-analyzer-*,
10+
misc-*,
11+
-bugprone-easily-swappable-parameters,
12+
-misc-include-cleaner,
13+
-misc-no-recursion,
14+
-misc-non-private-member-variables-in-classes,
15+
-misc-redundant-expression,
616
-modernize-avoid-c-arrays,
7-
llvm-namespace-comment,
8-
readability-container-size-empty,
17+
-modernize-use-trailing-return-type,
18+
-readability-braces-around-statements,
19+
-readability-function-cognitive-complexity,
20+
-readability-identifier-length,
21+
-readability-magic-numbers,
22+
-readability-named-parameter,
23+
google-explicit-constructor,
924
google-readability-casting,
25+
llvm-namespace-comment,
1026
"
1127

1228
HeaderFilterRegex: "bh_python/.*hpp"
29+
UseColor: true

.github/CONTRIBUTING.md

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ Python's built-in venv:
5959
```bash
6060
python3 -m venv .venv
6161
source ./.venv/bin/activate
62-
pip install dependency-groups
63-
pip-install-dependency-groups dev
64-
pip install -ve.
62+
pip install -ve. --group dev
6563
```
6664

6765
Or if you use uv:
@@ -177,18 +175,11 @@ it yourself (even without installing the hooks) using:
177175
pre-commit run --all-files
178176
```
179177

180-
We do not check `check-manifest` every time locally, since it is slow. You can trigger
181-
this manual check with:
182-
183-
```bash
184-
pre-commit run --all-files --hook-stage manual check-manifest
185-
```
186-
187178
Developers should update the pre-commit dependencies once in a while, you can
188179
do this automatically with:
189180

190181
```bash
191-
pre-commit autoupdate
182+
pre-commit autoupdate -j8
192183
```
193184

194185
> #### Note about skipping Docker
@@ -204,10 +195,18 @@ To run Clang tidy, the following recipe should work. Files will be modified in
204195
place, so you can use git to monitor the changes.
205196

206197
```bash
207-
docker run --rm -v $PWD:/pybind11 -it silkeh/clang:10
208-
apt-get update && apt-get install python3-dev
209-
cmake -S pybind11/ -B build -DCMAKE_CXX_CLANG_TIDY="$(which clang-tidy);-fix"
210-
cmake --build build
198+
docker run --rm -v $PWD:/pybind11 -it silkeh/clang:20
199+
apt update && apt install -y python3-dev python3-pip git ninja-build
200+
python3 -m pip install setuptools_scm --break-system-packages
201+
cmake --preset tidy
202+
cmake --build --preset tidy
203+
```
204+
205+
To autofix, use:
206+
207+
```bash
208+
cmake --preset --preset tidy -DCMAKE_CXX_CLANG_TIDY="clang-tidy;--fix"
209+
cmake --build --preset tidy -j1
211210
```
212211

213212
Remember to build single-threaded if applying fixes!
@@ -243,16 +242,10 @@ Make time/memory taken can be set
243242

244243
<details><summary>Updating dependencies (click to expand)</summary>
245244

246-
This will checkout new versions of the dependencies. Example given using the
247-
fish shell.
245+
This will checkout new versions of the dependencies.
248246

249-
```fish
250-
for f in *
251-
cd $f
252-
git fetch
253-
git checkout boost-1.75.0 || echo "Not found"
254-
cd ..
255-
end
247+
```bash
248+
nox -s bump_boost -- 1.88.0
256249
```
257250

258251
</details>
@@ -262,7 +255,7 @@ end
262255
- Finish merging open PRs that you want in the new version
263256
- Add most recent changes to the `docs/CHANGELOG.md`
264257
- Sync master with develop using `git checkout master; git merge develop --ff-only` and push
265-
- Make sure the full wheel build runs on master without issues (manually trigger if needed)
258+
- Make sure the `cmake --preset tidy` build runs on master without issues (manually trigger if needed)
266259
- Make the GitHub release in the GitHub UI. Copy the changelog entries and
267260
links for that version; this has to be done as part of the release and tag
268261
procedure for archival tools (Zenodo) to pick them up correctly.

.github/workflows/emscripten.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ concurrency:
1717
jobs:
1818
build-pyodide:
1919
name: Pyodide cibuildwheel
20-
runs-on: ubuntu-22.04
20+
runs-on: ubuntu-latest
2121
steps:
2222
- uses: actions/checkout@v4
2323
with:
2424
submodules: true
2525
fetch-depth: 0
2626

27-
- uses: pypa/cibuildwheel@v2.23
27+
- uses: pypa/cibuildwheel@v3.0
2828
env:
2929
CIBW_PLATFORM: pyodide
3030

.github/workflows/tests.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ jobs:
1919
clang-tidy:
2020
name: Clang-Tidy
2121
runs-on: ubuntu-latest
22-
container: silkeh/clang:18-bookworm
22+
container: silkeh/clang:20
2323

2424
steps:
2525
- name: Install requirements
26-
run: apt-get update && apt-get install -y python3-dev python3-pip git
26+
run: apt-get update && apt-get install -y python3-dev python3-pip git ninja-build
2727

2828
- uses: actions/checkout@v4
2929
with:
@@ -34,10 +34,10 @@ jobs:
3434
run: python3 -m pip install setuptools_scm --break-system-packages
3535

3636
- name: Configure
37-
run: cmake -S. -Bbuild -DCMAKE_CXX_CLANG_TIDY="$(which clang-tidy);--warnings-as-errors=*"
37+
run: cmake --preset tidy
3838

3939
- name: Build
40-
run: cmake --build build -j 4
40+
run: cmake --build --preset tidy
4141

4242
pylint:
4343
runs-on: ubuntu-latest
@@ -87,14 +87,13 @@ jobs:
8787
create-symlink: true
8888

8989
- name: Install python tools
90-
run: |
91-
uv pip install --system --python=python --group dev --only-binary numpy pytest-github-actions-annotate-failures
90+
run: uv pip install --system --python=python --group github
9291

9392
- name: Configure
94-
run: cmake --preset default -DCMAKE_BUILD_TYPE=Debug ${{ matrix.cmake-extras }}
93+
run: cmake --preset default ${{ matrix.cmake-extras }}
9594

9695
- name: Build
97-
run: cmake --build --preset default -j 4
96+
run: cmake --build --preset default
9897

9998
- name: Test
10099
run: ctest --preset default -j 4
@@ -129,11 +128,9 @@ jobs:
129128

130129
- uses: astral-sh/setup-uv@v6
131130

132-
- uses: pypa/cibuildwheel@v2.23
131+
- uses: pypa/cibuildwheel@v3.0
133132
with:
134133
only: "${{ matrix.only }}"
135-
env:
136-
CIBW_BUILD_VERBOSITY: 1
137134

138135
- uses: actions/upload-artifact@v4
139136
with:

.github/workflows/wheels.yml

Lines changed: 93 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,14 @@ on:
1111
pull_request:
1212
paths:
1313
- .github/workflows/wheels.yml
14+
schedule:
15+
- cron: "34 3 * * *"
16+
17+
permissions:
18+
actions: read
1419

1520
concurrency:
16-
group: wheels-${{ github.head_ref }}
21+
group: ${{ github.workflow }}-${{ github.ref }}
1722
cancel-in-progress: true
1823

1924
env:
@@ -55,15 +60,15 @@ jobs:
5560
arch: auto64
5661
build: "*"
5762

58-
- os: windows-2019
63+
- os: windows-latest
5964
arch: auto64
6065
build: "cp*"
6166

62-
- os: windows-2019
67+
- os: windows-latest
6368
arch: auto64
64-
build: "pp*"
69+
build: "{p,g}p*"
6570

66-
- os: windows-2019
71+
- os: windows-latest
6772
arch: auto32
6873
build: "*"
6974

@@ -95,7 +100,7 @@ jobs:
95100

96101
- uses: astral-sh/setup-uv@v6
97102

98-
- uses: pypa/cibuildwheel@v2.23
103+
- uses: pypa/cibuildwheel@v3.0
99104
env:
100105
CIBW_BUILD: ${{ matrix.build }}
101106
CIBW_ARCHS: ${{ matrix.arch }}
@@ -110,9 +115,66 @@ jobs:
110115
path: wheelhouse/*.whl
111116
name: wheels-${{ strategy.job-index }}
112117

118+
build_ios_wheels:
119+
name: iOS ${{ matrix.runs-on }}
120+
runs-on: ${{ matrix.runs-on }}
121+
strategy:
122+
fail-fast: false
123+
matrix:
124+
runs-on: [macos-latest, macos-13]
125+
126+
steps:
127+
- uses: actions/checkout@v4
128+
with:
129+
fetch-depth: 0
130+
submodules: true
131+
132+
- run: brew upgrade cmake
133+
134+
- uses: pypa/[email protected]
135+
env:
136+
CIBW_PLATFORM: ios
137+
138+
- name: Verify clean directory
139+
run: git diff --exit-code
140+
shell: bash
141+
142+
- name: Upload wheels
143+
uses: actions/upload-artifact@v4
144+
with:
145+
path: wheelhouse/*.whl
146+
name: wheels-ios-${{ matrix.runs-on }}
147+
148+
# build_android_wheels:
149+
# name: Android ${{ matrix.runs-on }}
150+
# runs-on: ${{ matrix.runs-on }}
151+
# strategy:
152+
# fail-fast: false
153+
# matrix:
154+
# runs-on: [ubuntu-latest, macos-latest]
155+
# steps:
156+
# - uses: actions/checkout@v4
157+
# with:
158+
# fetch-depth: 0
159+
# submodules: true
160+
#
161+
# - uses: mhsmith/cibuildwheel@android
162+
# env:
163+
# CIBW_PLATFORM: android
164+
#
165+
# - name: Verify clean directory
166+
# run: git diff --exit-code
167+
# shell: bash
168+
#
169+
# - name: Upload wheels
170+
# uses: actions/upload-artifact@v4
171+
# with:
172+
# path: wheelhouse/*.whl
173+
# name: wheels-android-${{ matrix.runs-on }}
174+
113175
upload_all:
114176
name: Upload if release
115-
needs: [build_wheels, build_sdist]
177+
needs: [build_wheels, build_ios_wheels, build_sdist]
116178
runs-on: ubuntu-latest
117179
if: github.event_name == 'release' && github.event.action == 'published'
118180
environment:
@@ -139,3 +201,27 @@ jobs:
139201
subject-path: "dist/boost_histogram-*"
140202

141203
- uses: pypa/gh-action-pypi-publish@release/v1
204+
205+
upload_nightly_wheels:
206+
name: Upload nightly wheels to Anaconda Cloud
207+
if: |
208+
(github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') &&
209+
!github.event.repository.fork &&
210+
github.ref == 'refs/heads/develop'
211+
needs: [build_wheels]
212+
runs-on: ubuntu-latest
213+
steps:
214+
- uses: actions/download-artifact@v4
215+
with:
216+
pattern: wheels-*
217+
merge-multiple: true
218+
path: dist
219+
220+
- name: List all files
221+
run: ls -lh dist
222+
223+
- name: Upload wheel to Anaconda Cloud as nightly
224+
uses: scientific-python/upload-nightly-action@b36e8c0c10dbcfd2e05bf95f17ef8c14fd708dbf # 0.6.2
225+
with:
226+
artifacts_path: dist
227+
anaconda_nightly_upload_token: ${{ secrets.ANACONDA_ORG_UPLOAD_TOKEN }}

.pre-commit-config.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ repos:
3636
types_or: [yaml, markdown, html, css, scss, javascript, json]
3737

3838
- repo: https://github.com/astral-sh/ruff-pre-commit
39-
rev: "v0.11.8"
39+
rev: "v0.11.12"
4040
hooks:
4141
- id: ruff
4242
args: ["--fix", "--show-fixes"]
4343
- id: ruff-format
4444

4545
- repo: https://github.com/pre-commit/mirrors-mypy
46-
rev: v1.15.0
46+
rev: v1.16.0
4747
hooks:
4848
- id: mypy
4949
files: ^src
@@ -65,7 +65,7 @@ repos:
6565
exclude: .pre-commit-config.yaml
6666

6767
- repo: https://github.com/pre-commit/mirrors-clang-format
68-
rev: v20.1.3
68+
rev: v20.1.5
6969
hooks:
7070
- id: clang-format
7171
types_or: [c++]
@@ -82,8 +82,8 @@ repos:
8282
hooks:
8383
- id: check-readthedocs
8484
- id: check-github-workflows
85-
86-
- repo: https://github.com/henryiii/validate-pyproject-schema-store
87-
rev: 2025.04.28
88-
hooks:
89-
- id: validate-pyproject
85+
# TMP: waiting for cibuildwheel 3.0
86+
# - repo: https://github.com/henryiii/validate-pyproject-schema-store
87+
# rev: 2025.05.12
88+
# hooks:
89+
# - id: validate-pyproject

CMakeLists.txt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,10 @@ source_group(
118118
option(BOOST_HISTOGRAM_ERRORS "Make warnings errors (for CI mostly)")
119119

120120
# Adding warnings
121+
# Boost.Histogram doesn't pass sign -Wsign-conversion
121122
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
122-
target_compile_options(
123-
_core
124-
PRIVATE -Wall
125-
-Wextra
126-
-pedantic-errors
127-
-Wconversion
128-
-Wsign-conversion
129-
-Wsign-compare
130-
-Wno-unused-value)
123+
target_compile_options(_core PRIVATE -Wall -Wextra -pedantic-errors -Wconversion -Wsign-compare
124+
-Wno-unused-value)
131125
if(BOOST_HISTOGRAM_ERRORS)
132126
target_compile_options(_core PRIVATE -Werror)
133127
endif()

0 commit comments

Comments
 (0)