at master 2.7 kB view raw
1{ 2 lib, 3 isPyPy, 4 pythonOlder, 5 fetchFromGitHub, 6 buildPythonPackage, 7 nix-update-script, 8 9 # build 10 cython, 11 setuptools, 12 13 # propagates 14 greenlet, 15 typing-extensions, 16 17 # optionals 18 aiomysql, 19 # TODO: aioodbc 20 aiosqlite, 21 asyncmy, 22 asyncpg, 23 cx-oracle, 24 mariadb, 25 mypy, 26 mysql-connector, 27 mysqlclient, 28 oracledb, 29 pg8000, 30 psycopg, 31 psycopg2, 32 psycopg2cffi, 33 pymssql, 34 pymysql, 35 pyodbc, 36 sqlcipher3, 37 types-greenlet, 38 39 # tests 40 mock, 41 pytest-xdist, 42 pytestCheckHook, 43}: 44 45buildPythonPackage rec { 46 pname = "sqlalchemy"; 47 version = "2.0.42"; 48 pyproject = true; 49 50 disabled = pythonOlder "3.7"; 51 52 src = fetchFromGitHub { 53 owner = "sqlalchemy"; 54 repo = "sqlalchemy"; 55 tag = "rel_${lib.replaceStrings [ "." ] [ "_" ] version}"; 56 hash = "sha256-e/DkS9CioMLG/qMOf0//DxMFDTep4xEtCVTp/Hn0Wiw="; 57 }; 58 59 postPatch = '' 60 sed -i '/tag_build = dev/d' setup.cfg 61 ''; 62 63 build-system = [ setuptools ] ++ lib.optionals (!isPyPy) [ cython ]; 64 65 dependencies = [ 66 greenlet 67 typing-extensions 68 ]; 69 70 optional-dependencies = lib.fix (self: { 71 asyncio = [ greenlet ]; 72 mypy = [ 73 mypy 74 types-greenlet 75 ]; 76 mssql = [ pyodbc ]; 77 mssql_pymysql = [ pymssql ]; 78 mssql_pyodbc = [ pyodbc ]; 79 mysql = [ mysqlclient ]; 80 mysql_connector = [ mysql-connector ]; 81 mariadb_connector = [ mariadb ]; 82 oracle = [ cx-oracle ]; 83 oracle_oracledb = [ oracledb ]; 84 postgresql = [ psycopg2 ]; 85 postgresql_pg8000 = [ pg8000 ]; 86 postgresql_asyncpg = [ asyncpg ] ++ self.asyncio; 87 postgresql_psycopg2binary = [ psycopg2 ]; 88 postgresql_psycopg2cffi = [ psycopg2cffi ]; 89 postgresql_psycopg = [ psycopg ]; 90 postgresql_psycopgbinary = [ psycopg ]; 91 pymysql = [ pymysql ]; 92 aiomysql = [ aiomysql ] ++ self.asyncio; 93 # TODO: aioodbc 94 asyncmy = [ asyncmy ] ++ self.asyncio; 95 aiosqlite = [ aiosqlite ] ++ self.asyncio; 96 sqlcipher = [ sqlcipher3 ]; 97 }); 98 99 nativeCheckInputs = [ 100 pytest-xdist 101 pytestCheckHook 102 mock 103 ]; 104 105 disabledTestPaths = [ 106 # typing correctness, not interesting 107 "test/ext/mypy" 108 "test/typing" 109 # slow and high memory usage, not interesting 110 "test/aaa_profiling" 111 ]; 112 113 passthru.updateScript = nix-update-script { 114 extraArgs = [ 115 "--version-regex" 116 "^rel_([0-9]+)_([0-9]+)_([0-9]+)$" 117 ]; 118 }; 119 120 meta = with lib; { 121 changelog = "https://github.com/sqlalchemy/sqlalchemy/releases/tag/rel_${ 122 builtins.replaceStrings [ "." ] [ "_" ] version 123 }"; 124 description = "Python SQL toolkit and Object Relational Mapper"; 125 homepage = "http://www.sqlalchemy.org/"; 126 license = licenses.mit; 127 }; 128}