jrieke / traingenerator

🧙 A web app to generate template code for machine learning
https://traingenerator.jrieke.com
MIT License
1.36k stars 181 forks source link

[WIP] Refactor to make templates more independent from app #1

Closed jrieke closed 3 years ago

jrieke commented 3 years ago

Summary (2-3 sentences)

This PR tries to make templates (i.e. what is rendered as code) completely independent from the core app (i.e. the website, buttons, logic behind the rendering). This will enable contributors to more easily create templates for new tasks/frameworks, without having to understand or modify the app itself.

Details

Each template is now one directory under ./templates with 3 files:

Existing templates in ./templates are automatically detected by the app. Contributing a new template does not require a single change in ./app nor in any other template. Also, pytest will automatically pick up the new template and its test-inputs.yml file and make sure that the template renders and runs without errors (i.e. the user doesn't have to add any specific code for testing).

This PR also changes the ordering of components in the sidebar slightly and fixes a few minor bugs in the code templates that I found during refactoring.