1{
2 lib,
3 buildPythonPackage,
4 arrow,
5 babel,
6 colour,
7 cryptography,
8 docutils,
9 fetchFromGitHub,
10 flexmock,
11 furl,
12 # intervals,
13 jinja2,
14 passlib,
15 pendulum,
16 pg8000,
17 phonenumbers,
18 psycopg2,
19 psycopg2cffi,
20 pygments,
21 pymysql,
22 pyodbc,
23 pytestCheckHook,
24 python-dateutil,
25 pythonAtLeast,
26 pythonOlder,
27 pytz,
28 setuptools,
29 sqlalchemy,
30}:
31
32buildPythonPackage rec {
33 pname = "sqlalchemy-utils";
34 version = "0.42.2";
35 pyproject = true;
36
37 disabled = pythonOlder "3.10";
38
39 src = fetchFromGitHub {
40 owner = "kvesteri";
41 repo = "sqlalchemy-utils";
42 tag = version;
43 hash = "sha256-jC8onlCiuzpMlJ3EzpzCnQ128xpkLzrZEuGWQv7pvVE=";
44 };
45
46 patches = [ ./skip-database-tests.patch ];
47
48 build-system = [ setuptools ];
49
50 propagatedBuildInputs = [ sqlalchemy ];
51
52 optional-dependencies = {
53 babel = [ babel ];
54 arrow = [ arrow ];
55 pendulum = [ pendulum ];
56 #intervals = [ intervals ];
57 phone = [ phonenumbers ];
58 password = [ passlib ];
59 color = [ colour ];
60 timezone = [ python-dateutil ];
61 url = [ furl ];
62 encrypted = [ cryptography ];
63 };
64
65 nativeCheckInputs =
66 [
67 pytestCheckHook
68 pygments
69 jinja2
70 docutils
71 flexmock
72 psycopg2
73 pg8000
74 pytz
75 python-dateutil
76 pymysql
77 pyodbc
78 ]
79 ++ lib.flatten (builtins.attrValues optional-dependencies)
80 ++ lib.optionals (pythonOlder "3.12") [
81 # requires distutils, which were removed in 3.12
82 psycopg2cffi
83 ];
84
85 disabledTests =
86 [
87 "test_create_database_twice"
88 "test_create_and_drop"
89 ]
90 ++ lib.optionals (pythonAtLeast "3.13") [
91 # https://github.com/kvesteri/sqlalchemy-utils/issues/764
92 "test_render_mock_ddl"
93 ];
94
95 pytestFlagsArray = [
96 "-W"
97 "ignore::DeprecationWarning"
98 ];
99
100 pythonImportsCheck = [ "sqlalchemy_utils" ];
101
102 meta = with lib; {
103 description = "Various utility functions and datatypes for SQLAlchemy";
104 homepage = "https://github.com/kvesteri/sqlalchemy-utils";
105 changelog = "https://github.com/kvesteri/sqlalchemy-utils/releases/tag/${version}";
106 license = licenses.bsd3;
107 maintainers = with maintainers; [ eadwu ];
108 };
109}