-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
433 additions
and
99 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,8 @@ __pycache__/ | |
*$py.class | ||
*[Uu]ntitled* | ||
|
||
.github/workflows/act_unit.yml | ||
|
||
# C extensions | ||
*.so | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,4 +44,3 @@ Meet our :doc:`contributor <./start/authors>`. | |
widgets/index | ||
API Content <modules/sepal_ui> | ||
cli/index | ||
changelog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/usr/bin/python3 | ||
|
||
"""Script to rename the kernel of a notebook to a specific name.""" | ||
|
||
import argparse | ||
import json | ||
from pathlib import Path | ||
|
||
from colorama import Fore, init | ||
|
||
init() | ||
|
||
# init parser | ||
parser = argparse.ArgumentParser(description=__doc__, usage="entry_point") | ||
|
||
parser.add_argument("file", help="UI file path") | ||
|
||
# Add a optional argument | ||
parser.add_argument("-t", "--test", help="Either test or not (production)", action="store_true") | ||
|
||
|
||
def main() -> None: | ||
"""Launch the venv creation process.""" | ||
# read arguments (there should be none) | ||
args = parser.parse_args() | ||
|
||
ui_file = args.file | ||
test = args.test | ||
|
||
# welcome the user | ||
print(f"{Fore.YELLOW}UI renaming process{Fore.RESET}") | ||
|
||
# check that the local folder is a module folder | ||
ui_file = Path.cwd() / ui_file | ||
if not ui_file.is_file(): | ||
raise Exception(f"{Fore.RED}This is not a module folder.") | ||
|
||
entry_point = Path.cwd() / ui_file | ||
|
||
# create the kernel from venv | ||
prefix_name = "test-" if test else "venv-" | ||
prefix_display = "(test) test-" if test else " (venv) " | ||
|
||
name = f"{prefix_name}{Path.cwd().name}" | ||
display_name = f"{prefix_display}{Path.cwd().name}" | ||
|
||
# change the kernel of the entrypoint to use this one instead | ||
with entry_point.open() as f: | ||
data = json.load(f) | ||
|
||
data["metadata"]["kernelspec"]["display_name"] = display_name | ||
data["metadata"]["kernelspec"]["name"] = name | ||
|
||
entry_point.write_text(json.dumps(data, indent=1)) | ||
|
||
# display last message to the end user | ||
print( | ||
f'{Fore.GREEN}The python kernel of {args.file} has been updated"{display_name}".{Fore.RESET}' | ||
) | ||
|
||
return | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"decorator": { | ||
"no_alert": "", | ||
"no_button": "" | ||
} | ||
} |
Oops, something went wrong.