From 3f7818f830c9d663071dea739e604676220e32c0 Mon Sep 17 00:00:00 2001 From: Rambaud Pierrick <12rambau@users.noreply.github.com> Date: Fri, 29 Sep 2023 12:45:20 +0000 Subject: [PATCH 1/3] refactor: use tomli instead of toml --- pyproject.toml | 2 +- sepal_ui/bin/module_deploy.py | 7 ++++--- sepal_ui/templates/map_app/noxfile.py | 4 ++-- sepal_ui/templates/map_app/requirements.txt | 2 +- sepal_ui/templates/panel_app/noxfile.py | 4 ++-- sepal_ui/templates/panel_app/requirements.txt | 2 +- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 255666ee..ccfbb95c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -70,7 +70,7 @@ dev = [ "pre-commit>=2.18.0", "commitizen", "nox", - "toml", + "tomli", "jupyter", "voila", "mypy", diff --git a/sepal_ui/bin/module_deploy.py b/sepal_ui/bin/module_deploy.py index 421e1be0..696bcf06 100755 --- a/sepal_ui/bin/module_deploy.py +++ b/sepal_ui/bin/module_deploy.py @@ -18,6 +18,7 @@ from pathlib import Path from typing import Union +import tomli from colorama import Fore, Style, init import sepal_ui @@ -66,7 +67,7 @@ def clean_dulpicate(file: Union[str, Path]) -> None: file: the requirements file """ # already available libs - libs = ["jupyter", "voila", "toml", "sepal_ui"] + libs = ["jupyter", "voila", "tomli", "sepal_ui"] file = Path(file) text = file.read_text().split("\n") @@ -195,9 +196,9 @@ def main() -> None: print("Export the env configuration of your module...") # check that the local folder is a module folder - toml = Path.cwd() / "pyproject.toml" + Path.cwd() / "pyproject.toml" try: - toml.load("pyproject.toml")["sepal-ui"]["init-notebook"] + tomli.load("pyproject.toml")["sepal-ui"]["init-notebook"] except FileNotFoundError as e: raise Exception(f"{Fore.RED}This module folder has no pyproject.toml ({e})") diff --git a/sepal_ui/templates/map_app/noxfile.py b/sepal_ui/templates/map_app/noxfile.py index e0add022..30c07dd9 100644 --- a/sepal_ui/templates/map_app/noxfile.py +++ b/sepal_ui/templates/map_app/noxfile.py @@ -4,7 +4,7 @@ """ import nox -import toml +import tomli @nox.session(reuse_venv=True) @@ -17,7 +17,7 @@ def lint(session): @nox.session(reuse_venv=True) def app(session): """Run the application.""" - init_notebook = toml.load("pyproject.toml")["sepal-ui"]["init-notebook"] + init_notebook = tomli.load("pyproject.toml")["sepal-ui"]["init-notebook"] session.install("-r", "requirements.txt") session.run("jupyter", "trust", init_notebook) session.run("voila", "--debug", init_notebook) diff --git a/sepal_ui/templates/map_app/requirements.txt b/sepal_ui/templates/map_app/requirements.txt index 06247c3e..133c0481 100644 --- a/sepal_ui/templates/map_app/requirements.txt +++ b/sepal_ui/templates/map_app/requirements.txt @@ -1,7 +1,7 @@ # these libs are requested to build application env jupyter voila -toml +tomli # the base lib to run any sepal_ui based app # don't forget to fix it to a specific version when you're app is ready diff --git a/sepal_ui/templates/panel_app/noxfile.py b/sepal_ui/templates/panel_app/noxfile.py index bacc0c54..e48f1b89 100644 --- a/sepal_ui/templates/panel_app/noxfile.py +++ b/sepal_ui/templates/panel_app/noxfile.py @@ -4,7 +4,7 @@ """ import nox -import toml +import tomli @nox.session(reuse_venv=True) @@ -17,7 +17,7 @@ def lint(session): @nox.session(reuse_venv=True) def app(session): """Run the application.""" - init_notebook = toml.load("pyproject.toml")["sepal-ui"]["init-notebook"] + init_notebook = tomli.load("pyproject.toml")["sepal-ui"]["init-notebook"] session.install("-r", "requirements.txt") session.run("jupyter", "trust", init_notebook) session.run("voila", "--debug", init_notebook) diff --git a/sepal_ui/templates/panel_app/requirements.txt b/sepal_ui/templates/panel_app/requirements.txt index 06247c3e..133c0481 100644 --- a/sepal_ui/templates/panel_app/requirements.txt +++ b/sepal_ui/templates/panel_app/requirements.txt @@ -1,7 +1,7 @@ # these libs are requested to build application env jupyter voila -toml +tomli # the base lib to run any sepal_ui based app # don't forget to fix it to a specific version when you're app is ready From 53a24f130a56404ad8481c92724e4d5f1b9f1415 Mon Sep 17 00:00:00 2001 From: Rambaud Pierrick <12rambau@users.noreply.github.com> Date: Fri, 29 Sep 2023 13:23:06 +0000 Subject: [PATCH 2/3] build: add tomli as a required deps --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index ccfbb95c..4cc5e3b7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,6 +20,7 @@ classifiers = [ requires-python = ">=3.8" dependencies = [ # building widgets + "tomli", "ipykernel", "ipyvuetify", "markdown", From 5e726420aa144231e561fd490f7b899ec90e2e89 Mon Sep 17 00:00:00 2001 From: Rambaud Pierrick <12rambau@users.noreply.github.com> Date: Fri, 29 Sep 2023 15:47:52 +0200 Subject: [PATCH 3/3] Update sepal_ui/bin/module_deploy.py --- sepal_ui/bin/module_deploy.py | 1 - 1 file changed, 1 deletion(-) diff --git a/sepal_ui/bin/module_deploy.py b/sepal_ui/bin/module_deploy.py index 696bcf06..56e54412 100755 --- a/sepal_ui/bin/module_deploy.py +++ b/sepal_ui/bin/module_deploy.py @@ -196,7 +196,6 @@ def main() -> None: print("Export the env configuration of your module...") # check that the local folder is a module folder - Path.cwd() / "pyproject.toml" try: tomli.load("pyproject.toml")["sepal-ui"]["init-notebook"] except FileNotFoundError as e: