Generate the core register set - #28
Merged
Merged
Conversation
harp.device.core is now the generated Python interface for the core register metadata, installed verbatim as the package __init__.py, replacing a stale copy of that output and the two modules that wrapped it. The module docstring is generated from a description field in the metadata. The register set, enum members, masks and docstrings are unchanged, so the module still publishes the same 24 names and the same 15 register address map. Runtime emission is verified against the package itself and against core.yml vendored from the generator, so the expected_core copy and the common.yml fixture are both removed, and register layout is now compared for every core register. Requires the matching Python target change in harp-tech/generators.
Registers gains a description field, matching the top-level property in the generator object model, and create_device_module uses it as the module docstring.
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.device.coreis now a single generated file rather than generator output with hand-written modules around it. The register declarations have been generated since June, but the copy had gone stale, and it needed__init__.pyto re-export the names and_register_map.pyto declare the address map. The Python target now generates__all__andREGISTER_MAPitself, so the generated file is installed verbatim as the package__init__.pyand both hand-written modules are removed. This is also what makesfrom harp.device import core, behaviorsymmetric, since both become the same kind of artifact.test_core_register_structuralgets stronger as a result, since both sides now come from the same core metadata, where previously one came from the protocol file atv1.13.0and the other from the generator copy. Payload layout is now compared for all 15 core registers rather than 14.The published surface does not change
The differences against the previous copy are confined to the
Anyimport,__all__, the blank-line spacing between documented members, andREGISTER_MAParriving in the same file. Every register, enum member, mask and docstring is identical, so the module still publishes the same 24 names and the same 15 register address map, and it still declares noWHO_AM_I, so it stays outsideDeviceModuleLike. The_register_map.pydocstring teaching downstream packages to spread the map is already in theharp-deviceREADME.The module docstring now comes from the metadata
Generated output carried no module docstring, so installing it verbatim would have dropped the one this package had. The Python target now generates a top-level
descriptionfrom the metadata as the module docstring, and the core metadata declares one. Such a key already validates againstregisters.json, which sets noadditionalProperties: falseat its root, and the pyharp schema model already ignores unknown top-level keys.Registersnow carries the top-leveldescriptionthat the generator object model has, and a module built at runtime and a generated package now report the same__doc__for the same metadata.