keepup-admin 0.1.0__tar.gz
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.
- keepup_admin-0.1.0/LICENSE +202 -0
- keepup_admin-0.1.0/NOTICE +22 -0
- keepup_admin-0.1.0/PKG-INFO +117 -0
- keepup_admin-0.1.0/README.md +81 -0
- keepup_admin-0.1.0/THIRD-PARTY.md +44 -0
- keepup_admin-0.1.0/__init__.py +41 -0
- keepup_admin-0.1.0/api_versions.py +100 -0
- keepup_admin-0.1.0/audit.py +499 -0
- keepup_admin-0.1.0/auth/__init__.py +7 -0
- keepup_admin-0.1.0/auth/config.py +128 -0
- keepup_admin-0.1.0/auth/dependencies.py +485 -0
- keepup_admin-0.1.0/auth/dto/__init__.py +0 -0
- keepup_admin-0.1.0/auth/dto/token.py +31 -0
- keepup_admin-0.1.0/auth/factory.py +28 -0
- keepup_admin-0.1.0/auth/login_throttle.py +151 -0
- keepup_admin-0.1.0/auth/oidc.py +245 -0
- keepup_admin-0.1.0/auth/oidc_policy.py +111 -0
- keepup_admin-0.1.0/auth/oidc_routes.py +288 -0
- keepup_admin-0.1.0/auth/panel_session.py +220 -0
- keepup_admin-0.1.0/auth/permissions.py +59 -0
- keepup_admin-0.1.0/auth/providers/__init__.py +0 -0
- keepup_admin-0.1.0/auth/providers/base.py +168 -0
- keepup_admin-0.1.0/auth/providers/local.py +180 -0
- keepup_admin-0.1.0/auth/routes.py +660 -0
- keepup_admin-0.1.0/auth/seed_accounts.py +322 -0
- keepup_admin-0.1.0/auth/session_lifetime.py +104 -0
- keepup_admin-0.1.0/auth/signing_key.py +138 -0
- keepup_admin-0.1.0/auth/websocket.py +86 -0
- keepup_admin-0.1.0/cluster.py +634 -0
- keepup_admin-0.1.0/db.py +663 -0
- keepup_admin-0.1.0/events.py +764 -0
- keepup_admin-0.1.0/factory.py +484 -0
- keepup_admin-0.1.0/instance.py +46 -0
- keepup_admin-0.1.0/integrations.py +260 -0
- keepup_admin-0.1.0/keepup_admin.egg-info/PKG-INFO +117 -0
- keepup_admin-0.1.0/keepup_admin.egg-info/SOURCES.txt +167 -0
- keepup_admin-0.1.0/keepup_admin.egg-info/dependency_links.txt +1 -0
- keepup_admin-0.1.0/keepup_admin.egg-info/requires.txt +17 -0
- keepup_admin-0.1.0/keepup_admin.egg-info/top_level.txt +1 -0
- keepup_admin-0.1.0/locks.py +412 -0
- keepup_admin-0.1.0/logging_setup.py +690 -0
- keepup_admin-0.1.0/metrics.py +818 -0
- keepup_admin-0.1.0/metrics_retention.py +376 -0
- keepup_admin-0.1.0/modules.py +572 -0
- keepup_admin-0.1.0/notification_bus.py +355 -0
- keepup_admin-0.1.0/plugins/__init__.py +9 -0
- keepup_admin-0.1.0/plugins/admin.py +246 -0
- keepup_admin-0.1.0/plugins/base.py +234 -0
- keepup_admin-0.1.0/plugins/enablement.py +184 -0
- keepup_admin-0.1.0/plugins/registry.py +171 -0
- keepup_admin-0.1.0/plugins/route_mask.py +338 -0
- keepup_admin-0.1.0/plugins/routes.py +376 -0
- keepup_admin-0.1.0/pyproject.toml +143 -0
- keepup_admin-0.1.0/roles.py +17 -0
- keepup_admin-0.1.0/scheduler.py +93 -0
- keepup_admin-0.1.0/schema.py +295 -0
- keepup_admin-0.1.0/sections.json +104 -0
- keepup_admin-0.1.0/settings.py +184 -0
- keepup_admin-0.1.0/setup.cfg +4 -0
- keepup_admin-0.1.0/static/css/aos.css +1 -0
- keepup_admin-0.1.0/static/css/main_nebula.css +232 -0
- keepup_admin-0.1.0/static/css/main_new.css +852 -0
- keepup_admin-0.1.0/static/css/tailwind.css +1 -0
- keepup_admin-0.1.0/static/index_nebula.html +293 -0
- keepup_admin-0.1.0/static/index_new.html +286 -0
- keepup_admin-0.1.0/static/js/aos.js +1 -0
- keepup_admin-0.1.0/static/js/feather-icons.js +13 -0
- keepup_admin-0.1.0/static/js/main_new.js +1861 -0
- keepup_admin-0.1.0/static/js/tailwind.js +83 -0
- keepup_admin-0.1.0/static/modules/css/background_tasks.css +233 -0
- keepup_admin-0.1.0/static/modules/css/cluster.css +16 -0
- keepup_admin-0.1.0/static/modules/css/event_manager.css +386 -0
- keepup_admin-0.1.0/static/modules/css/integration_logs.css +33 -0
- keepup_admin-0.1.0/static/modules/css/metrics.css +115 -0
- keepup_admin-0.1.0/static/modules/css/modules.css +189 -0
- keepup_admin-0.1.0/static/modules/css/themes.css +563 -0
- keepup_admin-0.1.0/static/modules/css/users.css +278 -0
- keepup_admin-0.1.0/static/modules/js/background_tasks.js +657 -0
- keepup_admin-0.1.0/static/modules/js/chart.js +14 -0
- keepup_admin-0.1.0/static/modules/js/chartjs-adapter-date-fns.bundle.min.js +7 -0
- keepup_admin-0.1.0/static/modules/js/cluster.js +363 -0
- keepup_admin-0.1.0/static/modules/js/event_manager.js +979 -0
- keepup_admin-0.1.0/static/modules/js/integration_logs.js +767 -0
- keepup_admin-0.1.0/static/modules/js/metrics.js +908 -0
- keepup_admin-0.1.0/static/modules/js/modules.js +1086 -0
- keepup_admin-0.1.0/static/modules/js/themes.js +653 -0
- keepup_admin-0.1.0/static/modules/js/users.js +784 -0
- keepup_admin-0.1.0/tables.py +302 -0
- keepup_admin-0.1.0/themes.py +496 -0
- keepup_admin-0.1.0/web.py +182 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
KeepUP — an admin framework over FastAPI
|
|
2
|
+
Copyright 2026 Fedor Sergeev
|
|
3
|
+
|
|
4
|
+
This product includes software developed by Fedor Sergeev.
|
|
5
|
+
|
|
6
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
7
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
8
|
+
License in the LICENSE file beside this one, or at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
13
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
14
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
15
|
+
specific language governing permissions and limitations under the License.
|
|
16
|
+
|
|
17
|
+
--------------------------------------------------------------------------------
|
|
18
|
+
|
|
19
|
+
This package also ships five third-party front-end bundles, all under the MIT
|
|
20
|
+
licence. They are minified, which stripped their own licence headers, so their
|
|
21
|
+
notices travel in THIRD-PARTY.md beside this file. The Apache licence above does
|
|
22
|
+
not reach them; they stay under their own terms.
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: keepup-admin
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: An admin framework over FastAPI: plugins, panel, users, replicas
|
|
5
|
+
Author-email: Fedor Sergeev <fksergeev@gmail.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/FedorSergeev/keepup-admin
|
|
8
|
+
Project-URL: Repository, https://github.com/FedorSergeev/keepup-admin
|
|
9
|
+
Keywords: fastapi,admin,plugins,framework
|
|
10
|
+
Classifier: Framework :: FastAPI
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
14
|
+
Requires-Python: >=3.11
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
License-File: NOTICE
|
|
18
|
+
License-File: THIRD-PARTY.md
|
|
19
|
+
Requires-Dist: fastapi<1,>=0.128
|
|
20
|
+
Requires-Dist: starlette<1,>=0.52
|
|
21
|
+
Requires-Dist: pydantic<3,>=2.11
|
|
22
|
+
Requires-Dist: sqlalchemy<3,>=2.0
|
|
23
|
+
Requires-Dist: psycopg2-binary>=2.9
|
|
24
|
+
Requires-Dist: apscheduler<4,>=3.10
|
|
25
|
+
Requires-Dist: bcrypt<5,>=4.0
|
|
26
|
+
Requires-Dist: python-jose<4,>=3.5
|
|
27
|
+
Requires-Dist: python-multipart>=0.0.20
|
|
28
|
+
Requires-Dist: PyYAML<7,>=6.0
|
|
29
|
+
Requires-Dist: psutil>=7.0
|
|
30
|
+
Requires-Dist: prometheus-client>=0.24
|
|
31
|
+
Requires-Dist: requests>=2.31
|
|
32
|
+
Requires-Dist: httpx>=0.28
|
|
33
|
+
Provides-Extra: postgres
|
|
34
|
+
Requires-Dist: asyncpg>=0.31; extra == "postgres"
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
|
|
37
|
+
# keepup
|
|
38
|
+
|
|
39
|
+
An admin framework over FastAPI. You give it settings; it gives you an
|
|
40
|
+
application with a panel, a plugin runtime, users, a database layer, an audit,
|
|
41
|
+
metrics and coordination between replicas already wired.
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from keepup import KeepupSettings, create_app
|
|
45
|
+
|
|
46
|
+
app = create_app(KeepupSettings(title="Your product", project_name="yours"))
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
That is a running application with a working panel at `/selfcare`: the shell,
|
|
50
|
+
the themes and eight administrative sections ship inside the package, so there
|
|
51
|
+
is nothing to copy into your tree to see them.
|
|
52
|
+
|
|
53
|
+
Installed as `keepup-admin`; imported as `keepup`. The name `keepup` on PyPI
|
|
54
|
+
belongs to an unrelated project from 2015 that installs a script and no module,
|
|
55
|
+
so the import name is free.
|
|
56
|
+
|
|
57
|
+
## What it gives you
|
|
58
|
+
|
|
59
|
+
| | |
|
|
60
|
+
|---|---|
|
|
61
|
+
| **Application assembly** | `create_app(settings)` — FastAPI, middleware, lifespan, static mounts |
|
|
62
|
+
| **Plugin runtime** | features as plugins; routes are data, not decorators |
|
|
63
|
+
| **Panel** | the shell, visual themes, and the catalogue of sections with role grants |
|
|
64
|
+
| **Users** | local accounts, roles, panel sessions, sign-in through an external provider |
|
|
65
|
+
| **Database** | a SQLAlchemy layer with a pool, table declarations for two dialects |
|
|
66
|
+
| **Replicas** | distributed locks, leader election, a message bus, a cluster registry |
|
|
67
|
+
| **Observability** | audit of incoming requests, an event log, metrics, log shipping |
|
|
68
|
+
|
|
69
|
+
## What it does not decide for you
|
|
70
|
+
|
|
71
|
+
The framework carries no product. Anything it cannot know arrives through
|
|
72
|
+
`KeepupSettings`: your name and version, where your logs are shipped, which
|
|
73
|
+
fields of a request are secret, what a password must look like, which tables
|
|
74
|
+
belong to you, which origins may read your answers.
|
|
75
|
+
|
|
76
|
+
Where a default would have to guess, it closes rather than opens. Metrics are
|
|
77
|
+
not served without credentials, no origin is allowed cross-origin, the audit
|
|
78
|
+
keeps field names and not values, and there is no collector address, no signing
|
|
79
|
+
key and no password anywhere in the source. An application says what it needs
|
|
80
|
+
open; the package does not decide that on its behalf.
|
|
81
|
+
|
|
82
|
+
## What is public
|
|
83
|
+
|
|
84
|
+
A module that an application may import from declares `__all__`. Everything
|
|
85
|
+
else is internal and may change without notice — including any name starting
|
|
86
|
+
with an underscore, whatever module it sits in.
|
|
87
|
+
|
|
88
|
+
`keepup/tests/public_interface_tests.py` holds this to the applications in the
|
|
89
|
+
repository: a name taken out of the framework and not declared public fails the
|
|
90
|
+
run, and the failure says what to do about it.
|
|
91
|
+
|
|
92
|
+
## Requirements
|
|
93
|
+
|
|
94
|
+
Python 3.11 or newer. PostgreSQL in production; SQLite works and is meant for
|
|
95
|
+
development. `pip install keepup-admin[postgres]` adds the driver the bus
|
|
96
|
+
between replicas needs.
|
|
97
|
+
|
|
98
|
+
## Tests
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
ci/tests/keepup.sh # the framework's own suite, needs no application
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
The suite runs against SQLite with no network and holds a coverage floor. The
|
|
105
|
+
plugin runtime is the least covered part of the framework, and deliberately so
|
|
106
|
+
for now: the test that exercises it hardest stands up a real application's
|
|
107
|
+
plugins and therefore lives with that application. See `doc/keepup.md`.
|
|
108
|
+
|
|
109
|
+
## Licence
|
|
110
|
+
|
|
111
|
+
Apache 2.0. See `LICENSE`, and `NOTICE` for the attribution that clause 4(d)
|
|
112
|
+
asks to travel with a derivative.
|
|
113
|
+
|
|
114
|
+
The panel's front end also ships five third-party bundles -- Tailwind, Feather,
|
|
115
|
+
AOS, Chart.js and its date adapter. All five are MIT and stay under their own
|
|
116
|
+
terms; minification stripped their headers, so their notices live in
|
|
117
|
+
`THIRD-PARTY.md`.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# keepup
|
|
2
|
+
|
|
3
|
+
An admin framework over FastAPI. You give it settings; it gives you an
|
|
4
|
+
application with a panel, a plugin runtime, users, a database layer, an audit,
|
|
5
|
+
metrics and coordination between replicas already wired.
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
from keepup import KeepupSettings, create_app
|
|
9
|
+
|
|
10
|
+
app = create_app(KeepupSettings(title="Your product", project_name="yours"))
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
That is a running application with a working panel at `/selfcare`: the shell,
|
|
14
|
+
the themes and eight administrative sections ship inside the package, so there
|
|
15
|
+
is nothing to copy into your tree to see them.
|
|
16
|
+
|
|
17
|
+
Installed as `keepup-admin`; imported as `keepup`. The name `keepup` on PyPI
|
|
18
|
+
belongs to an unrelated project from 2015 that installs a script and no module,
|
|
19
|
+
so the import name is free.
|
|
20
|
+
|
|
21
|
+
## What it gives you
|
|
22
|
+
|
|
23
|
+
| | |
|
|
24
|
+
|---|---|
|
|
25
|
+
| **Application assembly** | `create_app(settings)` — FastAPI, middleware, lifespan, static mounts |
|
|
26
|
+
| **Plugin runtime** | features as plugins; routes are data, not decorators |
|
|
27
|
+
| **Panel** | the shell, visual themes, and the catalogue of sections with role grants |
|
|
28
|
+
| **Users** | local accounts, roles, panel sessions, sign-in through an external provider |
|
|
29
|
+
| **Database** | a SQLAlchemy layer with a pool, table declarations for two dialects |
|
|
30
|
+
| **Replicas** | distributed locks, leader election, a message bus, a cluster registry |
|
|
31
|
+
| **Observability** | audit of incoming requests, an event log, metrics, log shipping |
|
|
32
|
+
|
|
33
|
+
## What it does not decide for you
|
|
34
|
+
|
|
35
|
+
The framework carries no product. Anything it cannot know arrives through
|
|
36
|
+
`KeepupSettings`: your name and version, where your logs are shipped, which
|
|
37
|
+
fields of a request are secret, what a password must look like, which tables
|
|
38
|
+
belong to you, which origins may read your answers.
|
|
39
|
+
|
|
40
|
+
Where a default would have to guess, it closes rather than opens. Metrics are
|
|
41
|
+
not served without credentials, no origin is allowed cross-origin, the audit
|
|
42
|
+
keeps field names and not values, and there is no collector address, no signing
|
|
43
|
+
key and no password anywhere in the source. An application says what it needs
|
|
44
|
+
open; the package does not decide that on its behalf.
|
|
45
|
+
|
|
46
|
+
## What is public
|
|
47
|
+
|
|
48
|
+
A module that an application may import from declares `__all__`. Everything
|
|
49
|
+
else is internal and may change without notice — including any name starting
|
|
50
|
+
with an underscore, whatever module it sits in.
|
|
51
|
+
|
|
52
|
+
`keepup/tests/public_interface_tests.py` holds this to the applications in the
|
|
53
|
+
repository: a name taken out of the framework and not declared public fails the
|
|
54
|
+
run, and the failure says what to do about it.
|
|
55
|
+
|
|
56
|
+
## Requirements
|
|
57
|
+
|
|
58
|
+
Python 3.11 or newer. PostgreSQL in production; SQLite works and is meant for
|
|
59
|
+
development. `pip install keepup-admin[postgres]` adds the driver the bus
|
|
60
|
+
between replicas needs.
|
|
61
|
+
|
|
62
|
+
## Tests
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
ci/tests/keepup.sh # the framework's own suite, needs no application
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The suite runs against SQLite with no network and holds a coverage floor. The
|
|
69
|
+
plugin runtime is the least covered part of the framework, and deliberately so
|
|
70
|
+
for now: the test that exercises it hardest stands up a real application's
|
|
71
|
+
plugins and therefore lives with that application. See `doc/keepup.md`.
|
|
72
|
+
|
|
73
|
+
## Licence
|
|
74
|
+
|
|
75
|
+
Apache 2.0. See `LICENSE`, and `NOTICE` for the attribution that clause 4(d)
|
|
76
|
+
asks to travel with a derivative.
|
|
77
|
+
|
|
78
|
+
The panel's front end also ships five third-party bundles -- Tailwind, Feather,
|
|
79
|
+
AOS, Chart.js and its date adapter. All five are MIT and stay under their own
|
|
80
|
+
terms; minification stripped their headers, so their notices live in
|
|
81
|
+
`THIRD-PARTY.md`.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Third-party code shipped with this package
|
|
2
|
+
|
|
3
|
+
The panel's front end is served from the package itself, and five of its files
|
|
4
|
+
are third-party bundles rather than our code. They are vendored — kept in the
|
|
5
|
+
tree and served from it — rather than fetched from a CDN, because the panel of
|
|
6
|
+
an administrative tool should not depend on somebody else's server being up,
|
|
7
|
+
and because a page that loads nothing from outside is one fewer place a
|
|
8
|
+
deployment has to reason about.
|
|
9
|
+
|
|
10
|
+
All five are minified, and minification stripped their licence headers. That
|
|
11
|
+
is what this file is for: every one of them is MIT, and MIT asks that its
|
|
12
|
+
notice travel with the copy.
|
|
13
|
+
|
|
14
|
+
| File | Project | Licence |
|
|
15
|
+
|---|---|---|
|
|
16
|
+
| `static/js/tailwind.js` | Tailwind CSS (browser build) — https://tailwindcss.com | MIT, Copyright (c) Tailwind Labs, Inc. |
|
|
17
|
+
| `static/js/feather-icons.js` | Feather — https://feathericons.com | MIT, Copyright (c) 2013-2023 Cole Bemis |
|
|
18
|
+
| `static/js/aos.js` | AOS — https://michalsnik.github.io/aos/ | MIT, Copyright (c) 2015 Michał Sajnóg |
|
|
19
|
+
| `static/modules/js/chart.js` | Chart.js — https://www.chartjs.org | MIT, Copyright (c) Chart.js Contributors |
|
|
20
|
+
| `static/modules/js/chartjs-adapter-date-fns.bundle.min.js` | chartjs-adapter-date-fns — https://github.com/chartjs/chartjs-adapter-date-fns | MIT, Copyright (c) Chart.js Contributors |
|
|
21
|
+
|
|
22
|
+
## The MIT licence
|
|
23
|
+
|
|
24
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
25
|
+
> of this software and associated documentation files (the "Software"), to deal
|
|
26
|
+
> in the Software without restriction, including without limitation the rights
|
|
27
|
+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
28
|
+
> copies of the Software, and to permit persons to whom the Software is
|
|
29
|
+
> furnished to do so, subject to the following conditions:
|
|
30
|
+
>
|
|
31
|
+
> The above copyright notice and this permission notice shall be included in all
|
|
32
|
+
> copies or substantial portions of the Software.
|
|
33
|
+
>
|
|
34
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
35
|
+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
36
|
+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
37
|
+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
38
|
+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
39
|
+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALING IN THE
|
|
40
|
+
> SOFTWARE.
|
|
41
|
+
|
|
42
|
+
The licence of this package, whatever it is, does not reach these five files:
|
|
43
|
+
they stay under the terms above, and replacing one of them means checking that
|
|
44
|
+
its replacement's terms still allow this.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""KeepUP — a framework over FastAPI for applications built like this one.
|
|
2
|
+
|
|
3
|
+
An application supplies a :class:`~keepup.settings.KeepupSettings` and gets an
|
|
4
|
+
application back from :func:`~keepup.factory.create_app`. Everything the
|
|
5
|
+
framework cannot know -- the product's name, the collector its logs go to,
|
|
6
|
+
which fields of a request are secret, what a password must look like, which
|
|
7
|
+
tables belong to the product -- travels in those settings, never as a default
|
|
8
|
+
in here. See ``doc/keepup.md``.
|
|
9
|
+
|
|
10
|
+
Imported lazily: ``keepup.factory`` pulls in the database layer and the
|
|
11
|
+
authentication provider, and importing the package to reach one constant
|
|
12
|
+
should not do that.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
#: The framework's own version, which is the version of the distribution it
|
|
16
|
+
#: was installed from -- not the version of the application it serves. The
|
|
17
|
+
#: application's version is its own metadata and reaches the framework through
|
|
18
|
+
#: settings; reading one for the other is how a panel ends up reporting the
|
|
19
|
+
#: framework's number as the product's (keepup-5).
|
|
20
|
+
try:
|
|
21
|
+
from importlib.metadata import version as _distribution_version
|
|
22
|
+
|
|
23
|
+
__version__ = _distribution_version("keepup-admin")
|
|
24
|
+
except Exception:
|
|
25
|
+
# Running from a source tree that was never installed -- the repository
|
|
26
|
+
# itself, until the applications switch to installing by version.
|
|
27
|
+
__version__ = "0.0.0+source"
|
|
28
|
+
|
|
29
|
+
__all__ = ["KeepupSettings", "StaticMount", "create_app", "__version__"]
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def __getattr__(name):
|
|
33
|
+
if name in ("KeepupSettings", "StaticMount"):
|
|
34
|
+
from keepup import settings
|
|
35
|
+
|
|
36
|
+
return getattr(settings, name)
|
|
37
|
+
if name == "create_app":
|
|
38
|
+
from keepup.factory import create_app
|
|
39
|
+
|
|
40
|
+
return create_app
|
|
41
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"""API versions: the version in the path, and the paths without one.
|
|
2
|
+
|
|
3
|
+
Clients cannot be updated together with the server: an agent is updated by the
|
|
4
|
+
host owner copying an archive, the client inside a VM by rebuilding the image.
|
|
5
|
+
So the model on the wire is pinned to a version named in the path -- `/api/v1/…`
|
|
6
|
+
for HTTP, `/ws/v1/…` for websockets -- and a later incompatible model gets a new
|
|
7
|
+
prefix while old clients keep talking to theirs.
|
|
8
|
+
|
|
9
|
+
v1 is the model the routes have today, and their handlers do not know about it:
|
|
10
|
+
this middleware maps `/api/v1/x` onto `/api/x` before routing, for the routes of
|
|
11
|
+
the application and of every plugin at once, so no route dictionary changes. A
|
|
12
|
+
path without a version stays an alias of v1 for as long as v1 exists (decision of
|
|
13
|
+
17.09.2026): the panel is served with the server and has no reason to move, and
|
|
14
|
+
agents already installed must not break. Its HTTP answers say so with a
|
|
15
|
+
`Deprecation` header and a link to the versioned path.
|
|
16
|
+
|
|
17
|
+
A future v2 route is registered under its own `/api/v2/…` path and is never
|
|
18
|
+
rewritten. `/api/v2/websocket/token` and `/ws/v2/websocket` predate this scheme:
|
|
19
|
+
they are the second version of the guest channel, whose first version is gone,
|
|
20
|
+
and are listed as such in `/api/versions`.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
from typing import Any, Dict, List
|
|
24
|
+
|
|
25
|
+
CURRENT = "v1"
|
|
26
|
+
|
|
27
|
+
#: Every version the server speaks. `sunset` is when a deprecated version stops
|
|
28
|
+
#: being served; None means no date is set.
|
|
29
|
+
VERSIONS: List[Dict[str, Any]] = [
|
|
30
|
+
{"version": "v1", "status": "current", "http_prefix": "/api/v1", "websocket_prefix": "/ws/v1",
|
|
31
|
+
"sunset": None},
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
#: Paths that carry their own version outside the scheme above.
|
|
35
|
+
CHANNEL_VERSIONS: List[Dict[str, str]] = [
|
|
36
|
+
{"channel": "guest", "version": "v2", "paths": "/api/v2/websocket/token, /ws/v2/websocket"},
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
#: Versioned prefix -> the unversioned prefix the routes are registered under.
|
|
40
|
+
ALIASES = {"/api/v1": "/api", "/ws/v1": "/ws"}
|
|
41
|
+
|
|
42
|
+
#: Unversioned paths that are not an alias of v1 and get no deprecation notice.
|
|
43
|
+
NOT_DEPRECATED = ("/api/versions", "/api/v2/", "/api/v3/")
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def unversioned(path: str):
|
|
47
|
+
"""The registered path for a versioned one, or None when the path has no v1 prefix."""
|
|
48
|
+
for versioned, plain in ALIASES.items():
|
|
49
|
+
if path == versioned or path.startswith(versioned + "/"):
|
|
50
|
+
return plain + path[len(versioned):]
|
|
51
|
+
return None
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def successor(path: str):
|
|
55
|
+
"""The versioned path a deprecated unversioned one should become, or None."""
|
|
56
|
+
if path.startswith(NOT_DEPRECATED) or path == "/api":
|
|
57
|
+
return None
|
|
58
|
+
for versioned, plain in ALIASES.items():
|
|
59
|
+
if path.startswith(plain + "/") and not path.startswith(versioned + "/"):
|
|
60
|
+
return versioned + path[len(plain):]
|
|
61
|
+
return None
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def describe() -> Dict[str, Any]:
|
|
65
|
+
return {"current": CURRENT, "versions": VERSIONS, "channels": CHANNEL_VERSIONS,
|
|
66
|
+
"unversioned_paths": "alias of " + CURRENT}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class ApiVersionMiddleware:
|
|
70
|
+
"""Route `/api/v1/…` and `/ws/v1/…` to the handlers, mark unversioned answers."""
|
|
71
|
+
|
|
72
|
+
def __init__(self, app):
|
|
73
|
+
self.app = app
|
|
74
|
+
|
|
75
|
+
async def __call__(self, scope, receive, send):
|
|
76
|
+
if scope["type"] not in ("http", "websocket"):
|
|
77
|
+
return await self.app(scope, receive, send)
|
|
78
|
+
|
|
79
|
+
path = scope.get("path", "")
|
|
80
|
+
plain = unversioned(path)
|
|
81
|
+
if plain is not None:
|
|
82
|
+
scope = dict(scope)
|
|
83
|
+
scope["path"] = plain
|
|
84
|
+
scope["raw_path"] = plain.encode("utf-8")
|
|
85
|
+
scope["api_version"] = CURRENT
|
|
86
|
+
return await self.app(scope, receive, send)
|
|
87
|
+
|
|
88
|
+
target = successor(path) if scope["type"] == "http" else None
|
|
89
|
+
if target is None:
|
|
90
|
+
return await self.app(scope, receive, send)
|
|
91
|
+
|
|
92
|
+
async def send_with_notice(message):
|
|
93
|
+
if message["type"] == "http.response.start":
|
|
94
|
+
headers = list(message.get("headers", []))
|
|
95
|
+
headers.append((b"deprecation", b"true"))
|
|
96
|
+
headers.append((b"link", f'<{target}>; rel="successor-version"'.encode("utf-8")))
|
|
97
|
+
message = {**message, "headers": headers}
|
|
98
|
+
await send(message)
|
|
99
|
+
|
|
100
|
+
return await self.app(scope, receive, send_with_notice)
|