keepup-admin 0.6.0__tar.gz → 0.7.1__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.
Files changed (49) hide show
  1. {keepup_admin-0.6.0/keepup_admin.egg-info → keepup_admin-0.7.1}/PKG-INFO +1 -1
  2. {keepup_admin-0.6.0 → keepup_admin-0.7.1/keepup_admin.egg-info}/PKG-INFO +1 -1
  3. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/kernel/observability.py +24 -1
  4. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/pyproject.toml +1 -1
  5. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/settings.py +12 -0
  6. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/LICENSE +0 -0
  7. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/NOTICE +0 -0
  8. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/README.md +0 -0
  9. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/THIRD-PARTY.md +0 -0
  10. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/__init__.py +0 -0
  11. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/api_versions.py +0 -0
  12. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/builtin/audit.py +0 -0
  13. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/builtin/auth.py +0 -0
  14. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/builtin/db.py +0 -0
  15. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/builtin/postgres.py +0 -0
  16. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/builtin/sqlite.py +0 -0
  17. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/builtin/ui.py +0 -0
  18. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/builtin/users.py +0 -0
  19. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/cache.py +0 -0
  20. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/clock.py +0 -0
  21. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/instance.py +0 -0
  22. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/keepup_admin.egg-info/SOURCES.txt +0 -0
  23. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/keepup_admin.egg-info/dependency_links.txt +0 -0
  24. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/keepup_admin.egg-info/requires.txt +0 -0
  25. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/keepup_admin.egg-info/top_level.txt +0 -0
  26. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/kernel/__init__.py +0 -0
  27. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/kernel/call.py +0 -0
  28. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/kernel/catalogue.py +0 -0
  29. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/kernel/contributions.py +0 -0
  30. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/kernel/datasource.py +0 -0
  31. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/kernel/descriptor.py +0 -0
  32. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/kernel/lifecycle.py +0 -0
  33. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/kernel/loader.py +0 -0
  34. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/kernel/security.py +0 -0
  35. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/kernel/services.py +0 -0
  36. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/kernel/transports.py +0 -0
  37. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/locks.py +0 -0
  38. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/logging_setup.py +0 -0
  39. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/notification_bus.py +0 -0
  40. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/plugins/__init__.py +0 -0
  41. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/plugins/base.py +0 -0
  42. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/plugins/builtin.json +0 -0
  43. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/plugins/enablement.py +0 -0
  44. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/plugins/registry.py +0 -0
  45. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/plugins/route_mask.py +0 -0
  46. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/roles.py +0 -0
  47. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/sections.json +0 -0
  48. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/security.py +0 -0
  49. {keepup_admin-0.6.0 → keepup_admin-0.7.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: keepup-admin
3
- Version: 0.6.0
3
+ Version: 0.7.1
4
4
  Summary: An admin framework over FastAPI: plugins, panel, users, replicas
5
5
  Author-email: Fedor Sergeev <fksergeev@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: keepup-admin
3
- Version: 0.6.0
3
+ Version: 0.7.1
4
4
  Summary: An admin framework over FastAPI: plugins, panel, users, replicas
5
5
  Author-email: Fedor Sergeev <fksergeev@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -14,6 +14,8 @@ is set at start-up, and a deployment that sets nothing records nothing --
14
14
  which is a deployment, not a failure.
15
15
  """
16
16
 
17
+ import asyncio
18
+ import inspect
17
19
  from contextlib import asynccontextmanager
18
20
  from dataclasses import dataclass, field
19
21
  from functools import wraps
@@ -133,6 +135,27 @@ async def emit(event_type: str, payload: Mapping[str, Any] = None) -> int:
133
135
  return written
134
136
 
135
137
 
138
+ async def _run_route(handler, *args, **kwargs):
139
+ """Run a route the way the transport would, and hand back its answer.
140
+
141
+ A route is declared either with `async def` or with `def`, and the second is
142
+ a decision rather than an oversight: FastAPI runs a `def` route in a worker
143
+ thread, which is where a database call or a `bcrypt` hash belongs. The audit
144
+ wrapper around it is a coroutine either way, so awaiting a plain function was
145
+ a `TypeError` -- `object dict can't be used in 'await' expression` -- thrown
146
+ *after* the handler had already done its work: (0.7.0) the administrator's
147
+ password change and the profile update applied their change and answered 500
148
+ (keepup-182).
149
+
150
+ A synchronous handler therefore goes to a thread of its own, not to the event
151
+ loop; `asyncio.to_thread` copies the context, so the audit's request id and
152
+ actor are the ones the handler sees.
153
+ """
154
+ if inspect.iscoroutinefunction(handler):
155
+ return await handler(*args, **kwargs)
156
+ return await asyncio.to_thread(handler, *args, **kwargs)
157
+
158
+
136
159
  def audited(action: str, method: str = "POST", actor: str = "current_user",
137
160
  host: str = "framework"):
138
161
  """Record a framework route that the transport did not wrap (keepup-172).
@@ -160,7 +183,7 @@ def audited(action: str, method: str = "POST", actor: str = "current_user",
160
183
  caller = kwargs.get(actor)
161
184
  async with start_call(method, action, host, {}, actor=caller) as request_id:
162
185
  try:
163
- answer = await handler(*args, **kwargs)
186
+ answer = await _run_route(handler, *args, **kwargs)
164
187
  except Exception as error:
165
188
  await end_call(
166
189
  request_id,
@@ -17,7 +17,7 @@ build-backend = "setuptools.build_meta"
17
17
 
18
18
  [project]
19
19
  name = "keepup-admin"
20
- version = "0.6.0"
20
+ version = "0.7.1"
21
21
  description = "An admin framework over FastAPI: plugins, panel, users, replicas"
22
22
  readme = "README.md"
23
23
  requires-python = ">=3.11"
@@ -112,6 +112,18 @@ class KeepupSettings:
112
112
  # --- identity -------------------------------------------------------
113
113
  title: str = "KeepUP"
114
114
  project_name: str = "keepup"
115
+ #: The namespace of the panel's cookies (0.7.0). A cookie belongs to a
116
+ #: host, not to a port: several keepup applications opened on one host --
117
+ #: `localhost:8000` and `localhost:8010` -- used to write the same
118
+ #: `ss_session`, and whichever signed in last took the other's session
119
+ #: away. The names now carry this value (`ss_session_<prefix>`); None takes
120
+ #: the application's `project_name`, so two applications that name
121
+ #: themselves differently coexist without any further configuration. An
122
+ #: empty string keeps the shared names of 0.6.0 and earlier, which is right
123
+ #: only for a host that runs one keepup application. A value that is not a
124
+ #: legal cookie name is made into one, keeping a digest of what it was, so
125
+ #: two values never collapse into the same cookie.
126
+ cookie_prefix: Optional[str] = None
115
127
  docs_url: Optional[str] = "/api/docs"
116
128
  redoc_url: Optional[str] = "/api/redoc"
117
129
  #: Where the OpenAPI schema is served. None removes it, and the
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes