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

Remove setup.py #715

Merged
merged 5 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[flake8]
max-line-length = 120
ignore = W503, E226, E241
per-file-ignores =
*/__init__.py: F401
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 3.19)

project(BasixFull VERSION "0.8.0.0" LANGUAGES CXX)
set(BASIX_FULL_SKBUILD TRUE)
add_subdirectory(cpp)
add_subdirectory(python)
34 changes: 25 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[build-system]
requires = ["nanobind>=1.5.1", "cmake>=3.19", "scikit-build-core"]
build-backend = "scikit_build_core.build"

[project]
name = "fenics-basix"
version = "0.8.0.dev0"
Expand All @@ -9,6 +13,11 @@ authors = [{email="fenics-dev@googlegroups.com"}, {name="FEniCS Project"}]
packages = ["basix"]
dependencies = ["numpy>=1.21"]

[project.urls]
homepage = "https://fenicsproject.org"
repository = "https://github.com/fenics/basix.git"
documentation = "https://docs.fenicsproject.org"

[project.optional-dependencies]
docs = ["markdown", "pylit3", "pyyaml", "sphinx==5.0.2", "sphinx_rtd_theme"]
lint = ["flake8", "pydocstyle", "isort"]
Expand All @@ -18,28 +27,26 @@ ci = ["mypy", "pytest-xdist", "fenics-basix[docs,lint,test,optional]"]

[tool.pytest.ini_options]
testpaths = ["test"]
# addopts = "-n auto --durations 20"

[build-system]
requires = ["nanobind>=1.5.1", "cmake>=3.19", "scikit-build-core"]
build-backend = "scikit_build_core.build"

[tool.scikit-build]
wheel.packages = ["python/basix"]

[tool.cibuildwheel]
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"]

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",
]
test-command = [
"cmake -G Ninja -DPython3_EXECUTABLE=$(which python) -B build-dir -S {project}/test/test_cmake",
"cmake --build build-dir/",
"build-dir/a.out",
"python -m pytest -v -n auto --durations 20 {project}/test/"
"python -m pytest -v -n auto --durations 20 {project}/test/",
]
test-requires = ["pytest-xdist"]
test-extras = ["test"]
test-skip = "*-macosx_arm64 *-*linux_aarch64"

manylinux-x86_64-image = "manylinux_2_28"

[tool.cibuildwheel.linux]
Expand All @@ -49,3 +56,12 @@ before-build = "yum -y update && yum install -y epel-release && yum install -y o
[tool.cibuildwheel.macos]
archs = ["x86_64", "arm64"] # Forces arm64 build on x86_64 runner using cross-compilation.
before-build = "export HOMEBREW_AUTO_UPDATING=0 && brew update && brew install ninja"

[tool.pydocstyle]
convention = "google"

[tool.mypy]
ignore_missing_imports = true

[tool.isort]
line_length = 120
15 changes: 10 additions & 5 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,23 @@ target_link_libraries(_basixcpp PRIVATE Basix::basix)
# Add strict compiler flags
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-Wall -Werror -Wextra -Wno-comment -pedantic" HAVE_PEDANTIC)

if(HAVE_PEDANTIC)
target_compile_options(_basixcpp PRIVATE -Wall;-Wextra;-Werror;-Wno-comment)
endif()

# scikit-build specific steps
if(SKBUILD)
# Add relative rpath so _basixcpp can find the Basix::basix library
# when the build is relocated
# Add relative rpath so _basixcpp can find the Basix::basix library
# when the build is relocated
if(BASIX_FULL_SKBUILD)
if(APPLE)
set_target_properties(_basixcpp PROPERTIES INSTALL_RPATH "@loader_path/lib")
else()
set_target_properties(_basixcpp PROPERTIES INSTALL_RPATH "$ORIGIN/lib")
endif()
install(TARGETS _basixcpp DESTINATION basix)
else()
get_target_property(_location Basix::basix LOCATION)
get_filename_component(_basix_dir ${_location} DIRECTORY)
set_target_properties(_basixcpp PROPERTIES INSTALL_RPATH ${_basix_dir})
endif()

install(TARGETS _basixcpp LIBRARY DESTINATION basix)
25 changes: 22 additions & 3 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
[build-system]
# We require that the user installs cmake
requires = ["setuptools>=42", "wheel", "nanobind>=1.5.1", "cmake>=3.19"]
requires = ["scikit-build-core", "nanobind>=1.5.1", "cmake>=3.19"]
build-backend = "scikit_build_core.build"

build-backend = "setuptools.build_meta"
[project]
name = "fenics-basix"
version = "0.8.0.dev0"
description = "Basix Python interface"
readme = "../README.md"
requires-python = ">=3.8.0"
license = {file = "../LICENSE"}
authors = [{email="fenics-dev@googlegroups.com"}, {name="FEniCS Project"}]
packages = ["basix"]
dependencies = ["numpy>=1.21"]

[project.optional-dependencies]
docs = ["markdown", "pylit3", "pyyaml", "sphinx==5.0.2", "sphinx_rtd_theme"]
lint = ["flake8", "pydocstyle", "isort"]
optional = ["numba", "fenics-ufl@git+https://github.com/fenics/ufl"]
test = ["pytest", "sympy", "scipy", "matplotlib", "fenics-basix[optional]"]
ci = ["mypy", "pytest-xdist", "fenics-basix[docs,lint,test,optional]"]

[tool.scikit-build]
wheel.packages = ["basix"]
97 changes: 0 additions & 97 deletions python/setup.py

This file was deleted.

14 changes: 0 additions & 14 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,14 +0,0 @@
[flake8]
max-line-length = 120
ignore = W503, E226, E241
per-file-ignores =
*/__init__.py: F401

[pydocstyle]
convention = google

[mypy]
ignore_missing_imports = True

[isort]
line_length = 120
Loading