Skip to content

Commit

Permalink
feat: support Python 3.13t (#950)
Browse files Browse the repository at this point in the history
* feat: support Python 3.13t

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* ci: use numpy 2.1.0rc1

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* ci: try adding quotes

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Update pyproject.toml

* Update pyproject.toml

* fix: use latest pybind11

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* WIP: try pybind11 PR

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Update pyproject.toml

* Update CMakeLists.txt

* Update pyproject.toml

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii committed Aug 13, 2024
1 parent 8ded2db commit e5d2f8d
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 26 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:

- name: Install NumPy pre-release
if: matrix.python-version == '3.13'
run: uv pip install --system numpy --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple --prerelease=allow
run: uv pip install --system "numpy>=2.1.0rc1"

- name: Install python tools
run: uv pip install --system -r dev-requirements.txt pytest-github-actions-annotate-failures
Expand All @@ -105,22 +105,24 @@ jobs:
run: python -m pytest -ra

build_wheels:
name: ${{ matrix.build }}
name: ${{ matrix.only }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
build: cp313-manylinux_x86_64
only: cp313t-manylinux_x86_64
- os: ubuntu-latest
only: cp313-manylinux_x86_64
- os: windows-2019
build: cp38-win32
only: cp38-win32
- os: windows-2019
build: cp37-win_amd64
only: cp37-win_amd64
- os: macos-13
build: cp39-macosx_x86_64
only: cp39-macosx_x86_64
- os: macos-14
build: cp39-macosx_arm64
only: cp39-macosx_arm64

steps:
- uses: actions/checkout@v4
Expand All @@ -131,8 +133,9 @@ jobs:
- uses: yezz123/setup-uv@v4

- uses: pypa/cibuildwheel@v2.20
with:
only: "${{ matrix.only }}"
env:
CIBW_BUILD: "${{ matrix.build }}"
CIBW_BUILD_VERBOSITY: 1

- uses: actions/upload-artifact@v4
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,5 @@ compile_commands.json

# Nox
.nox/*
/*venv*
/build
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ set(Python_ARTIFACTS_INTERACTIVE TRUE)
FetchContent_Declare(
pybind11
GIT_REPOSITORY https://github.com/pybind/pybind11.git
GIT_TAG 3e9dfa2866941655c56877882565e7577de6fc7b # v2.12.0
GIT_TAG bd67643652d3800837f1f41549a2a5adbaa3fafe # v2.13.3
FIND_PACKAGE_ARGS NAMES pybind11)
FetchContent_MakeAvailable(pybind11)

Expand Down
28 changes: 12 additions & 16 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["scikit-build-core>=0.10", "pybind11>=2.12"]
requires = ["scikit-build-core>=0.10", "pybind11>=2.13.3"]
build-backend = "scikit_build_core.build"

[project]
Expand Down Expand Up @@ -116,7 +116,7 @@ sdist.exclude = [
[[tool.scikit-build.generate]]
path = "boost_histogram/version.py"
template = '''
__version__ = version = '$version'
__version__ = version = "$version"
'''


Expand Down Expand Up @@ -164,31 +164,27 @@ ignore_missing_imports = true
build-frontend = "build[uv]"
test-extras = "test"
test-command = "pytest --benchmark-disable {project}/tests"
test-skip = [
"pp310-*",
"*universal2:arm64",
"cp*-*musllinux*", # segfault
"cp313*linux_aarch64", # No NumPy available yet
]
skip = [
"pp37-*",
"pp38-*",
"pp3[78]-*",
"cp313t-*win*"
]
environment-pass = ["SETUPTOOLS_SCM_PRETEND_VERSION", "PIP_EXTRA_INDEX_URL"]
test-skip = [
"cp*-musllinux_*", # Segfaults
"pp310-macosx_arm64", # No binary (numpy 2.1.0 rc 1)
]
free-threaded-support = true
environment-pass = ["SETUPTOOLS_SCM_PRETEND_VERSION"]
environment.PIP_ONLY_BINARY = "numpy"
environment.PIP_PREFER_BINARY = "1"

[[tool.cibuildwheel.overrides]]
select = "*pyodide*"
inherit.environment = "append"
environment.CFLAGS = "-fexceptions"
environment.LDFLAGS = "-fexceptions"
build-frontend = {name = "build", args = ["--exports", "whole_archive"]}

[[tool.cibuildwheel.overrides]]
select = "cp313*"
inherit.environment = "append"
before-test = "uv pip install --index-url=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple --prerelease=allow numpy"
select = ["cp313*", "pp310*"]
before-test = 'uv pip install --only-binary=:all: "numpy>=2.1.0rc1"'


[tool.pylint]
Expand Down
2 changes: 1 addition & 1 deletion src/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ void register_histograms(py::module&);
void register_accumulators(py::module&);
void register_transforms(py::module&);

PYBIND11_MODULE(_core, m) {
PYBIND11_MODULE(_core, m, py::mod_gil_not_used()) {
py::module storage = m.def_submodule("storage");
register_storages(storage);

Expand Down

0 comments on commit e5d2f8d

Please sign in to comment.