Skip to content

Commit

Permalink
refactor: use tomli instead of toml
Browse files Browse the repository at this point in the history
  • Loading branch information
12rambau committed Sep 29, 2023
1 parent c297a0a commit 3f7818f
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ dev = [
"pre-commit>=2.18.0",
"commitizen",
"nox",
"toml",
"tomli",
"jupyter",
"voila",
"mypy",
Expand Down
7 changes: 4 additions & 3 deletions sepal_ui/bin/module_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from pathlib import Path
from typing import Union

import tomli
from colorama import Fore, Style, init

import sepal_ui
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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})")

Expand Down
4 changes: 2 additions & 2 deletions sepal_ui/templates/map_app/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""

import nox
import toml
import tomli


@nox.session(reuse_venv=True)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion sepal_ui/templates/map_app/requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions sepal_ui/templates/panel_app/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""

import nox
import toml
import tomli


@nox.session(reuse_venv=True)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion sepal_ui/templates/panel_app/requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 3f7818f

Please sign in to comment.