1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5
6 # build-system
7 scikit-build-core,
8 cmake,
9 pathspec,
10 ninja,
11 pyproject-metadata,
12 setuptools-scm,
13
14 # dependencies
15 numpy,
16
17 # tests
18 pytestCheckHook,
19 pyyaml,
20}:
21
22buildPythonPackage rec {
23 pname = "spglib";
24 version = "2.5.0";
25 format = "pyproject";
26
27 src = fetchPypi {
28 inherit pname version;
29 hash = "sha256-+LtjiJe+kbnb1MCF2f3h9pBI9ZSeIPODLLlDjldBjUs=";
30 };
31
32 nativeBuildInputs = [
33 scikit-build-core
34 cmake
35 pathspec
36 ninja
37 pyproject-metadata
38 setuptools-scm
39 ];
40
41 dontUseCmakeConfigure = true;
42
43 postPatch = ''
44 # relax v2 constrain in [build-system] intended for binary backward compat
45 substituteInPlace pyproject.toml \
46 --replace-fail "numpy~=2.0" "numpy"
47 '';
48
49 propagatedBuildInputs = [ numpy ];
50
51 nativeCheckInputs = [
52 pytestCheckHook
53 pyyaml
54 ];
55
56 pythonImportsCheck = [ "spglib" ];
57
58 meta = with lib; {
59 description = "Python bindings for C library for finding and handling crystal symmetries";
60 homepage = "https://spglib.github.io/spglib/";
61 changelog = "https://github.com/spglib/spglib/raw/v${version}/ChangeLog";
62 license = licenses.bsd3;
63 maintainers = with maintainers; [ psyanticy ];
64 };
65}