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.12.0";
28 format = "pyproject";
29
30 disabled = pythonOlder "3.7";
31
32 src = fetchFromGitHub {
33 owner = "collerek";
34 repo = pname;
35 rev = "refs/tags/${version}";
36 hash = "sha256-B6dC9+t/pe7vsPb7rkGAbJWLfCAF7lIElFvt1pUu5yA=";
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.42"' 'SQLAlchemy = ">=1.3.18"' \
74 --replace 'databases = ">=0.3.2,!=0.5.0,!=0.5.1,!=0.5.2,!=0.5.3,<0.6.2"' '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 # Tests require a database
81 "test_model_multiple_instances_of_same_table_in_schema"
82 "test_load_all_multiple_instances_of_same_table_in_schema"
83 "test_filter_groups_with_instances_of_same_table_in_schema"
84 "test_model_multiple_instances_of_same_table_in_schema"
85 "test_right_tables_join"
86 "test_multiple_reverse_related_objects"
87 "test_related_with_defaults"
88 "test_model_creation"
89 "test_default_orders_is_applied_on_related_two_fields"
90 "test_default_orders_is_applied_from_relation"
91 "test_sum_method"
92 "test_count_method "
93 "test_queryset_methods"
94 "test_queryset_update"
95 "test_selecting_subset"
96 "test_selecting_subset_of_through_model"
97 "test_simple_queryset_values"
98 "test_queryset_values_nested_relation"
99 "test_queryset_simple_values_list"
100 "test_queryset_nested_relation_values_list"
101 "test_queryset_nested_relation_subset_of_fields_values_list"
102 "test_m2m_values"
103 "test_nested_m2m"
104 "test_nested_flatten_and_exception"
105 "test_queryset_values_multiple_select_related"
106 "test_querysetproxy_values"
107 "test_querysetproxy_values_list"
108 "test_reverse_many_to_many_cascade"
109 "test_not_saved_raises_error"
110 "test_not_existing_raises_error"
111 "test_assigning_related_objects"
112 "test_quering_of_the_m2m_models"
113 "test_removal_of_the_relations"
114 "test_selecting_related"
115 "test_adding_unsaved_related"
116 "test_removing_unsaved_related"
117 "test_quering_of_related_model_works_but_no_result"
118 ];
119
120 pythonImportsCheck = [
121 "ormar"
122 ];
123
124 meta = with lib; {
125 description = "Async ORM with fastapi in mind and pydantic validation";
126 homepage = "https://github.com/collerek/ormar";
127 license = licenses.mit;
128 maintainers = with maintainers; [ andreasfelix ];
129 };
130}