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