nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, aiomysql
3, aiopg
4, aiosqlite
5, asyncpg
6, buildPythonPackage
7, cryptography
8, databases
9, fastapi
10, fetchFromGitHub
11, importlib-metadata
12, mysqlclient
13, orjson
14, poetry-core
15, psycopg2
16, pydantic
17, pymysql
18, pytest-asyncio
19, pytestCheckHook
20, pythonOlder
21, sqlalchemy
22, typing-extensions
23}:
24
25buildPythonPackage rec {
26 pname = "ormar";
27 version = "0.11.0";
28 format = "pyproject";
29
30 disabled = pythonOlder "3.7";
31
32 src = fetchFromGitHub {
33 owner = "collerek";
34 repo = pname;
35 rev = version;
36 hash = "sha256-I41asBWwOwmi6Yhw/JZ/EcpDWMAoPyxPIGIPiZQV+Yk=";
37 };
38
39 nativeBuildInputs = [
40 poetry-core
41 ];
42
43 propagatedBuildInputs = [
44 aiomysql
45 aiosqlite
46 asyncpg
47 cryptography
48 databases
49 orjson
50 psycopg2
51 pydantic
52 sqlalchemy
53 ] ++ lib.optionals (pythonOlder "3.8") [
54 typing-extensions
55 importlib-metadata
56 ];
57
58 checkInputs = [
59 aiomysql
60 aiopg
61 aiosqlite
62 asyncpg
63 fastapi
64 mysqlclient
65 psycopg2
66 pymysql
67 pytest-asyncio
68 pytestCheckHook
69 ];
70
71 postPatch = ''
72 substituteInPlace pyproject.toml \
73 --replace 'SQLAlchemy = ">=1.3.18,<=1.4.31"' 'SQLAlchemy = ">=1.3.18"' \
74 --replace 'databases = ">=0.3.2,!=0.5.0,!=0.5.1,!=0.5.2,!=0.5.3,<=0.5.5"' 'databases = ">=0.5.5"'
75 '';
76
77 disabledTests = [
78 # TypeError: Object of type bytes is not JSON serializable
79 "test_bulk_operations_with_json"
80 ];
81
82 pythonImportsCheck = [
83 "ormar"
84 ];
85
86 meta = with lib; {
87 description = "Async ORM with fastapi in mind and pydantic validation";
88 homepage = "https://github.com/collerek/ormar";
89 license = licenses.mit;
90 maintainers = with maintainers; [ andreasfelix ];
91 };
92}