mealie/dev/code-generation/gen_schema_exports.py
Hayden 190773c5d7
Feature/group based notifications (#918)
* fix group page

* setup group notification for backend

* update type generators

* script to auto-generate schema exports

* setup frontend CRUD interface

* remove old notifications UI

* drop old events api

* add test functionality

* update naming for fields

* add event dispatcher functionality

* bump to python 3.10

* bump python version

* purge old event code

* use-async apprise

* set mealie logo as image

* unify styles for buttons rows

* add links to banners
2022-01-09 21:04:24 -09:00

35 lines
872 B
Python

from _gen_utils import render_python_template
from _static import PROJECT_DIR
template = """# GENERATED CODE - DO NOT MODIFY BY HAND
{% for file in data.files %}from .{{ file }} import *
{% endfor %}
"""
SCHEMA_PATH = PROJECT_DIR / "mealie" / "schema"
def generate_init_files() -> None:
for schema in SCHEMA_PATH.iterdir():
if not schema.is_dir():
print(f"Skipping {schema}")
continue
print(f"Generating {schema}")
init_file = schema.joinpath("__init__.py")
module_files = [
f.stem for f in schema.iterdir() if f.is_file() and f.suffix == ".py" and not f.stem.startswith("_")
]
render_python_template(template, init_file, {"files": module_files})
def main():
print("Starting...")
generate_init_files()
print("Finished...")
if __name__ == "__main__":
main()