Skip to content
Open
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
14 changes: 5 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
[build-system]
requires = ["scikit-build-core", "numpy", "f90wrap==0.2.16"]
requires = ["scikit-build-core", "numpy", "f90wrap"]
build-backend = "scikit_build_core.build"

[project]
name = "pysimple"
version = "1.2.0"
dependencies = ["numpy"]
dependencies = ["numpy", "f90wrap"]
classifiers = [
"License :: OSI Approved :: MIT License",
]

[tool.scikit-build]
build-dir = "build"
build.verbose = true
cmake.define.CMAKE_CACHE_DIR = "build"
build-dir = "_skbuild"
wheel.packages = ["python/pysimple"]
wheel.install-dir = "pysimple"
wheel.exclude = []

[project.package-data]
pysimple = ["data/*.dat"]
wheel.exclude = ["**/__pycache__/**", "**/*.pyc"]
sdist.include = ["python/pysimple/data/*.dat"]
9 changes: 9 additions & 0 deletions python/pysimple/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@
try:
import simple_backend as _backend
except ImportError as exc:
if getattr(exc, "name", None) == "f90wrap":
raise ImportError(
"f90wrap is required to import SIMPLE Python bindings. Install f90wrap."
) from exc
if getattr(exc, "name", None) == "_simple_backend":
raise ImportError(
"Fortran extension _simple_backend failed to import. "
"Rebuild SIMPLE with Python bindings enabled."
) from exc
raise ImportError(
"simple_backend module not found. Build SIMPLE with Python bindings enabled."
) from exc
Expand Down
9 changes: 9 additions & 0 deletions python/pysimple/_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ def _load_backend() -> ModuleType:
try:
_BACKEND = import_module("simple_backend")
except ImportError as exc: # pragma: no cover - exercised in test skips
if getattr(exc, "name", None) == "f90wrap":
raise ImportError(
"f90wrap is required to import SIMPLE Python bindings. Install f90wrap."
) from exc
if getattr(exc, "name", None) == "_simple_backend":
raise ImportError(
"Fortran extension _simple_backend failed to import. "
"Rebuild SIMPLE with Python bindings enabled."
) from exc
raise ImportError(
"simple_backend module not found. Build SIMPLE with Python bindings enabled."
) from exc
Expand Down
Loading