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 pytestCheckHook
67 pygments
68 jinja2
69 docutils
70 flexmock
71 psycopg2
72 pg8000
73 pytz
74 python-dateutil
75 pymysql
76 pyodbc
77 ]
78 ++ lib.flatten (builtins.attrValues optional-dependencies)
79 ++ lib.optionals (pythonOlder "3.12") [
80 # requires distutils, which were removed in 3.12
81 psycopg2cffi
82 ];
83
84 disabledTests = [
85 "test_create_database_twice"
86 "test_create_and_drop"
87 ]
88 ++ lib.optionals (pythonAtLeast "3.13") [
89 # https://github.com/kvesteri/sqlalchemy-utils/issues/764
90 "test_render_mock_ddl"
91 ];
92
93 pytestFlags = [
94 "-Wignore::DeprecationWarning"
95 ];
96
97 pythonImportsCheck = [ "sqlalchemy_utils" ];
98
99 meta = with lib; {
100 description = "Various utility functions and datatypes for SQLAlchemy";
101 homepage = "https://github.com/kvesteri/sqlalchemy-utils";
102 changelog = "https://github.com/kvesteri/sqlalchemy-utils/releases/tag/${version}";
103 license = licenses.bsd3;
104 maintainers = with maintainers; [ eadwu ];
105 };
106}