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