1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 pythonOlder,
7
8 # builds
9 poetry-core,
10
11 # propagates
12 isodate,
13 pyparsing,
14
15 # extras: networkx
16 networkx,
17
18 # extras: html
19 html5lib,
20
21 # tests
22 pip,
23 pytest-cov-stub,
24 pytestCheckHook,
25 setuptools,
26}:
27
28buildPythonPackage rec {
29 pname = "rdflib";
30 version = "7.1.3";
31 pyproject = true;
32
33 disabled = pythonOlder "3.8";
34
35 src = fetchFromGitHub {
36 owner = "RDFLib";
37 repo = "rdflib";
38 tag = version;
39 hash = "sha256-1ACQ7M+oAoAYXeTnC8osoECOvE8XkGwW/s89Voqed5A=";
40 };
41
42 build-system = [ poetry-core ];
43
44 dependencies = [
45 pyparsing
46 ] ++ lib.optionals (pythonOlder "3.11") [ isodate ];
47
48 optional-dependencies = {
49 html = [ html5lib ];
50 networkx = [ networkx ];
51 };
52
53 __darwinAllowLocalNetworking = true;
54
55 nativeCheckInputs =
56 [
57 pip
58 pytest-cov-stub
59 pytestCheckHook
60 setuptools
61 ]
62 ++ optional-dependencies.networkx
63 ++ optional-dependencies.html;
64
65 pytestFlagsArray = [
66 # requires network access
67 "--deselect=rdflib/__init__.py::rdflib"
68 "--deselect=test/jsonld/test_onedotone.py::test_suite"
69 ];
70
71 disabledTests =
72 [
73 # Requires network access
74 "test_service"
75 "testGuessFormatForParse"
76 "test_infix_owl_example1"
77 "test_context"
78 "test_example"
79 "test_guess_format_for_parse"
80 "rdflib.extras.infixowl"
81 ]
82 ++ lib.optionals stdenv.hostPlatform.isDarwin [
83 # Require loopback network access
84 "TestGraphHTTP"
85 ];
86
87 pythonImportsCheck = [ "rdflib" ];
88
89 meta = with lib; {
90 description = "Python library for working with RDF";
91 homepage = "https://rdflib.readthedocs.io";
92 license = licenses.bsd3;
93 maintainers = [ ];
94 };
95}