1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 aenum,
6 aiohttp,
7 importlib-metadata,
8 isodate,
9 nest-asyncio,
10 pytestCheckHook,
11 pythonOlder,
12 mock,
13 pyhamcrest,
14 pyyaml,
15 radish-bdd,
16}:
17
18buildPythonPackage rec {
19 pname = "gremlinpython";
20 version = "3.7.1";
21 format = "setuptools";
22
23 disabled = pythonOlder "3.7";
24
25 src = fetchFromGitHub {
26 owner = "apache";
27 repo = "tinkerpop";
28 rev = "refs/tags/${version}";
29 hash = "sha256-2viZXksHNFynOm6+1Vo2a8xrXl4pQcAxAVgehp5y6us=";
30 };
31
32 sourceRoot = "${src.name}/gremlin-python/src/main/python";
33
34 postPatch = ''
35 sed -i '/pytest-runner/d' setup.py
36
37 substituteInPlace setup.py \
38 --replace 'importlib-metadata<5.0.0' 'importlib-metadata' \
39 --replace "os.getenv('VERSION', '?').replace('-SNAPSHOT', '.dev-%d' % timestamp)" '"${version}"'
40 '';
41
42 # setup-requires requirements
43 nativeBuildInputs = [ importlib-metadata ];
44
45 propagatedBuildInputs = [
46 aenum
47 aiohttp
48 isodate
49 nest-asyncio
50 ];
51
52 nativeCheckInputs = [
53 pytestCheckHook
54 mock
55 pyhamcrest
56 pyyaml
57 radish-bdd
58 ];
59
60 # disable custom pytest report generation
61 preCheck = ''
62 substituteInPlace setup.cfg --replace 'addopts' '#addopts'
63 export TEST_TRANSACTIONS='false'
64 '';
65
66 # many tests expect a running tinkerpop server
67 disabledTestPaths = [
68 "tests/driver/test_client.py"
69 "tests/driver/test_driver_remote_connection.py"
70 "tests/driver/test_driver_remote_connection_http.py"
71 "tests/driver/test_driver_remote_connection_threaded.py"
72 "tests/driver/test_web_socket_client_behavior.py"
73 "tests/process/test_dsl.py"
74 "tests/structure/io/test_functionalityio.py"
75 ];
76 pytestFlagsArray =
77 let
78 fullDisabled = builtins.concatStringsSep " or " [
79 "test_transaction_commit"
80 "test_transaction_rollback"
81 "test_transaction_no_begin"
82 "test_multi_commit_transaction"
83 "test_multi_rollback_transaction"
84 "test_multi_commit_and_rollback"
85 "test_transaction_close_tx"
86 "test_transaction_close_tx_from_parent"
87 ];
88 in
89 [
90 # disabledTests doesn't quite allow us to be precise enough for this
91 "-k 'not ((TestFunctionalGraphSONIO and (test_timestamp or test_datetime or test_uuid)) or ${fullDisabled})'"
92 ];
93
94 meta = with lib; {
95 description = "Gremlin-Python implements Gremlin, the graph traversal language of Apache TinkerPop, within the Python language";
96 homepage = "https://tinkerpop.apache.org/";
97 license = licenses.asl20;
98 maintainers = with maintainers; [ ris ];
99 };
100}