1{ lib
2, buildPythonPackage
3, fetchPypi
4, pythonOlder
5
6# runtime
7, importlib-metadata
8, sqlalchemy
9
10# optionals
11, babel
12, arrow
13, pendulum
14#, intervals
15, phonenumbers
16, passlib
17, colour
18, python-dateutil
19, furl
20, cryptography
21
22# tests
23, pytestCheckHook
24, pygments
25, jinja2
26, docutils
27, flexmock
28, psycopg2
29, psycopg2cffi
30, pg8000
31, pytz
32, backports-zoneinfo
33, pymysql
34, pyodbc
35
36}:
37
38buildPythonPackage rec {
39 pname = "sqlalchemy-utils";
40 version = "0.41.1";
41 format = "setuptools";
42
43 src = fetchPypi {
44 inherit version;
45 pname = "SQLAlchemy-Utils";
46 hash = "sha256-ohgb/wHuuER544Vx0sBxjrUgQvmv2MGU0NAod+hLfXQ=";
47 };
48
49 patches = [
50 ./skip-database-tests.patch
51 ];
52
53 propagatedBuildInputs = [
54 sqlalchemy
55 ] ++ lib.optionals (pythonOlder "3.8") [
56 importlib-metadata
57 ];
58
59 passthru.optional-dependencies = {
60 babel = [ babel ];
61 arrow = [ arrow ];
62 pendulum = [ pendulum ];
63 #intervals = [ intervals ];
64 phone = [ phonenumbers ];
65 password = [ passlib ];
66 color = [ colour ];
67 timezone = [ python-dateutil ];
68 url = [ furl ];
69 encrypted = [ cryptography ];
70 };
71
72 nativeCheckInputs = [
73 pytestCheckHook
74 pygments
75 jinja2
76 docutils
77 flexmock
78 psycopg2
79 psycopg2cffi
80 pg8000
81 pytz
82 python-dateutil
83 pymysql
84 pyodbc
85 ]
86 ++ lib.flatten (builtins.attrValues passthru.optional-dependencies)
87 ++ lib.optionals (pythonOlder "3.9") [
88 backports-zoneinfo
89 ];
90
91 pytestFlagsArray = [
92 "--deselect tests/functions/test_database.py::TestDatabasePostgresCreateDatabaseCloseConnection::test_create_database_twice"
93 "--deselect tests/functions/test_database.py::TestDatabasePostgresPg8000::test_create_and_drop"
94 "--deselect tests/functions/test_database.py::TestDatabasePostgresPsycoPG2CFFI::test_create_and_drop"
95 "--deselect tests/functions/test_database.py::TestDatabasePostgresPsycoPG3::test_create_and_drop"
96 ];
97
98 meta = with lib; {
99 changelog = "https://github.com/kvesteri/sqlalchemy-utils/releases/tag/${version}";
100 homepage = "https://github.com/kvesteri/sqlalchemy-utils";
101 description = "Various utility functions and datatypes for SQLAlchemy";
102 license = licenses.bsd3;
103 maintainers = with maintainers; [ eadwu ];
104 };
105}