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 # propagates <3.8
16 importlib-metadata,
17
18 # extras: networkx
19 networkx,
20
21 # extras: html
22 html5lib,
23
24 # tests
25 pip,
26 pytest-cov,
27 pytest7CheckHook,
28 setuptools,
29}:
30
31buildPythonPackage rec {
32 pname = "rdflib";
33 version = "7.0.0";
34 format = "pyproject";
35
36 disabled = pythonOlder "3.8";
37
38 src = fetchFromGitHub {
39 owner = "RDFLib";
40 repo = pname;
41 rev = "refs/tags/${version}";
42 hash = "sha256-VCjvgXMun1Hs+gPeqjzLXbIX1NBQ5aMLz0aWlwsm0iY=";
43 };
44
45 nativeBuildInputs = [ poetry-core ];
46
47 propagatedBuildInputs = [
48 isodate
49 html5lib
50 pyparsing
51 ] ++ lib.optionals (pythonOlder "3.8") [ importlib-metadata ];
52
53 passthru.optional-dependencies = {
54 html = [ html5lib ];
55 networkx = [ networkx ];
56 };
57
58 __darwinAllowLocalNetworking = true;
59
60 nativeCheckInputs = [
61 pip
62 pytest-cov
63 # Failed: DID NOT WARN. No warnings of type (<class 'UserWarning'>,) were emitted.
64 pytest7CheckHook
65 setuptools
66 ] ++ passthru.optional-dependencies.networkx ++ passthru.optional-dependencies.html;
67
68 pytestFlagsArray = [
69 # requires network access
70 "--deselect=rdflib/__init__.py::rdflib"
71 "--deselect=test/jsonld/test_onedotone.py::test_suite"
72 ];
73
74 disabledTests =
75 [
76 # Requires network access
77 "test_service"
78 "testGuessFormatForParse"
79 "test_infix_owl_example1"
80 "test_context"
81 "test_example"
82 "test_guess_format_for_parse"
83 "rdflib.extras.infixowl"
84 ]
85 ++ lib.optionals stdenv.isDarwin [
86 # Require loopback network access
87 "TestGraphHTTP"
88 ];
89
90 pythonImportsCheck = [ "rdflib" ];
91
92 meta = with lib; {
93 description = "Python library for working with RDF";
94 homepage = "https://rdflib.readthedocs.io";
95 license = licenses.bsd3;
96 maintainers = with maintainers; [ ];
97 };
98}