Skip to content

Commit

Permalink
feat: move to scikit-build-core
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed Oct 9, 2023
1 parent 18db55d commit 5383b36
Show file tree
Hide file tree
Showing 8 changed files with 128 additions and 188 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ jobs:

- uses: pypa/[email protected]
env:
CIBW_BUILD: cp38-win32 cp312-manylinux_x86_64 cp37-macosx_x86_64
CIBW_BUILD: cp38-win32 cp312-manylinux_x86_64 cp38-macosx_universal2
CIBW_BUILD_VERBOSITY: 1
CIBW_ENVIRONMENT: "PIP_ONLY_BINARY=:all:"

Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [windows-2019, macos-latest, ubuntu-latest]
os: [windows-2019, ubuntu-latest]
arch: [auto64]

include:
Expand All @@ -101,6 +101,10 @@ jobs:
- os: windows-2019
arch: auto32

- os: macos-latest
arch: auto64
build: cp37*

steps:
- uses: actions/checkout@v4
with:
Expand Down
38 changes: 23 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.10...3.26)
cmake_minimum_required(VERSION 3.15...3.26)

project(BOOST_HISTOGRAM LANGUAGES CXX)
# Version is added later
Expand Down Expand Up @@ -154,7 +154,8 @@ set_property(TARGET _core PROPERTY LIBRARY_OUTPUT_DIRECTORY "$<1:boost_histogram
# Collect all the python files and symlink them (3.14+) or copy them (3.12-3.13)
# into the build directory
# Protects from in-source builds (don't do this, please)
if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}" AND NOT DEFINED
SKBUILD)
file(
GLOB_RECURSE BOOST_HIST_PY_FILES
LIST_DIRECTORIES false
Expand All @@ -174,15 +175,20 @@ if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
endif()

# Support installing
install(DIRECTORY "src/boost_histogram" DESTINATION ".")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/boost_histogram/version.py"
DESTINATION "boost_histogram")
install(TARGETS _core DESTINATION "boost_histogram")

# Tests (Requires pytest to be available to run)
include(CTest)
if(NOT DEFINED SKBUILD)
install(DIRECTORY "src/boost_histogram" DESTINATION ".")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/boost_histogram/version.py"
DESTINATION "boost_histogram")

if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/boost_histogram/version.py")
# Tests (Requires pytest to be available to run)
include(CTest)
endif()

if(DEFINED SKBUILD)
# Don't worry about the version
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/boost_histogram/version.py")
set(VERSION_REGEX [=[version[ \t]*=[ \t]*["']([0-9]+\.[0-9]+\.[0-9]+)]=])
# Read in the line containing the version
Expand Down Expand Up @@ -220,12 +226,14 @@ else()
message(STATUS "Full version output: ${VERSION_FULL_STRING}")
endif()
project(
BOOST_HISTOGRAM
LANGUAGES CXX
VERSION ${VERSION_STRING})
message(STATUS "boost-histogram ${BOOST_HISTOGRAM_VERSION}")
if(NOT DEFINED SKBUILD)
project(
BOOST_HISTOGRAM
LANGUAGES CXX
VERSION ${VERSION_STRING})
message(STATUS "boost-histogram ${BOOST_HISTOGRAM_VERSION}")
if(BUILD_TESTING)
add_subdirectory(tests)
if(BUILD_TESTING)
add_subdirectory(tests)
endif()
endif()
26 changes: 0 additions & 26 deletions MANIFEST.in

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ platforms have wheels provided in boost-histogram:
| ManyLinux2014 | 64-bit | 3.7, 3.8, 3.9, 3.10, 3.11, 3.12 | 3.7, 3.8, 3.9, 3.10 |
| ManyLinux2014 | ARM64 | 3.7, 3.8, 3.9, 3.10, 3.11, 3.12 | 3.7, 3.8, 3.9, 3.10 |
| MuslLinux_1_1 | 64-bit | 3.7, 3.8, 3.9, 3.10, 3.11, 3.12 | |
| macOS 10.9+ | 64-bit | 3.7, 3.8, 3.9, 3.10, 3.11, 3.12 | 3.7, 3.8, 3.9, 3.10 |
| macOS 10.9+ | 64-bit | 3.7 | 3.7, 3.8, 3.9, 3.10 |
| macOS Universal2 | Arm64 | 3.8, 3.9, 3.10, 3.11, 3.12 | |
| Windows | 32 & 64-bit | 3.7, 3.8, 3.9, 3.10, 3.11, 3.12 | |
| Windows | 64-bit | | 3.7, 3.8, 3.9, 3.10 |
Expand Down
102 changes: 98 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,106 @@
[build-system]
requires = [
"setuptools>=45",
"setuptools_scm[toml]>=4.1.2",
requires = ["scikit-build-core[pyproject]"]
build-backend = "scikit_build_core.build"

[project]
name = "boost-histogram"
dynamic = ["version"]
description = "The Boost::Histogram Python wrapper."
readme = "README.md"
requires-python = ">=3.7"
authors = [
{ name = "Hans Dembinski and Henry Schreiner", email = "[email protected]" },
]
keywords = [
"boost-histogram",
"histogram",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Operating System :: Unix",
"Programming Language :: C++",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: Python",
"Topic :: Scientific/Engineering :: Information Analysis",
"Topic :: Scientific/Engineering :: Mathematics",
"Topic :: Scientific/Engineering :: Physics",
"Topic :: Scientific/Engineering",
"Topic :: Software Development",
"Topic :: Utilities",
"Typing :: Typed",
]
dependencies = [
"numpy;python_version<'3.12'",
"numpy>=1.26.0b1;python_version>='3.12'",
"typing-extensions;python_version<'3.8'",
]

[project.optional-dependencies]
dev = [
"cloudpickle",
"hypothesis>=6.0",
"ipykernel",
"pytest-benchmark",
"pytest>=6.0",
"typer",
]
docs = [
"myst_parser>=0.13",
"nbsphinx",
"sphinx-book-theme>=0.0.33",
"Sphinx>=4.0",
"sphinx_copybutton",
]
build-backend = "setuptools.build_meta"
examples = [
"matplotlib",
"netCDF4",
"numba",
"uproot3",
"xarray",
"xhistogram",
]
test = [
"cloudpickle",
"hypothesis>=6.0",
"pytest-benchmark",
"pytest>=6.0",
]

[project.urls]
"Bug Tracker" = "https://github.com/scikit-hep/boost-histogram/issues"
Changelog = "https://boost-histogram.readthedocs.io/en/latest/CHANGELOG.html"
Chat = " https://gitter.im/HSF/PyHEP-histogramming"
Discussions = "https://github.com/scikit-hep/boost-histogram/discussions"
Documentation = "https://boost-histogram.readthedocs.io/"
Homepage = "https://github.com/scikit-hep/boost-histogram"


[tool.scikit-build]
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"
sdist.include = ["src/boost_histogram/version.py"]
wheel.expand-macos-universal-tags = true


[tool.setuptools_scm]
write_to = "src/boost_histogram/version.py"


[tool.pytest.ini_options]
minversion = "6.0"
junit_family = "xunit2"
Expand Down Expand Up @@ -94,6 +187,7 @@ test-skip = [
skip = ["pp*-manylinux_i686", "cp312-win32"] # not supported by NumPy
environment-pass = ["SETUPTOOLS_SCM_PRETEND_VERSION"]
environment = { PIP_ONLY_BINARY = "numpy" }
macos.archs = ["universal2"]


[tool.pylint]
Expand Down
67 changes: 0 additions & 67 deletions setup.cfg

This file was deleted.

73 changes: 0 additions & 73 deletions setup.py

This file was deleted.

0 comments on commit 5383b36

Please sign in to comment.