1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 hatchling,
7 aiosqlite,
8 arrow,
9 babel,
10 cacert,
11 colour,
12 fasteners,
13 httpx,
14 jinja2,
15 mongoengine,
16 motor,
17 passlib,
18 phonenumbers,
19 pillow,
20 psycopg2,
21 pydantic,
22 pytest-asyncio,
23 pytestCheckHook,
24 python-multipart,
25 requests,
26 sqlalchemy,
27 sqlalchemy-file,
28 sqlalchemy-utils,
29 sqlmodel,
30 starlette,
31}:
32
33buildPythonPackage rec {
34 pname = "starlette-admin";
35 version = "0.15.1";
36 pyproject = true;
37
38 src = fetchFromGitHub {
39 owner = "jowilf";
40 repo = "starlette-admin";
41 tag = version;
42 hash = "sha256-yPePxdKrg41kycXl1fDKf1jWx0YD+K26w8z2LmQV0g0=";
43 };
44
45 build-system = [ hatchling ];
46
47 dependencies = [
48 jinja2
49 python-multipart
50 starlette
51 ];
52
53 optional-dependencies = {
54 i18n = [ babel ];
55 };
56
57 nativeCheckInputs = [
58 aiosqlite
59 arrow
60 babel
61 cacert
62 colour
63 fasteners
64 httpx
65 mongoengine
66 motor
67 passlib
68 phonenumbers
69 pillow
70 psycopg2
71 pydantic
72 pytest-asyncio
73 pytestCheckHook
74 requests
75 sqlalchemy
76 sqlalchemy-file
77 sqlalchemy-utils
78 sqlmodel
79 ];
80
81 preCheck = ''
82 # used in get_test_container in tests/sqla/utils.py
83 # fixes FileNotFoundError: [Errno 2] No such file or directory: '/tmp/storage/...'
84 mkdir .storage
85 export LOCAL_PATH="$PWD/.storage"
86 '';
87
88 disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [
89 # flaky, depends on test order
90 "test_ensuring_pk"
91 # flaky, of-by-one
92 "test_api"
93 ];
94
95 disabledTestPaths = [
96 # odmantic is not packaged
97 "tests/odmantic"
98 # beanie is not packaged
99 "tests/beanie"
100 # needs mongodb running on port 27017
101 "tests/mongoengine"
102 ]
103 ++ lib.optionals stdenv.hostPlatform.isDarwin [
104 # very flaky, sandbox issues?
105 # libcloud.storage.types.ContainerDoesNotExistError
106 # sqlite3.OperationalError: attempt to write a readonly database
107 "tests/sqla/test_sync_engine.py"
108 "tests/sqla/test_async_engine.py"
109 ];
110
111 pythonImportsCheck = [
112 "starlette_admin"
113 "starlette_admin.actions"
114 "starlette_admin.base"
115 "starlette_admin.fields"
116 "starlette_admin.i18n"
117 "starlette_admin.tools"
118 "starlette_admin.views"
119 ];
120
121 meta = with lib; {
122 description = "Fast, beautiful and extensible administrative interface framework for Starlette & FastApi applications";
123 homepage = "https://github.com/jowilf/starlette-admin";
124 changelog = "https://jowilf.github.io/starlette-admin/changelog/";
125 license = licenses.mit;
126 maintainers = with maintainers; [ pbsds ];
127 };
128}