-
Notifications
You must be signed in to change notification settings - Fork 3
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
Remove black and isort dependencies #92
Conversation
@mdpiper What do you think of these changes? I like removing dependencies but does this make things easier or more difficult to follow? I felt that some of our jinja templates were becoming overly complicated. |
@mcflugen I think it's a good idea! As much as I enjoy templating, the files were getting thick with jinja code, making them hard to read. |
@mdpiper I've added a few more sub-commands to babelize that, like
I can imagine using these commands not so much with the babelizer but when creating new projects (or, in the case of |
@mcflugen I think these are great! I think it would be neat to use this technique to make the bind-c layer for a Fortran component. |
My goal with this pull request is to remove the black and isort dependencies of the babelizer. Although they serve an important purpose in that they produce reproducible builds and remove lint that might be generated by the jinja templates (e.g. trailing whitespace), they add a couple extra dependencies. Instead of using black and isort, I thought it would be better if we ensure the babelizer generates well formatted code all by itself.
To this end, I attempted to modify the jinja templates but that quickly resulted in complex and difficult to read template files (I don't think I ever got them to work just right, anyway). Instead, I've added a new module,
_render_files.py
that renders some of the project's files with Python and then the template files just include the generated file contents. The Python code is much easier to read and to maintain than the equivalent jinja code.To ensure that the resulting files are formatted correctly (at least for black and isort) I've added tests that run black and isort over the generated projects, returning an error if anything needs modifying.