brilliance-admin 0.43.1__py3-none-any.whl → 0.44.12__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. brilliance_admin/api/routers.py +2 -2
  2. brilliance_admin/api/views/autocomplete.py +1 -1
  3. brilliance_admin/api/views/{graphs.py → dashboard.py} +5 -5
  4. brilliance_admin/api/views/table.py +7 -6
  5. brilliance_admin/exceptions.py +1 -0
  6. brilliance_admin/integrations/sqlalchemy/__init__.py +1 -0
  7. brilliance_admin/integrations/sqlalchemy/auth.py +3 -4
  8. brilliance_admin/integrations/sqlalchemy/autocomplete.py +12 -3
  9. brilliance_admin/integrations/sqlalchemy/fields.py +36 -19
  10. brilliance_admin/integrations/sqlalchemy/fields_schema.py +21 -12
  11. brilliance_admin/integrations/sqlalchemy/table/base.py +4 -4
  12. brilliance_admin/integrations/sqlalchemy/table/create.py +6 -3
  13. brilliance_admin/integrations/sqlalchemy/table/delete.py +2 -2
  14. brilliance_admin/integrations/sqlalchemy/table/list.py +44 -14
  15. brilliance_admin/integrations/sqlalchemy/table/retrieve.py +41 -10
  16. brilliance_admin/integrations/sqlalchemy/table/update.py +10 -5
  17. brilliance_admin/locales/en.yml +20 -10
  18. brilliance_admin/locales/ru.yml +20 -10
  19. brilliance_admin/schema/__init__.py +3 -3
  20. brilliance_admin/schema/admin_schema.py +31 -23
  21. brilliance_admin/schema/category.py +88 -14
  22. brilliance_admin/schema/dashboard/__init__.py +1 -0
  23. brilliance_admin/schema/dashboard/category_dashboard.py +87 -0
  24. brilliance_admin/schema/table/category_table.py +13 -8
  25. brilliance_admin/schema/table/fields/base.py +102 -19
  26. brilliance_admin/schema/table/fields_schema.py +9 -2
  27. brilliance_admin/static/{index-D9axz5zK.js → index-8ahvKI6W.js} +190 -190
  28. brilliance_admin/static/{index-vlBToOhT.css → index-B8JOx1Ps.css} +1 -1
  29. brilliance_admin/templates/index.html +2 -2
  30. brilliance_admin/translations.py +6 -3
  31. brilliance_admin/utils.py +41 -3
  32. brilliance_admin-0.44.12.dist-info/METADATA +165 -0
  33. {brilliance_admin-0.43.1.dist-info → brilliance_admin-0.44.12.dist-info}/RECORD +36 -37
  34. {brilliance_admin-0.43.1.dist-info → brilliance_admin-0.44.12.dist-info}/WHEEL +1 -1
  35. brilliance_admin-0.44.12.dist-info/licenses/LICENSE +21 -0
  36. brilliance_admin/schema/graphs/__init__.py +0 -1
  37. brilliance_admin/schema/graphs/category_graphs.py +0 -51
  38. brilliance_admin/schema/group.py +0 -67
  39. brilliance_admin-0.43.1.dist-info/METADATA +0 -214
  40. brilliance_admin-0.43.1.dist-info/licenses/LICENSE +0 -17
  41. {brilliance_admin-0.43.1.dist-info → brilliance_admin-0.44.12.dist-info}/top_level.txt +0 -0
@@ -1,214 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: brilliance-admin
3
- Version: 0.43.1
4
- Summary: Simple and lightweight admin panel framework powered by FastAPI and Vue3 Vuetify together.. Some call it heavenly in its brilliance.
5
- License-Expression: AGPL-3.0
6
- Requires-Python: >=3.10
7
- Description-Content-Type: text/markdown
8
- License-File: LICENSE
9
- Requires-Dist: asgiref>=3.11
10
- Requires-Dist: fastapi>=0.115
11
- Requires-Dist: jinja2>=3.1
12
- Requires-Dist: PyYAML>=6.0
13
- Provides-Extra: example
14
- Requires-Dist: uvicorn>=0.34.0; extra == "example"
15
- Requires-Dist: faker>=38.2.0; extra == "example"
16
- Requires-Dist: pyjwt>=2.10.1; extra == "example"
17
- Requires-Dist: structlog>=25.5.0; extra == "example"
18
- Requires-Dist: rich>=14.2.0; extra == "example"
19
- Provides-Extra: tests
20
- Requires-Dist: pytest>=8.4.2; extra == "tests"
21
- Requires-Dist: pytest-asyncio>=1.2.0; extra == "tests"
22
- Requires-Dist: httpx>=0.28.1; extra == "tests"
23
- Requires-Dist: pytest-mock>=3.15.1; extra == "tests"
24
- Requires-Dist: sqlalchemy>=2.0.41; extra == "tests"
25
- Requires-Dist: aiosqlite>=0.22.1; extra == "tests"
26
- Requires-Dist: factory-boy>=3.3.3; extra == "tests"
27
- Requires-Dist: pyjwt>=2.10.1; extra == "tests"
28
- Provides-Extra: scalar
29
- Requires-Dist: scalar-fastapi>=1.5.0; extra == "scalar"
30
- Dynamic: license-file
31
-
32
- <div align="center">
33
- <img src="https://github.com/brilliance-admin/backend-python/blob/main/example/static/logo-outline.png?raw=true"
34
- alt="Brilliance Admin"
35
- width="600">
36
-
37
- [![PyPI](https://img.shields.io/pypi/v/brilliance-admin)](https://pypi.org/project/brilliance-admin/)
38
- [![CI](https://github.com/brilliance-admin/backend-python/actions/workflows/deploy.yml/badge.svg)](https://github.com/brilliance-admin/backend-python/actions)
39
-
40
- Simple and lightweight admin panel framework powered by `FastAPI` and `Vue3` `Vuetify` together. \
41
- Integrated with `SQLAlchemy`. Inspaired by Django Admin and DRF.\
42
- _Some call it heavenly in its brilliance._
43
-
44
- ### [Live Demo](https://brilliance-admin.com/) | [Demo Sources](https://github.com/brilliance-admin/backend-python/tree/main/example) | Documentation (todo)
45
-
46
- <img src="https://github.com/brilliance-admin/backend-python/blob/main/screenshots/websitemockupgenerator.png?raw=true"
47
- alt="Preview">
48
-
49
- </div>
50
-
51
- **Key ideas:**
52
- - **API oriented**\
53
- Works entirely on FastAPI and provides a prebuilt SPA [frontend](https://github.com/brilliance-admin/frontend) via static files (Vue3 + Vuetify). No separate startup is required.
54
- > Data generation/updating API separated from rendering fontend with zero hardcode, this makes it possible to have a single frontend with multiple backend implementations in different languages and makes test coverage easier.
55
- - **Rich visualization**\
56
- Providing rich and convenient ways to display and manage data (tables, charts, etc) from any data source.
57
- - **ORM**\
58
- Automatic schema generation and methods for CRUD operations.
59
- - **Minimal boilerplate**\
60
- Focused on simplified, but rich configuration.
61
-
62
- **How it works:**
63
- - After authentication, the user receives the admin panel schema, and the frontend renders it
64
- - The frontend communicates with the backend via API to fetch and modify data
65
-
66
- ### Features:
67
-
68
- * Tables with full CRUD support, including filtering, sorting, and pagination.
69
- * Ability to define custom table actions with forms, response messages, and file downloads.
70
- * Graphs via ChartJS
71
- * Localization support
72
- * Adapted for different screen sizes and mobile devices
73
- * Authorization via any account data source
74
-
75
- **Integrations:**
76
- * **SQLAlchemy** - schema autogeneration for tables + CRUD operations + authorization
77
-
78
- **Planned:**
79
- * Role-based access control system
80
- * Nested data support for creation and detail views
81
- * Django ORM inegration
82
-
83
- ## How to use it
84
-
85
- Installation:
86
- ``` shell
87
- pip install brilliance-admin
88
- ```
89
-
90
- You need to generate `AdminSchema` instance:
91
- ``` python
92
- from brilliance_admin import schema
93
-
94
-
95
- class CategoryExample(schema.CategoryTable):
96
- "Implementation of get_list and retrieve; update and create are optional"
97
-
98
-
99
- admin_schema = schema.AdminSchema(
100
- title='Admin Panel',
101
- auth=YourAdminAuthentication(),
102
- groups=[
103
- schema.Group(
104
- slug='example',
105
- title='Example',
106
- icon='mdi-star',
107
- categories=[
108
- CategoryExample(),
109
- ]
110
- ),
111
- ],
112
- )
113
-
114
- admin_app = admin_schema.generate_app()
115
-
116
- # Your FastAPI app
117
- app = FastAPI()
118
- app.mount('/admin', admin_app)
119
- ```
120
-
121
- ## SQLAlchemy integration
122
-
123
- Supports automatic schema generation for CRUD tables:
124
-
125
- ``` python
126
- category = sqlalchemy.SQLAlchemyAdmin(db_async_session=async_sessionmaker, model=Terminal)
127
- ```
128
-
129
- > [!NOTE]
130
- > If `table_schema` is not specified, it will be generated automatically with all discovered fields and relationships
131
-
132
- Now, the `category` instance can be passed to `categories`.
133
-
134
- ### DRF class style schema
135
-
136
- ``` python
137
- from brilliance_admin import sqlalchemy
138
- from brilliance_admin.translations import TranslateText as _
139
-
140
- from your_project.models import Terminal
141
-
142
-
143
- class TerminalFiltersSchema(sqlalchemy.SQLAlchemyFieldsSchema):
144
- model = Terminal
145
- fields = ['id', 'created_at']
146
- created_at = schema.DateTimeField(range=True)
147
-
148
-
149
- class TerminalSchema(sqlalchemy.SQLAlchemyFieldsSchema):
150
- model = Terminal
151
- list_display = ['id', 'merchant_id']
152
-
153
-
154
- class TerminalAdmin(sqlalchemy.SQLAlchemyAdmin):
155
- db_async_session = async_sessionmaker
156
- model = Terminal
157
- title = _('terminals')
158
- icon = 'mdi-console-network-outline'
159
-
160
- ordering_fields = ['id']
161
- search_fields = ['id', 'title']
162
-
163
- table_schema = TerminalSchema()
164
- table_filters = TerminalFiltersSchema()
165
-
166
-
167
- category = TerminalAdmin()
168
- ```
169
-
170
- ### Can be used both via inheritance and instancing
171
-
172
- Optionally, functional-style generation can be used to reduce boilerplate code
173
-
174
- Availiable for `SQLAlchemyAdmin` and `SQLAlchemyFieldsSchema`
175
-
176
- ``` python
177
- category = sqlalchemy.SQLAlchemyAdmin(
178
- db_async_session=async_sessionmaker,
179
- model=Terminal,
180
-
181
- table_schema = sqlalchemy.SQLAlchemyFieldsSchema(
182
- model=Terminal,
183
- list_display=['id', 'merchant_id'],
184
- ),
185
- table_filters = sqlalchemy.SQLAlchemyFieldsSchema(
186
- model=Terminal,
187
- fields=['id', 'created_at'],
188
- created_at=schema.DateTimeField(range=True),
189
- ),
190
- )
191
- ```
192
-
193
- ### SQLAlchemy JWT Authentication
194
-
195
- ``` python
196
- auth = sqlalchemy.SQLAlchemyJWTAdminAuthentication(
197
- secret='auth_secret',
198
- db_async_session=async_session,
199
- user_model=User,
200
- )
201
- ```
202
-
203
- ## Comparison of Similar Projects
204
-
205
- | Criterion | Brilliance Admin | Django Admin/Unfold | FastAPI Admin | Starlette Admin |
206
- |---------|------------------|---------------|---------------|-----------------|
207
- | Base framework | FastAPI | Django | FastAPI | Starlette / FastAPI |
208
- | Rendering model | Prebuilt Vue 3 + Vuetify SPA + Jinja2 | Server-side Django templates | Server-side Jinja2 templates + Tabler UI | Server-side Jinja2 templates + Tabler UI |
209
- | Frontend architecture | Separate frontend (SPA) | Classic server-rendered UI | Server-rendered UI with JS interactivity | Server-rendered UI with JS interactivity |
210
- | Data source | Any source + SQLAlchemy | Django ORM | Tortoise ORM | Any source + SQLAlchemy, MongoDB |
211
- | Multiple databases per model | Yes | Database routers | No (global engine) | Yes (session per ModelView) |
212
- | Schema generation | User-defined format | From Django models | From ORM models | User-defined format |
213
- | Async support | Yes | No | Yes | Yes |
214
- | API-first approach | Yes | No | Partially | Partially |
@@ -1,17 +0,0 @@
1
- GNU AFFERO GENERAL PUBLIC LICENSE
2
- Version 3, 19 November 2007
3
-
4
- Copyright (C) 2025 Your Name
5
-
6
- This program is free software: you can redistribute it and/or modify
7
- it under the terms of the GNU Affero General Public License as published
8
- by the Free Software Foundation, either version 3 of the License, or
9
- (at your option) any later version.
10
-
11
- This program is distributed in the hope that it will be useful,
12
- but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- GNU Affero General Public License for more details.
15
-
16
- You should have received a copy of the GNU Affero General Public License
17
- along with this program. If not, see <https://www.gnu.org/licenses/>.