1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6 pythonOlder,
7 sqlalchemy,
8 sqlbag,
9 setuptools,
10 poetry-core,
11 pytestCheckHook,
12 pytest-xdist,
13 pytest-sugar,
14 postgresql,
15 postgresqlTestHook,
16}:
17buildPythonPackage {
18 pname = "schemainspect";
19 version = "3.1.1663587362";
20 format = "pyproject";
21 disabled = pythonOlder "3.7";
22
23 src = fetchFromGitHub {
24 owner = "djrobstep";
25 repo = "schemainspect";
26 # no tags on github, version patch number is unix time.
27 rev = "066262d6fb4668f874925305a0b7dbb3ac866882";
28 hash = "sha256-SYpQQhlvexNc/xEgSIk8L8J+Ta+3OZycGLeZGQ6DWzk=";
29 };
30
31 patches = [
32 # https://github.com/djrobstep/schemainspect/pull/87
33 (fetchpatch {
34 name = "specify_poetry.patch";
35 url = "https://github.com/djrobstep/schemainspect/commit/bdcd001ef7798236fe0ff35cef52f34f388bfe68.patch";
36 hash = "sha256-/SEmcV9GjjvzfbszeGPkfd2DvYenl7bZyWdC0aI3M4M=";
37 })
38 ];
39
40 nativeBuildInputs = [ poetry-core ];
41 propagatedBuildInputs = [
42 setuptools # needed for 'pkg_resources'
43 sqlalchemy
44 ];
45
46 nativeCheckInputs = [
47 pytestCheckHook
48 pytest-xdist
49 pytest-sugar
50
51 postgresql
52 postgresqlTestHook
53
54 sqlbag
55 ];
56
57 preCheck = ''
58 export PGUSER="nixbld";
59 export postgresqlEnableTCP=1;
60 '';
61 disabledTests = [
62 # These all fail with "List argument must consist only of tuples or dictionaries":
63 # Related issue: https://github.com/djrobstep/schemainspect/issues/88
64 "test_can_replace"
65 "test_collations"
66 "test_constraints"
67 "test_dep_order"
68 "test_enum_deps"
69 "test_exclusion_constraint"
70 "test_fk_col_order"
71 "test_fk_info"
72 "test_generated_columns"
73 "test_identity_columns"
74 "test_indexes"
75 "test_inherit"
76 "test_kinds"
77 "test_lineendings"
78 "test_long_identifiers"
79 "test_partitions"
80 "test_postgres_inspect"
81 "test_postgres_inspect_excludeschema"
82 "test_postgres_inspect_sigleschema"
83 "test_raw_connection"
84 "test_relationship"
85 "test_replica_trigger"
86 "test_rls"
87 "test_separate_validate"
88 "test_sequences"
89 "test_table_dependency_order"
90 "test_types_and_domains"
91 "test_view_trigger"
92 "test_weird_names"
93 ];
94
95 pytestFlags = [
96 "-x"
97 "-svv"
98 ];
99
100 enabledTestPaths = [
101 "tests"
102 ];
103
104 pythonImportsCheck = [ "schemainspect" ];
105
106 postUnpack = ''
107 # this dir is used to bump the version number, having it here fails the build
108 rm -r ./source/deploy
109 '';
110
111 meta = with lib; {
112 description = "Schema inspection for PostgreSQL, and potentially others";
113 homepage = "https://github.com/djrobstep/schemainspect";
114 license = with licenses; [ unlicense ];
115 maintainers = with maintainers; [ bpeetz ];
116 };
117}