-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a firmware library of reusable common functions #275
Comments
This issue was inspired by the work in #248 which builds off of the functionality of several excellent preceding scripts. Other script authors have also expressed interest in reusing some of that shared behavior such as the Euclidean Rhythm pattern generator. We have some precedence in shared code with the Knobs functionality in: https://github.com/Allen-Synthesis/EuroPi/tree/main/software/firmware/experimental |
Proposed workflow for script authors from @mjaskula A potential approach:
|
The firmware package is already a 'library of reusable common functions'. I'd rather that we not propose a place within the The firmware package should be organized by functionality, not by the source of the code. The features that distinguish code that resides within the firmware package from code without should be things like: stability, usefulness, documentation, tests and our ability to maintain it. So I would propose that the following is needed to resolve this issue:
|
I think that the firmware i.e. europi.py only, should be only for interacting with the hardware itself. Anything else, even if it's very relevant to the fact that it is a module, should be separate, but I agree, probably all in one place, and probably without the name 'experimental'. I'm not sure what a great name would be I'll have to think, but something along the lines of 'contrib library' - a library where users can submit PRs to add classes and functions which are likely to be useful to other programmers, and which can be bundled with europi.py in every implementation other than a user writing their own script from scratch without using anyone else's code beyond europi.py I definitely think that people shouldn't be importing things from other contrib scripts, that seems like a recipe for disaster given that scripts do actually get updated (for example the consequencer gets updated pretty regularly) and I would like to keep away from a situation where a small change to one script that might seem innocuous has the potential ability to 'break' other scripts in the contrib folder. It works for now, but I'd like to get to a point where anything people are choosing to import from other scripts now can be condensed down to the most non-specific implementation of whatever the class/function is doing, and then put that in a single big contrib library |
I just started writing some oscillator stuff using @t-schreibs PIOClock library, and then noticed that the class is named differently in the polysquare code, so I think that's a good example of how some things will need to be moved around (with the consent of the original script creators), for example PIOClock would be a class in the new contrib library, and then polysquare.py can import it as SquareOscillator if it wants to keep the name. That way users who aren't using it as a square oscillator can still use the great code and no contrib script has to rely on another |
Given the number of recent additions to the |
I agree that |
With the growing number of scripts, we are starting to see common functionality that might be beneficial to other scripts. Instead of copying & pasting or importing directly from other scripts, it would be better to have a library of reusable classes and functions.
Since this library is intended to be used by more than just one script, it's important that it has the following features:
Included with the firmware package - since any script could potentially use this library code, it should always be present alongside the firmware, not just
contrib
.Documentation - this will help with discoverability and make it easy to understand what to expect when using the class or function.
Tests - tests are important because we need to ensure that we know exactly how the library code behaves and if it ever needs to change, we understand the impact of those changes and how it could affect users of that code.
The text was updated successfully, but these errors were encountered: