Skip to content

Commit

Permalink
BLD: Build with pyproject.toml and skbuild-core
Browse files Browse the repository at this point in the history
  • Loading branch information
mferrera committed Sep 29, 2023
1 parent 0c97a5a commit a46f823
Show file tree
Hide file tree
Showing 8 changed files with 212 additions and 403 deletions.
7 changes: 0 additions & 7 deletions setup.cfg → .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,3 @@
exclude = docs/conf.py, src/xtgeo/cxtgeo/*.py, .eggs, _skbuild, tests/**/snapshots
max-line-length = 88
ignore = E402, W503, E203, C901

[pydocstyle]
convention = google
match = (?!(test_|_)).*\.py

[aliases]
test = pytest
25 changes: 8 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
# Main CMakeLists.txt file. Most of the work is inside
# the CMakeLists file under add_subdirectory()

cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
if (CMAKE_VERSION VERSION_LESS 3)
project(clib C)
else()
project(clib LANGUAGES C)
endif()


set(CMAKE_VERBOSE_MAKEFILE ON)

if(SKBUILD)
message(STATUS "The project is built using scikit-build")
cmake_minimum_required(VERSION 3.15.3)
project(${SKBUILD_PROJECT_NAME} LANGUAGES C)

if(NOT SKBUILD)
message(
WARNING
"This CMakeLists.txt file should not be used directly.\n"
"Use 'pip install ${CMAKE_SOURCE_DIR}' to install this as a Python package.")
endif()

find_package(PythonExtensions REQUIRED)

add_subdirectory(src/clib)
132 changes: 110 additions & 22 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,101 @@
# NOTE: you have to use single-quoted strings in TOML for regular expressions.
[build-system]
requires = [
"scikit-build-core[pyproject]",
"swig",
"numpy==1.19.2; python_version == '3.8'",
"numpy==1.19.5; python_version == '3.9'",
"numpy==1.21.6; python_version == '3.10'",
"numpy==1.23.5; python_version == '3.11'",
]
build-backend = "scikit_build_core.build"

[tool.scikit-build]
cmake.verbose = true
logging.level = "INFO"
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"
sdist.include = ["src/xtgeo/_theversion.py"]
wheel.install-dir = "xtgeo"

[project]
name = "xtgeo"
description = "XTGeo is a Python library for 3D grids, surfaces, wells, etc"
readme = "README.md"
requires-python = ">=3.8"
license = { text = "LGPL-3.0" }
authors = [
{ name = "Equinor", email = "[email protected]" },
]
keywords = ["grids", "surfaces", "wells", "cubes"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU Lesser General Public",
"License v3 or later (LGPLv3+)",
"Operating System :: POSIX :: Linux",
"Natural Language :: English",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Physics",
"Topic :: Software Development :: Libraries",
"Topic :: Utilities",
]
dynamic = ["version"]
dependencies = [
"deprecation",
"ecl-data-io>=2.1",
"h5py>=3",
"hdf5plugin>=2.3",
"matplotlib>=3.3",
"numpy>=1.19",
"pandas>=1.1",
"roffio>=0.0.2",
"scipy>=1.5",
"segyio>1.8.0",
"shapely>=1.6.2",
"tables;platform_system != 'Darwin'", # TODO: update when fixed for mac
"typing-extensions",
]

[project.urls]
Homepage = "https://github.com/equinor/xtgeo"
Repository = "https://github.com/equinor/xtgeo"
Issues = "https://github.com/equinor/xtgeo/issues"
Documentation = "https://xtgeo.readthedocs.io"

[project.optional-dependencies]
dev = [
"black",
"coverage>=4.1",
"flake8",
"isort",
"hypothesis",
"pylint",
"pytest",
"pytest-benchmark",
"pytest-cov",
"pydocstyle",
"pytest-runner",
"pytest-mock",
"pytest-snapshot",
"pytest-xdist",
]
docs = [
"pydocstyle",
"Sphinx<4.0",
"sphinx-rtd-theme",
"sphinx-toolbox",
"autoclasstoc",
"myst-parser",
]

[tool.black]
line-length = 88
target-version = ['py38', 'py39', 'py310', 'py311']
target-version = ["py38", "py39", "py310", "py311"]
include = '\.pyi?$'
exclude = '''
/(
Expand All @@ -23,28 +116,23 @@ exclude = '''
)/
'''

# numpy version scheme to fulfill Roxar API compatibility:
# RMS 12.1.* --> numpy == 1.19.2 with python 3.8
[tool.pydocstyle]
convention = "google"
match = '(?!(test_|_)).*\.py'

[build-system]
requires = [
"setuptools>=43",
"scikit-build<0.17",
'cmake==3.15.3; python_version >= "3.8" and platform_system == "Linux"',
'cmake==3.18.0; platform_system != "Linux"',
"ninja",
'swig',
"setuptools_scm>=3.2.0",
'numpy==1.19.2; python_version == "3.8"',
'numpy==1.19.5; python_version == "3.9"',
'numpy==1.21.6; python_version == "3.10"',
'numpy==1.23.5; python_version == "3.11"',
'Sphinx<4.0',
'sphinx-rtd-theme',
'sphinx-toolbox',
'autoclasstoc',
'myst-parser',
[tool.pytest.ini_options]
minversion = "6.0"
addopts = "--verbose"
log_cli = "False"
log_cli_format = "%(levelname)8s (%(relativeCreated)6.0fms) %(filename)44s [%(funcName)40s()] %(lineno)4d >> %(message)s"
log_cli_level = "INFO"
testpaths = "tests"
markers = [
"bigtest: A big test not executed by default",
"requires_opm: A test requiring opm in the environment",
"requires_roxar: Test requires to run in RMS python",
]
doctest_optionflags = "ELLIPSIS"

[tool.setuptools_scm]
write_to = "src/xtgeo/_theversion.py"
15 changes: 0 additions & 15 deletions pytest.ini

This file was deleted.

155 changes: 0 additions & 155 deletions scripts/setup_utilities.py

This file was deleted.

Loading

0 comments on commit a46f823

Please sign in to comment.