From 3532695ae1006d95597f92619d5d6b86aaf99265 Mon Sep 17 00:00:00 2001 From: Laborratte5 Date: Fri, 3 May 2024 12:34:49 +0200 Subject: [PATCH] build: Create py files from jupyter notebooks --- .gitignore | 2 ++ Makefile | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/.gitignore b/.gitignore index 0623456..cf627a4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ *.mpy +*.py +.ipynb_checkpoints __pycache__ diff --git a/Makefile b/Makefile index e6f8a9f..7c21c03 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,11 @@ AMPY = $(VENV) ampy --port $(ESP_PORT) MICRO_PYTHON_FIRMWARE = ESP8266_GENERIC-20240222-v1.22.2.bin ESP_PORT = /dev/ttyUSB0 +src/%.py: src/%.ipynb + $(VENV) jupyter nbconvert --to python $? \ + --TagRemovePreprocessor.enabled=True \ + --TagRemovePreprocessor.remove_cell_tags remove_cell + src/%.mpy: src/%.py @for f in $(filter-out src/main.py,$?); do \ echo Compile $$f; \ @@ -40,6 +45,7 @@ clean: rm -rf src/__pycache__ rm -f src/*.pyc rm -f src/*.mpy + rm -f src/*.py env: poetry install