Skip to content

Commit 0fc130f

Browse files
Use scikit-build-core and pyproject.toml for top-level install (#673)
* Try out scikit-build-core * Install checking packages * Disable mypy * Config update * pytest-xdist * dependencies * In right place... * Install optional dependencies * Add scipy * Sort out package name * Tweak * More tweaking * Add sphinx * Add markdown * yaml * pyyaml * pylit * Revert python folder * Path with SKbuild * Use ci tag for Mac build * Use CI tag * remove ffcx test - should be in ffcx not here * Break up optional dependencies * Copy over from setup.py * Try re-enabling mypy * Remove macos-11, C++ compiler too old. * Bump cibuildwheel action and use build to create sdist. * Push. * Make Python 3.8 the minimum * Typo. * Try buildjet for arm64 linux. * Revert "Try buildjet for arm64 linux." This reverts commit f938ae6. --------- Co-authored-by: Jack S. Hale <[email protected]>
1 parent b082121 commit 0fc130f

File tree

6 files changed

+44
-50
lines changed

6 files changed

+44
-50
lines changed

.github/workflows/build-wheels.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
runs-on: ${{ matrix.os }}
4141
strategy:
4242
matrix:
43-
os: [ubuntu-latest, macos-11, macos-12]
43+
os: [ubuntu-latest, macos-12, macos-13]
4444

4545
steps:
4646
- uses: actions/checkout@v3
@@ -54,7 +54,7 @@ jobs:
5454
platforms: arm64
5555

5656
- name: Build wheels
57-
uses: pypa/cibuildwheel@v2.11.1
57+
uses: pypa/cibuildwheel@v2.13.0
5858

5959
- name: Upload artifacts
6060
uses: actions/upload-artifact@v3
@@ -68,12 +68,15 @@ jobs:
6868
- uses: actions/checkout@v3
6969
with:
7070
ref: ${{ github.event.inputs.basix_ref }}
71+
72+
- name: Upgrade pip
73+
run: python -m pip install --upgrade pip setuptools
7174

72-
- name: Install skbuild
73-
run: python -m pip install scikit-build
75+
- name: Install build
76+
run: python -m pip install build
7477

7578
- name: Build sdist
76-
run: python setup.py sdist --formats=gztar
79+
run: python -m build --sdist .
7780

7881
- uses: actions/upload-artifact@v3
7982
with:

.github/workflows/ffcx-tests.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,5 @@ jobs:
6565

6666
- name: Install FFCx
6767
run: python3 -m pip install ./ffcx[ci]
68-
- name: Run mypy checks
69-
run: python3 -m mypy ffcx/ffcx
7068
- name: Run FFCx tests
7169
run: python3 -m pytest -n auto ffcx/test

cpp/CMakeLists.txt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.16)
1+
cmake_minimum_required(VERSION 3.19)
22

33
# Set the version
44
project(Basix VERSION "0.7.0.0" LANGUAGES CXX)
@@ -8,7 +8,8 @@ if(SKBUILD)
88
# Always use lib/ in the Python root. Otherwise, environment used for
99
# wheels might place in lib64/, which CMake on some systems will not
1010
# find.
11-
set(CMAKE_INSTALL_LIBDIR lib)
11+
set(CMAKE_INSTALL_LIBDIR basix/lib)
12+
set(CMAKE_INSTALL_INCLUDEDIR basix/include)
1213
endif()
1314

1415
include(FeatureSummary)
@@ -92,14 +93,11 @@ target_sources(basix PRIVATE
9293
set_target_properties(basix PROPERTIES PUBLIC_HEADER basix/finite-element.h)
9394
set_target_properties(basix PROPERTIES PRIVATE_HEADER "${HEADERS_basix}")
9495
target_include_directories(basix PUBLIC
95-
$<INSTALL_INTERFACE:include>
96+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
9697
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_SOURCE_DIR}>")
9798

98-
# The commented lines need CMake >= 3.18
99-
# target_link_libraries(basix PRIVATE BLAS::BLAS)
100-
# target_link_libraries(basix PRIVATE LAPACK::LAPACK)
101-
target_link_libraries(basix PRIVATE ${BLAS_LIBRARIES})
102-
target_link_libraries(basix PRIVATE ${LAPACK_LIBRARIES})
99+
target_link_libraries(basix PRIVATE BLAS::BLAS)
100+
target_link_libraries(basix PRIVATE LAPACK::LAPACK)
103101

104102
# Set compiler flags
105103
list(APPEND BASIX_DEVELOPER_FLAGS -O2;-g;-pipe)

pyproject.toml

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,35 @@
1+
[project]
2+
name = "fenics-basix"
3+
version = "0.7.0.dev0"
4+
description = "Basix Python interface"
5+
readme = "README.md"
6+
requires-python = ">=3.8.0"
7+
license = {file = "LICENSE"}
8+
authors = [{email="[email protected]"}, {name="FEniCS Project"}]
9+
packages = ["basix"]
10+
dependencies = ["numpy>=1.21"]
11+
12+
[project.optional-dependencies]
13+
docs = ["markdown", "pylit3", "pyyaml", "sphinx==5.0.2", "sphinx_rtd_theme"]
14+
lint = ["flake8", "pydocstyle"]
15+
optional = ["numba", "fenics-ufl@git+https://github.com/fenics/ufl"]
16+
test = ["pytest", "sympy", "scipy", "matplotlib", "fenics-basix[optional]"]
17+
ci = ["mypy", "pytest-xdist", "fenics-basix[docs]", "fenics-basix[lint]",
18+
"fenics-basix[optional]", "fenics-basix[test]"]
19+
20+
[tool.pytest.ini_options]
21+
testpaths = ["test"]
22+
# addopts = "-n auto --durations 20"
23+
124
[build-system]
2-
requires = ["setuptools>=42", "wheel", "pybind11>=2.9.1", "cmake>=3.16", "scikit-build>=0.12"]
25+
requires = ["pybind11>=2.9.1", "cmake>=3.19", "scikit-build-core"]
26+
build-backend = "scikit_build_core.build"
327

4-
build-backend = "setuptools.build_meta"
28+
[tool.scikit-build]
29+
wheel.packages = ["python/basix"]
530

631
[tool.cibuildwheel]
7-
build = ["cp{37,38,39}-manylinux_x86_64", "cp{37,38,39}-manylinux_aarch64", "cp{37,38,39}-macosx_x86_64", "cp{38,39}-macosx_arm64"]
32+
build = ["cp{38,39,310}-manylinux_x86_64", "cp{38,39,310}-manylinux_aarch64", "cp{38,39,310}-macosx_x86_64", "cp{38,39,310}-macosx_arm64"]
833

934
test-command = [
1035
"cmake -G Ninja -DPython3_EXECUTABLE=$(which python) -B build-dir -S {project}/test/test_cmake",
@@ -16,7 +41,7 @@ test-requires = ["pytest-xdist"]
1641
test-extras = ["test"]
1742
test-skip = "*-macosx_arm64 *-*linux_aarch64"
1843

19-
manylinux-x86_64-image = "manylinux2014"
44+
manylinux-x86_64-image = "manylinux_2_28"
2045

2146
[tool.cibuildwheel.linux]
2247
archs = ["x86_64", "aarch64"] # Forces arm64 build on x86_64 runner using emulation.

python/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,5 @@ if (SKBUILD)
6363
set_target_properties(_basixcpp PROPERTIES INSTALL_RPATH "$ORIGIN/lib")
6464
endif()
6565

66-
install(TARGETS _basixcpp DESTINATION .)
66+
install(TARGETS _basixcpp DESTINATION basix)
6767
endif()

setup.py

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)