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