Danbyte plugin template
A starter for building a Danbyte plugin. Click “Use this template” (or clone it), rename a few things, and you have a working plugin that adds a model, a REST API, a monitoring check kind, an automation provider, and server-driven UI — with no changes to Danbyte core and no frontend build.
Danbyte plugins are trusted, in-process Python packages (NetBox-style): an operator installs the package, lists it in the
PLUGINSsetting, and restarts. See the full guide: Danbyte docs → Architecture → Plugins.
What's in here
danbyte_myplugin/
├── apps.py # DanbytePluginConfig — plugin metadata
├── danbyte_plugin.py # THE registration entry point (autodiscovered)
├── models.py # a sample tenant-scoped model (Gadget)
├── serializers.py # DRF serializer (tags + custom fields)
├── viewsets.py # tenant-scoped, RBAC default-closed CRUD
├── api_urls.py # mounted at /api/plugins/<slug>/
├── checks.py # a sample monitoring check kind
└── migrations/
pyproject.toml # packaging (hatchling)
.github/workflows/ # publish to PyPI on release (Trusted Publishing)
Rename it (once)
Pick a name — e.g. danbyte_acme. Then:
- Rename the
danbyte_myplugin/folder →danbyte_acme/. - In
pyproject.toml:name = "danbyte-acme"andpackages = ["danbyte_acme"]. - In
apps.py:name = "danbyte_acme", and pick aslug(e.g.acme). - Search-and-replace
myplugin→acmeanddanbyte_myplugin→danbyte_acmeacross the package (slugs, URLs, the migration's model,audit_type). - Rename the sample
Gadgetmodel to yours (or delete it and add your own).
Develop against a Danbyte checkout
Your plugin imports from the host (core, api, auth_api, plugins,
danbyte_checks), so develop it inside a Danbyte environment:
# in your Danbyte checkout, with its virtualenv active
pip install -e /path/to/danbyte-acme # editable install
echo 'PLUGINS=danbyte_acme' >> .env # enable it
python manage.py makemigrations danbyte_acme # generate real migrations
python manage.py migrate
python manage.py runserver # (or restart your services)
Open Settings → Deployment → Plugins & services — your plugin appears as
loaded, and its nav item + pages show up (subject to RBAC). Grant yourself the
object-type permission (e.g. gadget) to see and edit rows.
What you can register (danbyte_plugin.py)
| You want… | Call / mixin |
|---|---|
| A model in RBAC + import/export + eventing | register_object_type("danbyte_acme.Gadget", "Gadgets", "Plugins") |
| Custom fields on it | mix in core.models.CustomFieldsMixin |
| Tags on it | mix in core.models.TaggableMixin |
| It targetable by object-reference custom fields | register_reference_model(ReferenceModel(...)) |
| Change-log / audit | register_audited_model("danbyte_acme.Gadget") |
| A REST API | ship api_urls.py (auto-mounted at /api/plugins/<slug>/) |
| An automation runner | register_automation_provider(kind, runner) |
| An import source / notification channel | register_import_source(...) / register_notification_channel(...) |
| A monitoring check kind | @danbyte_checks.base.register on a Checker |
| Sidebar nav / pages / dashboard panels | register_nav_item / register_page / register_dashboard_panel |
Rules that matter
apps.pyand__init__.pymust be import-safe — no model imports at the top level (Danbyte reads your metadata before the app registry exists).- Every model uses a UUID primary key and a
tenantFK; scope all querysets to the active tenant (theTenantScopedViewSetbase does this). - New endpoints are default-closed — registering the object type is what
makes yours require a
<model>.*grant. Never trust a client-supplied id to belong to the current tenant.
Publish to PyPI
The included workflow publishes on a GitHub Release using Trusted Publishing (OIDC — no token stored):
- On PyPI: create the project (or reserve the name), then Publishing → add a
GitHub publisher: owner
your-org, repodanbyte-acme, workflowpublish.yml, environmentpypi. - In GitHub: create an environment named
pypi. - Cut a GitHub Release (tag e.g.
v0.1.0). The workflow builds and uploads.
Prefer a token? Set a PYPI_API_TOKEN repo secret and pass it to the publish
step (see the comment in .github/workflows/publish.yml). Never commit a
token.
Users then install your plugin with pip install danbyte-acme, add it to
PLUGINS, and apply (migrate + restart).
License
Apache-2.0, matching Danbyte. Change it to suit your plugin.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file danbyte_myplugin-0.1.0.tar.gz.
File metadata
- Download URL: danbyte_myplugin-0.1.0.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
703af9af273b2b28b6b753077e9a6fbc0cd3f23a63f90604a5d1a74b7908923b
|
|
| MD5 |
a757231572e6cc7ca0af709e56421dad
|
|
| BLAKE2b-256 |
1ca074b85fdec3351720c3be636d61dd0c2ebc1bd77343473f818e8f58542f4f
|
Provenance
The following attestation bundles were made for danbyte_myplugin-0.1.0.tar.gz:
Publisher:
publish.yml on danbyte-net/danbyte-plugin-template
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
danbyte_myplugin-0.1.0.tar.gz -
Subject digest:
703af9af273b2b28b6b753077e9a6fbc0cd3f23a63f90604a5d1a74b7908923b - Sigstore transparency entry: 2211351398
- Sigstore integration time:
-
Permalink:
danbyte-net/danbyte-plugin-template@b595817397a9d79136be6912e742523adffa0aa3 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/danbyte-net
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b595817397a9d79136be6912e742523adffa0aa3 -
Trigger Event:
release
-
Statement type:
File details
Details for the file danbyte_myplugin-0.1.0-py3-none-any.whl.
File metadata
- Download URL: danbyte_myplugin-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44aeb2a77b67eeabc20e8f47d19186287b770a1493f77f69cb23e59a95a3f25a
|
|
| MD5 |
ff32628d10b42f902b69085ea38d7738
|
|
| BLAKE2b-256 |
6793e36898934bdfca8a36d82dd75f5bc50329f7fc746bb0ea987462d61165ad
|
Provenance
The following attestation bundles were made for danbyte_myplugin-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on danbyte-net/danbyte-plugin-template
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
danbyte_myplugin-0.1.0-py3-none-any.whl -
Subject digest:
44aeb2a77b67eeabc20e8f47d19186287b770a1493f77f69cb23e59a95a3f25a - Sigstore transparency entry: 2211351413
- Sigstore integration time:
-
Permalink:
danbyte-net/danbyte-plugin-template@b595817397a9d79136be6912e742523adffa0aa3 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/danbyte-net
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b595817397a9d79136be6912e742523adffa0aa3 -
Trigger Event:
release
-
Statement type: