Skip to content

Add template for Python interface generation#86

Open
MicBoucinha wants to merge 14 commits intoharp-tech:mainfrom
fchampalimaud:feature/python_interface
Open

Add template for Python interface generation#86
MicBoucinha wants to merge 14 commits intoharp-tech:mainfrom
fchampalimaud:feature/python_interface

Conversation

@MicBoucinha
Copy link
Contributor

PR changes

This PR introduces automatic generation of the Python interface for a device.

The base template used is a variation of https://github.com/fpgmaas/cookiecutter-uv.

The chosen python package structure is as follows:

harp/
    devices/
        <device_name>/
            __init__.py
            device.yml      # for reference of the device metadata used for the generation
            harpdevice.py
            

This PR is related to PR#3 of the pyharp repository due to PEP420 compliance for namespace packages, since we want to have a single namespace package for harp related packages.

The generated Python interface is a direct access type of interface, which means it provides a direct mapping to the device's functionality.

The package also includes a MKDocs configuration for documentation generation, focusing currently on the API documentation. The final documentation is available at https://fchampalimaud.github.io/pyharp/, which aggregates the documentation for the pyharp package and all devices under the harp.devices repository, currently available here: https://github.com/fchampalimaud/harp.devices.

MicBoucinha and others added 4 commits July 18, 2025 09:29
Co-authored-by: José Grilo <jose.grilo@research.fchampalimaud.org>
Co-authored-by: José Grilo <jose.grilo@research.fchampalimaud.org>
Co-authored-by: José Grilo <jose.grilo@research.fchampalimaud.org>
Co-authored-by: José Grilo <jose.grilo@research.fchampalimaud.org>
@MicBoucinha MicBoucinha requested a review from glopesdev July 18, 2025 10:07
@glopesdev
Copy link
Contributor

@MicBoucinha I need more context before being able to review this, there are simply too many architectural decisions here which I do not know about.

Can we schedule a slot in the Harp SCM so you can present and discuss this proposal please?

@MicBoucinha
Copy link
Contributor Author

Sure thing, just let us know when would be the best time for that.

MicBoucinha and others added 5 commits September 18, 2025 13:40
Co-authored-by: José Grilo <jose.grilo@research.fchampalimaud.org>
Co-authored-by: José Grilo <jose.grilo@research.fchampalimaud.org>
Co-authored-by: José Grilo <jose.grilo@research.fchampalimaud.org>
Co-authored-by: José Grilo <jose.grilo@research.fchampalimaud.org>
Co-authored-by: José Grilo <jose.grilo@research.fchampalimaud.org>
@MicBoucinha
Copy link
Contributor Author

Hi! We have made the following changes to the python interface generation:

  • Update return types to use the generated custom Payload types
  • Updated dependency to use harp-serial

Feel free to give us feedback where improvements can be done.

MicBoucinha and others added 5 commits October 24, 2025 16:00
Co-authored-by: José Grilo <jose.grilo@research.fchampalimaud.org>
- Update package build backend
- Update examples documentation generation

Co-authored-by: José Grilo <jose.grilo@research.fchampalimaud.org>
@glopesdev
Copy link
Contributor

glopesdev commented Feb 25, 2026

@MicBoucinha I have just refactored the generator project to make it easier to maintain (#90). This includes the ability to call the generators programmatically, and also a unit test suite to make sure we keep track of changes to the internal logic.

Internalizing the T4 templates also allows more easily writing generator helper code directly in C# with full code completion and type checking.

It would be useful to reorganize this PR to take advantage of the updated infrastructure, and also add tests for the generated Python interface. I can explain in more detail in one of the next SRM meetings.

@MicBoucinha
Copy link
Contributor Author

Hi @glopesdev, thanks for the heads-up.

When would be the best SRM meeting for that?

@glopesdev
Copy link
Contributor

@MicBoucinha we can discuss today if you happen to be around, or next week also works.

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