1{ lib
2, asdf-standard
3, asdf-transform-schemas
4, astropy
5, buildPythonPackage
6, fetchFromGitHub
7, fetchpatch
8, importlib-resources
9, jmespath
10, jsonschema
11, lz4
12, numpy
13, packaging
14, pytest-astropy
15, pytestCheckHook
16, pythonOlder
17, pyyaml
18, semantic-version
19, setuptools-scm
20}:
21
22buildPythonPackage rec {
23 pname = "asdf";
24 version = "2.13.0";
25 format = "pyproject";
26
27 disabled = pythonOlder "3.8";
28
29 src = fetchFromGitHub {
30 owner = "asdf-format/";
31 repo = pname;
32 rev = "refs/tags/${version}";
33 hash = "sha256-u8e7ot5NDRqQFH0eLVnGinBQmQD73BlR5K9HVjA7SIg=";
34 };
35
36 SETUPTOOLS_SCM_PRETEND_VERSION = version;
37
38 patches = [
39 # Fix default validation, https://github.com/asdf-format/asdf/pull/1203
40 (fetchpatch {
41 name = "default-validation.patch";
42 url = "https://github.com/asdf-format/asdf/commit/6f79f620b4632e20178d9bd53528702605d3e976.patch";
43 sha256 = "sha256-h/dYhXRCf5oIIC+u6+8C91mJnmEzuNmlEzqc0UEhLy0=";
44 excludes = [
45 "CHANGES.rst"
46 ];
47 })
48 ];
49
50 postPatch = ''
51 # https://github.com/asdf-format/asdf/pull/1203
52 substituteInPlace pyproject.toml \
53 --replace "'jsonschema >=4.0.1, <4.10.0'," "'jsonschema >=4.0.1',"
54 '';
55
56 nativeBuildInputs = [
57 setuptools-scm
58 ];
59
60 propagatedBuildInputs = [
61 asdf-standard
62 asdf-transform-schemas
63 jmespath
64 jsonschema
65 numpy
66 packaging
67 pyyaml
68 semantic-version
69 ] ++ lib.optionals (pythonOlder "3.9") [
70 importlib-resources
71 ];
72
73 checkInputs = [
74 astropy
75 lz4
76 pytest-astropy
77 pytestCheckHook
78 ];
79
80 preCheck = ''
81 export PY_IGNORE_IMPORTMISMATCH=1
82 '';
83
84 pythonImportsCheck = [
85 "asdf"
86 ];
87
88 disabledTests = [
89 "config.rst"
90 ];
91
92 meta = with lib; {
93 description = "Python tools to handle ASDF files";
94 homepage = "https://github.com/asdf-format/asdf";
95 license = licenses.bsd3;
96 maintainers = with maintainers; [ costrouc ];
97 };
98}