Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use tomli instead of toml #888

Merged
merged 3 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ classifiers = [
requires-python = ">=3.8"
dependencies = [
# building widgets
"tomli",
"ipykernel",
"ipyvuetify",
"markdown",
Expand Down Expand Up @@ -70,7 +71,7 @@ dev = [
"pre-commit>=2.18.0",
"commitizen",
"nox",
"toml",
"tomli",
"jupyter",
"voila",
"mypy",
Expand Down
6 changes: 3 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,8 @@ 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"
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