nyxa-admin
Status: beta / experimental on the 0.x line. APIs may change before 1.0.
Nova-lite auto-CRUD for Nyxa — register ORM models and get
/_admin/<resource> list/detail/create/update/delete endpoints plus a
dashboard card, gated by a configurable admin.guard.
Features
AdminRegistry(app.admin) —admin.register(Model, name=None)exposes a model as a resource;list/get/create/update/deleteoperate on it (writes filtered to the model's writable fields).- CRUD routes — mounted at boot (internal):
GET /_admin/{resource}(list,limit=50),GET /_admin/{resource}/{pk}(detail),POST /_admin/{resource}(create),PUT /_admin/{resource}/{pk}(update),DELETE /_admin/{resource}/{pk}(delete). JSON responses; list/ detail render minimal HTML tables unless the requestAccepts JSON. - Guarded access —
admin.guardnames a callable receiving anAdminAuthzContext(action,resource,pk,ctx) per request; without a guard the panel answers only inapp.debug— denied requests get a bare 404 that doesn't disclose the panel. Mutating routes usecsrf=False; the guard is the real gate. Never use an always-allow guard (lambda _: True) in production. - Dashboard card — contributes an Admin tab listing registered
resources to
nyxa-horizon-style dashboards.
Install
nyxa add nyxa-admin
Usage
# in a provider's boot()
app.admin.register(User)
app.admin.register(Post, name="posts")
# production guard (debug-only by default) — config/admin.py:
from nyxa_admin import AdminAuthzContext
def guard(authz: AdminAuthzContext) -> bool:
user = authz.ctx.state.get("user")
return user is not None and getattr(user, "is_admin", False)
config = {"guard": guard} # sync or async callables
# or programmatically in a provider's register()/boot():
# app.config.set("admin.guard", guard)
GET /_admin/users now lists users; POST/PUT bodies are JSON and
filtered to writable fields.
Public API
AdminRegistry— bound asapp.admin:registry.register(model, name=None),registry.resource(name),registry.resources() -> dict,await registry.list(name, limit=50),await registry.get(name, pk),await registry.create(name, data),await registry.update(name, pk, data),await registry.delete(name, pk) -> bool.AdminAuthzContext— dataclass handed toadmin.guard:action("view"|"create"|"update"|"delete"),resource,pk(Noneon list/create),ctx(HttpContext).AdminProvider— bindsapp.admin, mounts the/_adminroutes, contributes the dashboard card, and publishesadmin.guard(defaultNone→ debug-only).
Configuration
config/admin.py (the config dict namespaces as admin.*):
config = {
"guard": None, # callable(authz: AdminAuthzContext) -> bool
# (legacy guard(ctx) still accepted, deprecated);
# None = panel answers only in debug
}
Testing
app.admin.register(User)
res = client.get("/_admin/users", headers={"accept": "application/json"})
assert res.status_code == 200
License
MIT
Metadata
Release files for nyxa-admin 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nyxa_admin-0.0.1.tar.gz | 10.8 kB | Without provenance | Details for nyxa_admin-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nyxa_admin-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for nyxa_admin-0.0.1-py3-none-any.whl |
Total release size: 19.7 kB
Release files / nyxa_admin-0.0.1.tar.gz
| Download URL | nyxa_admin-0.0.1.tar.gz |
|---|---|
| Size | 10.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3d361b0631358fc85e71c1f0005a375c7b03924e81793052cdd9d44692634535
|
|
BLAKE2b-256 checksum How to use checksums |
9ad643e02f8f160b0757999c7f01a24f688e3b0b45316ae9d614a6b25388b086
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / nyxa_admin-0.0.1-py3-none-any.whl
| Download URL | nyxa_admin-0.0.1-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cb08acd7443ca6489b9baefc9da1d5b9256bac450758c36bfc4689d5f8c47f84
|
|
BLAKE2b-256 checksum How to use checksums |
0dc54cd420b8cb716ca12c7e0525a4f8feb93536cf3104de04614add848e704b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for nyxa-admin 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.