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 pythonOlder,
26 pytz,
27 setuptools,
28 sqlalchemy,
29}:
30
31buildPythonPackage rec {
32 pname = "sqlalchemy-utils";
33 version = "0.42.2";
34 pyproject = true;
35
36 disabled = pythonOlder "3.10";
37
38 src = fetchFromGitHub {
39 owner = "kvesteri";
40 repo = "sqlalchemy-utils";
41 rev = "refs/tags/${version}";
42 hash = "sha256-jC8onlCiuzpMlJ3EzpzCnQ128xpkLzrZEuGWQv7pvVE=";
43 };
44
45 patches = [ ./skip-database-tests.patch ];
46
47 build-system = [ setuptools ];
48
49 propagatedBuildInputs = [ sqlalchemy ];
50
51 optional-dependencies = {
52 babel = [ babel ];
53 arrow = [ arrow ];
54 pendulum = [ pendulum ];
55 #intervals = [ intervals ];
56 phone = [ phonenumbers ];
57 password = [ passlib ];
58 color = [ colour ];
59 timezone = [ python-dateutil ];
60 url = [ furl ];
61 encrypted = [ cryptography ];
62 };
63
64 nativeCheckInputs =
65 [
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
89 pytestFlagsArray = [
90 "-W"
91 "ignore::DeprecationWarning"
92 ];
93
94 pythonImportsCheck = [ "sqlalchemy_utils" ];
95
96 meta = with lib; {
97 description = "Various utility functions and datatypes for SQLAlchemy";
98 homepage = "https://github.com/kvesteri/sqlalchemy-utils";
99 changelog = "https://github.com/kvesteri/sqlalchemy-utils/releases/tag/${version}";
100 license = licenses.bsd3;
101 maintainers = with maintainers; [ eadwu ];
102 };
103}