1{ lib
2, aiomysql
3, aiopg
4, aiosqlite
5, asyncpg
6, buildPythonPackage
7, cryptography
8, databases
9, fastapi
10, fetchFromGitHub
11, httpx
12, importlib-metadata
13, mysqlclient
14, nest-asyncio
15, orjson
16, poetry-core
17, psycopg2
18, pydantic
19, pymysql
20, pytest-asyncio
21, pytestCheckHook
22, pythonOlder
23, pythonRelaxDepsHook
24, sqlalchemy
25, typing-extensions
26}:
27
28buildPythonPackage rec {
29 pname = "ormar";
30 version = "0.12.2";
31 format = "pyproject";
32
33 disabled = pythonOlder "3.7";
34
35 src = fetchFromGitHub {
36 owner = "collerek";
37 repo = pname;
38 rev = "refs/tags/${version}";
39 hash = "sha256-Yd5ex0bcy61zq5Sn2dKeb98s/CMxUWnyGx6jFWQ3RUs=";
40 };
41
42 pythonRelaxDeps = [
43 "databases"
44 "pydantic"
45 "SQLAlchemy"
46 ];
47
48 nativeBuildInputs = [
49 poetry-core
50 pythonRelaxDepsHook
51 ];
52
53 propagatedBuildInputs = [
54 databases
55 psycopg2
56 pydantic
57 sqlalchemy
58 psycopg2
59 ] ++ lib.optionals (pythonOlder "3.8") [
60 typing-extensions
61 importlib-metadata
62 ];
63
64 passthru.optional-dependencies = {
65 postgresql = [
66 asyncpg
67 ];
68 postgres = [
69 asyncpg
70 ];
71 aiopg = [
72 aiopg
73 ];
74 mysql = [
75 aiomysql
76 ];
77 sqlite = [
78 aiosqlite
79 ];
80 orjson = [
81 orjson
82 ];
83 crypto = [
84 cryptography
85 ];
86 all = [
87 aiomysql
88 aiopg
89 aiosqlite
90 asyncpg
91 cryptography
92 mysqlclient
93 orjson
94 pymysql
95 ];
96 };
97
98 nativeCheckInputs = [
99 pytestCheckHook
100 ];
101
102 checkInputs = [
103 fastapi
104 httpx
105 nest-asyncio
106 pytest-asyncio
107 ] ++ passthru.optional-dependencies.all;
108
109 disabledTestPaths = [
110 "benchmarks/test_benchmark_*.py"
111 ];
112
113 disabledTests = [
114 # TypeError: Object of type bytes is not JSON serializable
115 "test_bulk_operations_with_json"
116 "test_all_endpoints"
117 # Tests require a database
118 "test_model_multiple_instances_of_same_table_in_schema"
119 "test_load_all_multiple_instances_of_same_table_in_schema"
120 "test_filter_groups_with_instances_of_same_table_in_schema"
121 "test_model_multiple_instances_of_same_table_in_schema"
122 "test_right_tables_join"
123 "test_multiple_reverse_related_objects"
124 "test_related_with_defaults"
125 "test_model_creation"
126 "test_default_orders_is_applied_on_related_two_fields"
127 "test_default_orders_is_applied_from_relation"
128 "test_sum_method"
129 "test_count_method "
130 "test_queryset_methods"
131 "test_queryset_update"
132 "test_selecting_subset"
133 "test_selecting_subset_of_through_model"
134 "test_simple_queryset_values"
135 "test_queryset_values_nested_relation"
136 "test_queryset_simple_values_list"
137 "test_queryset_nested_relation_values_list"
138 "test_queryset_nested_relation_subset_of_fields_values_list"
139 "test_m2m_values"
140 "test_nested_m2m"
141 "test_nested_flatten_and_exception"
142 "test_queryset_values_multiple_select_related"
143 "test_querysetproxy_values"
144 "test_querysetproxy_values_list"
145 "test_reverse_many_to_many_cascade"
146 "test_not_saved_raises_error"
147 "test_not_existing_raises_error"
148 "test_assigning_related_objects"
149 "test_quering_of_the_m2m_models"
150 "test_removal_of_the_relations"
151 "test_selecting_related"
152 "test_adding_unsaved_related"
153 "test_removing_unsaved_related"
154 "test_quering_of_related_model_works_but_no_result"
155 ];
156
157 pythonImportsCheck = [
158 "ormar"
159 ];
160
161 meta = with lib; {
162 description = "Async ORM with fastapi in mind and pydantic validation";
163 homepage = "https://github.com/collerek/ormar";
164 changelog = "https://github.com/collerek/ormar/releases/tag/${version}";
165 license = licenses.mit;
166 maintainers = with maintainers; [ andreasfelix ];
167 };
168}