Skip to content

MMCore: rename {Mock -> Client}DeviceAdapter and use shared_ptr - #1031

Merged
marktsuchida merged 1 commit into
micro-manager:mainfrom
marktsuchida:client-device-adapters
Nov 17, 2026
Merged

marktsuchida merged 1 commit into
micro-manager:mainfrom
marktsuchida:client-device-adapters

Conversation

@marktsuchida

Copy link
Copy Markdown
Member

Remove the "test only" note and rename, for use by pymmcore[-nano] to load Python device adapters. Still labeled "experimental" until we're sure about the API.

The adapter object is now taken by std::shared_ptr so that the caller (e.g., nanobind bindings) can add a custom deleter instead of manually keeping a reference to keep the object alive.

MMCore tests updated for the rename and the shared_ptr API.

MMCore minor version bumped. Only bumping the minor version even though loadMockDeviceAdapter() and MockDeviceAdapter were removed: they were documented as testing-only, subject to change, and excluded from the Java and Python bindings.

@tlambert03 This is what I've come up with in lieu of your mock-adapter-ownership-transfer patch. Probably should have been two separate commits (rename and use of shared_ptr) but oh well....

I think shared_ptr is more natural here (and potentially more correct in some edge cases), because ownership of the adapter object is shared between Python and MMCore. Pretty sure nanobind knows how to do that correctly with shared_ptr and that it will simplify the bindings, also because shared_ptr can carry a custom deleter (so intrusive ownership tracking doesn't need to be added to the object itself).

@tlambert03 tlambert03 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works for me from the perspective of pymmcore-nano unicore!

Remove the "test only" note and rename, for use by pymmcore[-nano] to
load Python device adapters. Still labeled "experimental" until we're
sure about the API.

The adapter object is now taken by `std::shared_ptr` so that the caller
(e.g., nanobind bindings) can add a custom deleter instead of manually
keeping a reference to keep the object alive.

MMCore tests updated for the rename and the `shared_ptr` API.

MMCore minor version bumped. Only bumping the minor version even though
`loadMockDeviceAdapter()` and `MockDeviceAdapter` were removed: they
were documented as testing-only, subject to change, and excluded from
the Java and Python bindings.

(Assisted by Claude Code; any errors are mine.)
@marktsuchida
marktsuchida force-pushed the client-device-adapters branch from 6f5e305 to 7749568 Compare November 17, 2026 10:57
@marktsuchida
marktsuchida merged commit 4e6f1c3 into micro-manager:main Nov 17, 2026
16 checks passed
@marktsuchida
marktsuchida deleted the client-device-adapters branch November 17, 2026 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants