Skip to content

Show how to auto-import plugin custom messages#12

Merged
schaubh merged 4 commits into
developfrom
feature/recorder_fix
May 29, 2026
Merged

Show how to auto-import plugin custom messages#12
schaubh merged 4 commits into
developfrom
feature/recorder_fix

Conversation

@schaubh

@schaubh schaubh commented May 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Document the required package initialization pattern for SDK plugins with custom messages.

Plugins that generate custom message bindings should import their generated messaging package before importing SWIG module wrappers:

from . import messaging
from . import myModule

This mirrors Basilisk’s own package-level messaging import and ensures custom Message<T> / Recorder<T> SWIG proxy classes are registered before users access module message fields.

Changes

  • Updated the custom atmosphere plugin example to import custom_atm.messaging from custom_atm.__init__.
  • Added documentation explaining why generated plugin messaging must be imported before module wrappers.
  • Added a generated messaging/__init__.py docstring describing recorder proxy registration.
  • Updated the example tests to use package-exposed generated messaging instead of explicitly importing message classes.

Testing

  • git diff --check
  • python3 -m py_compile examples/custom-atm-plugin/custom_atm/__init__.py examples/custom-atm-plugin/customExponentialAtmosphere/_UnitTest/test_customExponentialAtmosphere.py

pytest was not run locally because this environment does not have pytest installed.

@schaubh schaubh requested a review from ReeceHumphreys May 28, 2026 03:35
@schaubh schaubh self-assigned this May 28, 2026
@schaubh schaubh added the enhancement New feature or request label May 28, 2026
@schaubh schaubh added this to Basilisk May 28, 2026
Import generated custom message bindings from the sample plugin package
initializer before loading SWIG module wrappers. This mirrors Basilisk's
core messaging auto-import behavior and lets plugin users create recorders
for generated custom messages without importing message types manually.

Update the custom plugin docs and tests to demonstrate package-level
messaging exposure, and add context to generated messaging package init
files explaining why importing them registers custom Message<T> and
Recorder<T> proxies.
@schaubh schaubh force-pushed the feature/recorder_fix branch from c81c508 to 2d22d70 Compare May 28, 2026 03:36
@schaubh schaubh force-pushed the feature/recorder_fix branch from 5ed3eaa to 01605f3 Compare May 28, 2026 13:12
@schaubh schaubh moved this to 👀 In review in Basilisk May 28, 2026
@ReeceHumphreys

Copy link
Copy Markdown
Collaborator

Thanks for the fixes! In the future we probably want to update the cmake with a bsk_configure_package_init or something along those lines. Then users could just add this to their cmake:

bsk_configure_package_init(
  PACKAGE_DIR    "${PLUGIN_PKG_DIR}"
  SWIG_MODULES   customExponentialAtmosphere
)

I think this solution you have done is good for now though while we flesh out the SDK as it will unblock early adopters of it!

@schaubh

schaubh commented May 29, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback @ReeceHumphreys. The current solution does mimic what we are doing with BSK itself as well. So, at least we are consistent. If there is a better way to do this we can update both BSK and BSK-SDK.

@schaubh schaubh merged commit a032970 into develop May 29, 2026
18 checks passed
schaubh added a commit that referenced this pull request May 29, 2026
Import generated custom message bindings from the sample plugin package
initializer before loading SWIG module wrappers. This mirrors Basilisk's
core messaging auto-import behavior and lets plugin users create recorders
for generated custom messages without importing message types manually.

Update the custom plugin docs and tests to demonstrate package-level
messaging exposure, and add context to generated messaging package init
files explaining why importing them registers custom Message<T> and
Recorder<T> proxies.
@schaubh schaubh deleted the feature/recorder_fix branch May 29, 2026 13:52
@github-project-automation github-project-automation Bot moved this from 👀 In review to ✅ Done in Basilisk May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

2 participants