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