1{
2 lib,
3 black,
4 buildPythonPackage,
5 cachecontrol,
6 fetchFromGitHub,
7 fetchpatch,
8 importlib-resources,
9 mistune,
10 mypy,
11 mypy-extensions,
12 pytestCheckHook,
13 pythonOlder,
14 rdflib,
15 requests,
16 ruamel-yaml,
17 setuptools-scm,
18 types-dataclasses,
19 types-requests,
20 types-setuptools,
21}:
22
23buildPythonPackage rec {
24 pname = "schema-salad";
25 version = "8.5.20240503091721";
26 pyproject = true;
27
28 disabled = pythonOlder "3.8";
29
30 src = fetchFromGitHub {
31 owner = "common-workflow-language";
32 repo = "schema_salad";
33 rev = "refs/tags/${version}";
34 hash = "sha256-VbEIkWzg6kPnJWqbvlfsD83oS0VQasGQo+pUIPiGjhU=";
35 };
36
37 postPatch = ''
38 substituteInPlace pyproject.toml \
39 --replace-fail "black>=19.10b0,<23.12" "black>=19.10b0"
40 '';
41
42 build-system = [ setuptools-scm ];
43
44 dependencies =
45 [
46 cachecontrol
47 mistune
48 mypy
49 mypy-extensions
50 rdflib
51 requests
52 ruamel-yaml
53 types-dataclasses
54 types-requests
55 types-setuptools
56 ]
57 ++ cachecontrol.optional-dependencies.filecache
58 ++ lib.optionals (pythonOlder "3.9") [ importlib-resources ];
59
60 patches = [ (fetchpatch {
61 url = "https://patch-diff.githubusercontent.com/raw/common-workflow-language/schema_salad/pull/840.patch";
62 hash = "sha256-fke75FCCn23LAMJ5bDWJpuBR6E9XIpjmzzXSbjqpxn8=";
63 } ) ];
64
65 nativeCheckInputs = [ pytestCheckHook ] ++ passthru.optional-dependencies.pycodegen;
66
67 preCheck = ''
68 rm tox.ini
69 '';
70
71 disabledTests = [
72 "test_load_by_yaml_metaschema"
73 # Setup for these tests requires network access
74 "test_secondaryFiles"
75 "test_outputBinding"
76 # Test requires network
77 "test_yaml_tab_error"
78 "test_bad_schemas"
79 ];
80
81 pythonImportsCheck = [ "schema_salad" ];
82
83 passthru.optional-dependencies = {
84 pycodegen = [ black ];
85 };
86
87 meta = with lib; {
88 description = "Semantic Annotations for Linked Avro Data";
89 homepage = "https://github.com/common-workflow-language/schema_salad";
90 changelog = "https://github.com/common-workflow-language/schema_salad/releases/tag/${version}";
91 license = with licenses; [ asl20 ];
92 maintainers = with maintainers; [ veprbl ];
93 };
94}