cgse-tools 2025.0.8.dev1__tar.gz → 2025.0.8.dev3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cgse_tools-2025.0.8.dev1 → cgse_tools-2025.0.8.dev3}/PKG-INFO +1 -1
- {cgse_tools-2025.0.8.dev1 → cgse_tools-2025.0.8.dev3}/pyproject.toml +3 -2
- {cgse_tools-2025.0.8.dev1 → cgse_tools-2025.0.8.dev3}/src/cgse_tools/cgse_commands.py +79 -0
- {cgse_tools-2025.0.8.dev1 → cgse_tools-2025.0.8.dev3}/.gitignore +0 -0
- {cgse_tools-2025.0.8.dev1 → cgse_tools-2025.0.8.dev3}/README.md +0 -0
- {cgse_tools-2025.0.8.dev1 → cgse_tools-2025.0.8.dev3}/src/cgse_tools/__init__.py +0 -0
- {cgse_tools-2025.0.8.dev1 → cgse_tools-2025.0.8.dev3}/src/cgse_tools/cgse_services.py +0 -0
- {cgse_tools-2025.0.8.dev1 → cgse_tools-2025.0.8.dev3}/src/egse/tools/status.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "cgse-tools"
|
|
3
|
-
version = "2025.0.8-dev.
|
|
3
|
+
version = "2025.0.8-dev.3"
|
|
4
4
|
description = "Tools for CGSE"
|
|
5
5
|
authors = [
|
|
6
6
|
{name = "IVS KU Leuven"}
|
|
@@ -36,6 +36,7 @@ cgse-tools = 'egse.tools'
|
|
|
36
36
|
# plugins for the `cgse` command, add [group] when the command has sub-commands
|
|
37
37
|
|
|
38
38
|
[project.entry-points."cgse.command.plugins"]
|
|
39
|
+
init = 'cgse_tools.cgse_commands:init'
|
|
39
40
|
top = 'cgse_tools.cgse_commands:top'
|
|
40
41
|
show = 'cgse_tools.cgse_commands:show[group]'
|
|
41
42
|
check = 'cgse_tools.cgse_commands:check[group]'
|
|
@@ -49,7 +50,7 @@ exclude = [
|
|
|
49
50
|
]
|
|
50
51
|
|
|
51
52
|
[tool.hatch.build.targets.wheel]
|
|
52
|
-
packages = ["src/egse", "src/
|
|
53
|
+
packages = ["src/egse", "src/cgse_tools"]
|
|
53
54
|
|
|
54
55
|
[tool.ruff]
|
|
55
56
|
line-length = 120
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import re
|
|
2
2
|
import subprocess
|
|
3
3
|
import sys
|
|
4
|
+
import textwrap
|
|
4
5
|
from pathlib import Path
|
|
5
6
|
from typing import Annotated
|
|
6
7
|
|
|
7
8
|
import rich
|
|
8
9
|
import typer
|
|
9
10
|
|
|
11
|
+
from egse.system import format_datetime
|
|
12
|
+
|
|
10
13
|
app = typer.Typer()
|
|
11
14
|
|
|
12
15
|
|
|
@@ -20,6 +23,82 @@ def top():
|
|
|
20
23
|
print("This fancy top is not yet implemented.")
|
|
21
24
|
|
|
22
25
|
|
|
26
|
+
@app.command()
|
|
27
|
+
def init(project: str = ""):
|
|
28
|
+
"""Initialize your project."""
|
|
29
|
+
from rich.prompt import Prompt, Confirm
|
|
30
|
+
|
|
31
|
+
project = project.upper()
|
|
32
|
+
site_id = None
|
|
33
|
+
|
|
34
|
+
rich.print("[light_steel_blue]Please note default values are given between \[brackets].[/]")
|
|
35
|
+
|
|
36
|
+
answer = Prompt.ask(f"What is the name of the project [{project}] ?")
|
|
37
|
+
if answer:
|
|
38
|
+
project = answer.upper()
|
|
39
|
+
while not site_id:
|
|
40
|
+
answer = Prompt.ask("What is the site identifier ?")
|
|
41
|
+
if answer:
|
|
42
|
+
site_id = answer.upper()
|
|
43
|
+
else:
|
|
44
|
+
answer = Confirm.ask("Abort?")
|
|
45
|
+
if answer:
|
|
46
|
+
return
|
|
47
|
+
|
|
48
|
+
data_storage_location = f"~/data/{project}/{site_id}/"
|
|
49
|
+
answer = Prompt.ask(f"Where can the project data be stored [{data_storage_location}] ?")
|
|
50
|
+
if answer:
|
|
51
|
+
data_storage_location = answer
|
|
52
|
+
|
|
53
|
+
conf_data_location = f"~/data/{project}/{site_id}/conf/"
|
|
54
|
+
answer = Prompt.ask(f"Where will the configuration data be located [{conf_data_location}] ?")
|
|
55
|
+
if answer:
|
|
56
|
+
conf_data_location = answer
|
|
57
|
+
|
|
58
|
+
log_file_location = f"~/data/{project}/{site_id}/log/"
|
|
59
|
+
answer = Prompt.ask(f"Where will the logging messages be stored [{log_file_location}] ?")
|
|
60
|
+
if answer:
|
|
61
|
+
log_file_location = answer
|
|
62
|
+
|
|
63
|
+
local_settings_path = f"~/data/{project}/{site_id}/local_settings.yaml"
|
|
64
|
+
answer = Prompt.ask(f"Where shall I create a local settings YAML file [{local_settings_path}] ?")
|
|
65
|
+
if answer:
|
|
66
|
+
local_settings_path = answer
|
|
67
|
+
|
|
68
|
+
Path(data_storage_location).expanduser().mkdir(exist_ok=True, parents=True)
|
|
69
|
+
(Path(data_storage_location).expanduser() / "daily").mkdir(exist_ok=True, parents=True)
|
|
70
|
+
(Path(data_storage_location).expanduser() / "obs").mkdir(exist_ok=True, parents=True)
|
|
71
|
+
Path(conf_data_location).expanduser().mkdir(exist_ok=True, parents=True)
|
|
72
|
+
Path(log_file_location).expanduser().mkdir(exist_ok=True, parents=True)
|
|
73
|
+
|
|
74
|
+
with open(Path(local_settings_path).expanduser(), 'w') as fd:
|
|
75
|
+
fd.write(
|
|
76
|
+
textwrap.dedent(
|
|
77
|
+
f"""\
|
|
78
|
+
SITE:
|
|
79
|
+
ID: {site_id}
|
|
80
|
+
"""
|
|
81
|
+
)
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
answer = Confirm.ask("Shall I add the environment to your ~/bash_profile ?")
|
|
85
|
+
if answer:
|
|
86
|
+
with open(Path("~/.bash_profile").expanduser(), 'a') as fd:
|
|
87
|
+
fd.write(
|
|
88
|
+
textwrap.dedent(
|
|
89
|
+
f"""
|
|
90
|
+
# Environment for project {project} added by `cgse init` at {format_datetime()}
|
|
91
|
+
export PROJECT={project}
|
|
92
|
+
export SITE_ID={site_id}
|
|
93
|
+
export {project}_DATA_STORAGE_LOCATION={data_storage_location}
|
|
94
|
+
export {project}_CONF_DATA_LOCATION={conf_data_location}
|
|
95
|
+
export {project}_LOG_FILE_LOCATION={log_file_location}
|
|
96
|
+
export {project}_LOCAL_SETTINGS={local_settings_path}
|
|
97
|
+
"""
|
|
98
|
+
)
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
|
|
23
102
|
show = typer.Typer(help="Show information about settings, environment, setup, ...", no_args_is_help=True)
|
|
24
103
|
|
|
25
104
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|