Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update cibw config #969

Merged
merged 7 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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 .github/workflows/emscripten.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
submodules: true
fetch-depth: 0

- uses: pypa/cibuildwheel@v2.21
- uses: pypa/cibuildwheel@v2.22
env:
CIBW_PLATFORM: pyodide

Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ jobs:
include:
- os: ubuntu-latest
only: cp313t-manylinux_x86_64
- os: ubuntu-latest
only: cp313-manylinux_x86_64
- os: windows-2019
- os: ubuntu-24.04-arm
only: cp313-manylinux_aarch64
- os: windows-latest
only: cp38-win32
- os: windows-2019
- os: windows-latest
only: cp313-win_amd64
- os: macos-13
only: cp39-macosx_x86_64
Expand All @@ -126,9 +126,9 @@ jobs:
submodules: true
fetch-depth: 0

- uses: yezz123/setup-uv@v4
- uses: astral-sh/setup-uv@v4

- uses: pypa/cibuildwheel@v2.21
- uses: pypa/cibuildwheel@v2.22
with:
only: "${{ matrix.only }}"
env:
Expand All @@ -140,7 +140,7 @@ jobs:
name: test-wheels-${{ strategy.job-index }}

- name: Check wheels
run: pipx run twine check wheelhouse/*
run: uvx twine check wheelhouse/*
henryiii marked this conversation as resolved.
Show resolved Hide resolved
shell: bash

pass:
Expand Down
46 changes: 11 additions & 35 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ env:
jobs:
build_sdist:
name: Build SDist
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -40,38 +40,6 @@ jobs:
path: dist/*
name: wheels-sdist

build_arch_wheels:
name: ${{ matrix.python }} on ${{ matrix.arch }}
runs-on: ubuntu-22.04
strategy:
matrix:
python: ["38", "39", "310", "311", "312", "313", "313t"]
arch: [aarch64]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true

- uses: docker/[email protected]
with:
platforms: all

- uses: pypa/[email protected]
env:
CIBW_BUILD: cp${{ matrix.python }}-manylinux_*
CIBW_ARCHS: ${{ matrix.arch }}

- name: Verify clean directory
run: git diff --exit-code
shell: bash

- name: Upload wheels
uses: actions/upload-artifact@v4
with:
path: wheelhouse/*
name: wheels-aarch-${{ strategy.job-index }}

build_wheels:
name: ${{ matrix.build }} ${{ matrix.arch }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -107,20 +75,28 @@ jobs:
arch: auto64
build: "*musllinux*"

- os: ubuntu-24.04-arm
arch: auto64
build: "*manylinux*"

- os: ubuntu-24.04-arm
arch: auto64
build: "*musllinux*"

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true

- uses: yezz123/setup-uv@v4
- uses: astral-sh/setup-uv@v4

- uses: actions/setup-python@v5
if: matrix.os == 'macos-14'
with:
python-version: 3.8

- uses: pypa/cibuildwheel@v2.21
- uses: pypa/cibuildwheel@v2.22
env:
CIBW_BUILD: ${{ matrix.build }}
CIBW_ARCHS: ${{ matrix.arch }}
Expand Down
18 changes: 8 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repos:
rev: "1.19.1"
hooks:
- id: blacken-docs
additional_dependencies: [black==23.*]
additional_dependencies: [black==24.*]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
Expand All @@ -31,26 +31,24 @@ repos:
additional_dependencies: [pyyaml]

- repo: https://github.com/rbubley/mirrors-prettier
rev: "v3.3.3"
rev: "v3.4.2"
hooks:
- id: prettier
types_or: [yaml, markdown, html, css, scss, javascript, json]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.7.2"
rev: "v0.9.2"
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
types_or: [python, pyi, jupyter]
- id: ruff-format
types_or: [python, pyi, jupyter]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.13.0
rev: v1.14.1
hooks:
- id: mypy
files: ^src
additional_dependencies: [numpy~=1.26.0, pytest, uhi]
additional_dependencies: [numpy~=2.2.0, pytest, uhi]

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
Expand All @@ -68,7 +66,7 @@ repos:
exclude: .pre-commit-config.yaml

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.3
rev: v19.1.7
hooks:
- id: clang-format
types_or: [c++]
Expand All @@ -81,12 +79,12 @@ repos:
- id: rst-inline-touching-normal

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.29.4
rev: 0.31.0
hooks:
- id: check-readthedocs
- id: check-github-workflows

- repo: https://github.com/henryiii/validate-pyproject-schema-store
rev: 2024.10.21
rev: 2025.01.10
hooks:
- id: validate-pyproject
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.24...3.29)
cmake_minimum_required(VERSION 3.24...3.31)

project(BOOST_HISTOGRAM LANGUAGES CXX)
# Version is added later
Expand Down
6 changes: 2 additions & 4 deletions docs/user-guide/subclassing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ When you subclass, you will need to add a family. Any object can be used - the m
import my_package


class Histogram(bh.Histogram, family=my_package):
...
class Histogram(bh.Histogram, family=my_package): ...


class Regular(bh.axis.Regular, family=my_package):
...
class Regular(bh.axis.Regular, family=my_package): ...

If you only override ``Histogram``, you can leave off the ``family=`` argument, or set it to ``None``. It will generate a private ``object()`` in this case. You must add an explicit family to ``Histogram`` if you subclass any further components.

Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file lets you quickly build projects with the exact same boost-histogram
# settings that the Python bindings use.

cmake_minimum_required(VERSION 3.14...3.20)
cmake_minimum_required(VERSION 3.24...3.31)

project(BOOST_HISTOGRAM_CPP LANGUAGES CXX)

Expand Down
2 changes: 1 addition & 1 deletion examples/simple_weight.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
# Iterate over bins and access bin counter
for idx, (lower, upper) in enumerate(h.axes[0]):
val = h[idx]
print(f"bin {idx} in [{lower:g}, {upper:g}): {val.value} +/- {val.variance**.5}")
print(f"bin {idx} in [{lower:g}, {upper:g}): {val.value} +/- {val.variance**0.5}")
4 changes: 2 additions & 2 deletions include/bh_python/register_axis.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ auto vectorize_index(int (bh::axis::category<T, metadata_t, Options>::*pindex)(c
throw pybind11::key_error(py::str("{!r} not in axis").format(vp[i]));
}

return std::move(indices);
return indices;
};
}

Expand Down Expand Up @@ -131,7 +131,7 @@ auto vectorize_value(R (bh::axis::category<U, metadata_t, Options>::*pvalue)(int
values, k, i < self.size() ? py::cast(value(self, i)) : py::none());
}

return std::move(values);
return values;
};
}

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ test-skip = [
"cp*-musllinux_*", # Segfaults
"cp313t-*win*",
]
free-threaded-support = true
enable = ["cpython-freethreading", "pypy"]
environment-pass = ["SETUPTOOLS_SCM_PRETEND_VERSION"]
environment.PIP_ONLY_BINARY = "numpy"
environment.PIP_PREFER_BINARY = "1"
Expand Down
10 changes: 5 additions & 5 deletions src/boost_histogram/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@
"Histogram",
"IndexingExpr",
"Kind",
"axis",
"storage",
"__version__",
"accumulators",
"numpy",
"axis",
"loc",
"numpy",
"overflow",
"rebin",
"storage",
"sum",
"underflow",
"overflow",
"__version__",
)


Expand Down
8 changes: 4 additions & 4 deletions src/boost_histogram/_internal/axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def _opts(**kwargs: bool) -> set[str]:
# Contains common methods and properties to all axes
@set_module("boost_histogram.axis")
class Axis:
__slots__ = ("_ax", "__dict__")
__slots__ = ("__dict__", "_ax")
_family: object

def __init_subclass__(cls, *, family: object) -> None:
Expand Down Expand Up @@ -234,21 +234,21 @@ def __getitem__(self, i: AxCallOrInt) -> int | str | tuple[float, float]:

@property
def edges(self) -> np.typing.NDArray[Any]:
return self._ax.edges # type: ignore[no-any-return]
return self._ax.edges

@property
def centers(self) -> np.typing.NDArray[Any]:
"""
An array of bin centers.
"""
return self._ax.centers # type: ignore[no-any-return]
return self._ax.centers

@property
def widths(self) -> np.typing.NDArray[Any]:
"""
An array of bin widths.
"""
return self._ax.widths # type: ignore[no-any-return]
return self._ax.widths


# Contains all common methods and properties for Regular axes
Expand Down
Loading
Loading