1{ lib
2, isPyPy
3, pythonOlder
4, fetchFromGitHub
5, buildPythonPackage
6
7# build
8, cython
9, setuptools
10
11# propagates
12, greenlet
13, typing-extensions
14
15# optionals
16, aiomysql
17, aiosqlite
18, asyncmy
19, asyncpg
20, cx_oracle
21, mariadb
22, mypy
23, mysql-connector
24, mysqlclient
25, oracledb
26, pg8000
27, psycopg
28, psycopg2
29, psycopg2cffi
30# TODO: pymssql
31, pymysql
32, pyodbc
33# TODO: sqlcipher3
34
35# tests
36, mock
37, pytest-xdist
38, pytestCheckHook
39}:
40
41buildPythonPackage rec {
42 pname = "SQLAlchemy";
43 version = "2.0.21";
44 format = "pyproject";
45
46 disabled = pythonOlder "3.7";
47
48 src = fetchFromGitHub {
49 owner = "sqlalchemy";
50 repo = "sqlalchemy";
51 rev = "refs/tags/rel_${lib.replaceStrings [ "." ] [ "_" ] version}";
52 hash = "sha256-ldBn+pdZfqnBKdYkOcG47ScH/hBgeJBeIvn1hCIBw/A=";
53 };
54
55 nativeBuildInputs =[
56 setuptools
57 ] ++ lib.optionals (!isPyPy) [
58 cython
59 ];
60
61 propagatedBuildInputs = [
62 greenlet
63 typing-extensions
64 ];
65
66 passthru.optional-dependencies = lib.fix (self: {
67 asyncio = [
68 greenlet
69 ];
70 mypy = [
71 mypy
72 ];
73 mssql = [
74 pyodbc
75 ];
76 mssql_pymysql = [
77 # TODO: pymssql
78 ];
79 mssql_pyodbc = [
80 pyodbc
81 ];
82 mysql = [
83 mysqlclient
84 ];
85 mysql_connector = [
86 mysql-connector
87 ];
88 mariadb_connector = [
89 mariadb
90 ];
91 oracle = [
92 cx_oracle
93 ];
94 oracle_oracledb = [
95 oracledb
96 ];
97 postgresql = [
98 psycopg2
99 ];
100 postgresql_pg8000 = [
101 pg8000
102 ];
103 postgresql_asyncpg = [
104 asyncpg
105 ] ++ self.asyncio;
106 postgresql_psycopg2binary = [
107 psycopg2
108 ];
109 postgresql_psycopg2cffi = [
110 psycopg2cffi
111 ];
112 postgresql_psycopg = [
113 psycopg
114 ];
115 postgresql_psycopgbinary = [
116 psycopg
117 ];
118 pymysql = [
119 pymysql
120 ];
121 aiomysql = [
122 aiomysql
123 ] ++ self.asyncio;
124 asyncmy = [
125 asyncmy
126 ] ++ self.asyncio;
127 aiosqlite = [
128 aiosqlite
129 typing-extensions
130 ] ++ self.asyncio;
131 sqlcipher = [
132 # TODO: sqlcipher3
133 ];
134 });
135
136 nativeCheckInputs = [
137 pytest-xdist
138 pytestCheckHook
139 mock
140 ];
141
142 disabledTestPaths = [
143 # typing correctness, not interesting
144 "test/ext/mypy"
145 "test/typing"
146 # slow and high memory usage, not interesting
147 "test/aaa_profiling"
148 ];
149
150 meta = with lib; {
151 changelog = "https://github.com/sqlalchemy/sqlalchemy/releases/tag/rel_${builtins.replaceStrings [ "." ] [ "_" ] version}";
152 description = "The Python SQL toolkit and Object Relational Mapper";
153 homepage = "http://www.sqlalchemy.org/";
154 license = licenses.mit;
155 };
156}