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