Split harp.device into core, client and schema - #21
Merged
Conversation
harp.device becomes a PEP 420 namespace so a device package can be harp.device.<name>. The core register set and REGISTER_MAP move to harp.device.core, the device runtime and transport to harp.device.client, and the device.yml machinery to harp.device.schema. Every import of harp.device moves to the portion that owns the name.
bruno-f-cruz
approved these changes
Aug 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
harp.devicebecomes an empty PEP 420 namespace so that a device package can beharp.device.<name>, sitting beside the library portions rather than in a separateharp.devicestree that differs by one character.harpis already a namespace, since no distribution shipsharp/__init__.py. This does the same one level down. The requirement is that nothing shipsharp/device/__init__.py, whichharp-devicedid until now.The three portions
coreholds the 15 core registers, their 4 payload classes, 4 enums andREGISTER_MAP.clientholdsDevice,Subscription,EventHandler,ITransport,TransportErrorandHarpFramer.schemaholdscreate_device_module,parse_device_schema,DeviceModule,DeviceModuleLikeandConverterContext.The split follows the dependency graph rather than cutting across it.
coreimports nothing from the other two, andclientandschemaeach depend only oncore, so there are no cycles and no module had to be divided.harp-deviceremains a single distribution shipping all three portions. Nothing changes at the packaging level beyond dropping the__init__.py.Why the names
coreis the term this ecosystem already uses for the register set incore.yml, soharp.device.core.WhoAmIreads as it should. That is also the reason the device runtime did not go there. PuttingDeviceincorewould have read as though it were part of the core register set.clientmatches how the reference material already describes these implementations when comparing pyharp againstBonsai.Harp.Notable details
_schema/flattened intoschema/, and_emit_module.pybecameschema/_module.py. The three test modules that reached into the oldharp.device._schemaaggregate now name the owning module directly, which is more precise than the aggregate was.docs/api/device.mdhad to be rewritten, and mkdocstrings failing onharp.device.Deviceis what caught it. Sphinx-style cross-references in docstrings were swept as well, since those go stale silently.test_common_registers_are_not_device_modulenow asserts againstharp.device.core, which is the more precise statement of what it always meant.