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