Repository navigation
Replace GNU Make Codegen with Python - #2241
ni-jfitzger wants to merge 22 commits into
Conversation
…nto replace-gnu-make-with-python
…doing codegen" Turns out the templates do tweak some metadata, even though we can't see a difference in the output. This reverts commit 8fad161.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2241 +/- ##
==========================================
- Coverage 88.12% 87.90% -0.22%
==========================================
Files 88 89 +1
Lines 22830 23106 +276
==========================================
+ Hits 20118 20312 +194
- Misses 2712 2794 +82
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Something seems off about the reported code coverage for build/helper. |
Apparently --source is supposed to be a comma-separated list. You can't pass it twice in the same command. |
This is (or should be) irrelevant. |
Please ensure there is an open issue for this. |
Yes, I created one last week and we fixed and closed it. |
…ce-gnu-make-with-python
|
|
||
|
|
||
| @dataclass(frozen=True) | ||
| class Driver: |
There was a problem hiding this comment.
Let's consistently call these things driver API or driver bindings
Please check the repo to see which one we use more, including the main README.md.
There was a problem hiding this comment.
We use a mix of "driver APIs" and "Python bindings", but most frequently refer to "Python bindings" in the README, CONTRIBUTING doc and CHANGELOG.
There was a problem hiding this comment.
I'm updating the class name to PythonBindingConfig and updating most of the variables, constants and comments in this module to no longer say "driver".
Unchanged:
- I didn't rename the mako templates that use driver in the name.
- I didn't change the --driver command line argument (so far).
…onstants as appropriate
[ ] I've updated CHANGELOG.md if applicable.What does this Pull Request accomplish?
The GNU Make code used for code generation was a barrier to entry for anyone not familar with GNU Make and, frankly, even for those who are familiar with it. Some of the code was very difficult to read. Variables and recipes were also scattered across the repo, making it more difficult to read.
This PR replaces those files and some of their Python code with a consolidated
build/codegen.py, which implements thecodegen,cleanandinstallerssteps.It also eliminates our reliance on WSL for Windows development.
Performance: This seems to be faster than the old codegen, though how much faster may vary depending on your machine and your environment. Why is it faster? Because we don't launch Python every time we need to render a template. We use the active Python process, instead.
Additionally, eliminating WSL makes it even faster, still. I can run codegen in less than 20 seconds, if the env already exists.
List issues fixed by this Pull Request below, if any.
What testing has been done?
Ran
tox -e clean,tox -e codegen,tox -e installers,tox -e codegen -- -driver nidmm. No difference seen in the generated files.Ran newly generated unit tests. These don't cover all of codegen.py, but it's more than we had for the MAKEFILE code. Our primary method of catching issues remains ensure_codegen_up_to_date.py, diffs and code review of PRs.