shoestring-assembler 0.1.1__tar.gz → 0.2.0__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.
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/PKG-INFO +2 -1
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/pyproject.toml +4 -3
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/__init__.py +1 -1
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/cli.py +30 -7
- shoestring_assembler-0.2.0/src/shoestring_assembler/constants.py +15 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/display.py +2 -1
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/engine/action/assemble.py +7 -4
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/engine/action/docker.py +60 -4
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/engine/action/user_config.py +7 -5
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/engine/engine.py +24 -7
- shoestring_assembler-0.2.0/src/shoestring_assembler/implementation/dsl/parser.out +162 -0
- shoestring_assembler-0.2.0/src/shoestring_assembler/implementation/dsl/parsetab.py +34 -0
- shoestring_assembler-0.2.0/src/shoestring_assembler/implementation/dsl/prompt_criteria.py +123 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/implementation/source/git.py +2 -1
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/implementation/vc/git.py +1 -1
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/interface/events/_events.py +2 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/interface/events/progress.py +7 -3
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/interface/events/updates.py +10 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/interface/signals.py +2 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/interface/state_machine/steps.py +30 -3
- shoestring_assembler-0.2.0/src/shoestring_assembler/model/_prompt_outputs.py +40 -0
- shoestring_assembler-0.2.0/src/shoestring_assembler/model/_prompt_questions.py +62 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/model/filesystem.py +8 -2
- shoestring_assembler-0.2.0/src/shoestring_assembler/model/installed.py +128 -0
- shoestring_assembler-0.2.0/src/shoestring_assembler/model/prompts.py +93 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/model/recipe.py +9 -1
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/model/solution.py +25 -3
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/model/user_config.py +8 -12
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/view/cli_app/app.py +28 -12
- shoestring_assembler-0.2.0/src/shoestring_assembler/view/cli_app/screens/config_inputs.py +267 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/view/cli_app/screens/engine.py +107 -54
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/view/cli_app/screens/engine.tcss +2 -2
- shoestring_assembler-0.2.0/src/shoestring_assembler/view/cli_app/screens/home.py +156 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/view/cli_app/screens/home.tcss +4 -0
- shoestring_assembler-0.2.0/src/shoestring_assembler/view/cli_app/screens/modals.py +78 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/view/cli_app/screens/modals.tcss +10 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/view/plain_cli/__init__.py +46 -45
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler.egg-info/PKG-INFO +2 -1
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler.egg-info/SOURCES.txt +6 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler.egg-info/requires.txt +1 -0
- shoestring_assembler-0.1.1/src/shoestring_assembler/constants.py +0 -30
- shoestring_assembler-0.1.1/src/shoestring_assembler/model/installed.py +0 -68
- shoestring_assembler-0.1.1/src/shoestring_assembler/view/cli_app/screens/config_inputs.py +0 -325
- shoestring_assembler-0.1.1/src/shoestring_assembler/view/cli_app/screens/home.py +0 -101
- shoestring_assembler-0.1.1/src/shoestring_assembler/view/cli_app/screens/modals.py +0 -43
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/AUTHORS.rst +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/CONTRIBUTING.rst +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/HISTORY.rst +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/LICENSE +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/MANIFEST.in +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/README.rst +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/docs/Makefile +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/docs/_build/html/_static/file.png +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/docs/_build/html/_static/minus.png +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/docs/_build/html/_static/plus.png +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/docs/api.rst +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/docs/authors.rst +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/docs/conf.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/docs/contributing.rst +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/docs/generated/shoestring_assembler.rst +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/docs/history.rst +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/docs/index.rst +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/docs/installation.rst +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/docs/make.bat +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/docs/readme.rst +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/docs/usage.rst +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/setup.cfg +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/engine/__init__.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/engine/action/filesystem.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/engine/action/git.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/implementation/source/__init__.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/implementation/source/filesystem.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/interface/__init__.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/interface/events/__init__.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/interface/events/audit.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/interface/pipe/pipe.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/interface/state_machine/process.MD +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/model/__init__.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/model/base_module.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/model/common.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/model/container.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/model/infrastructure_module.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/model/schemas/__init__.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/model/schemas/meta.schema.json +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/model/schemas/recipe.schema.json +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/model/schemas/schema_validators.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/model/service_module.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/model/source.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/solution_picker.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/utilities/minimal_mustache.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/utilities/path.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/view/__init__.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/view/cli_app/__init__.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/view/cli_app/components/__init__.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/view/cli_app/components/_bottom_bar.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/view/cli_app/layout.tcss +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/view/cli_app/screens/__init__.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/view/cli_app/screens/config.tcss +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/view/cli_app/screens/download.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/view/cli_app/screens/download.tcss +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/view/cli_app/screens/find_solution.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/view/cli_app/screens/select_update.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/view/cli_app/screens/solution_picker.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/view/cli_app/screens/solution_picker.tcss +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/view/plain_cli/audit_events.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler.egg-info/dependency_links.txt +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler.egg-info/entry_points.txt +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler.egg-info/top_level.txt +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/tests/__init__.py +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/tests/console.log +0 -0
- {shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/tests/test_shoestring_assembler.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: shoestring_assembler
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Assembles Shoestring Solutions from a solution recipe
|
|
5
5
|
Author-email: Greg Hawkridge <gth24@cam.ac.uk>
|
|
6
6
|
Maintainer-email: Greg Hawkridge <gth24@cam.ac.uk>
|
|
@@ -25,6 +25,7 @@ Requires-Dist: jsonschema[format-nongpl]==4.21.1
|
|
|
25
25
|
Requires-Dist: pyyaml==6.0.2
|
|
26
26
|
Requires-Dist: Jinja2==3.1.6
|
|
27
27
|
Requires-Dist: textual==5.0.1
|
|
28
|
+
Requires-Dist: ply==3.11
|
|
28
29
|
Provides-Extra: dev
|
|
29
30
|
Requires-Dist: coverage; extra == "dev"
|
|
30
31
|
Requires-Dist: mypy; extra == "dev"
|
|
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
|
|
|
6
6
|
|
|
7
7
|
[project]
|
|
8
8
|
name = "shoestring_assembler"
|
|
9
|
-
version = "0.
|
|
9
|
+
version = "0.2.0"
|
|
10
10
|
description = "Assembles Shoestring Solutions from a solution recipe"
|
|
11
11
|
readme = "README.rst"
|
|
12
12
|
authors = [
|
|
@@ -34,7 +34,8 @@ dependencies = [
|
|
|
34
34
|
"jsonschema[format-nongpl]==4.21.1",
|
|
35
35
|
"pyyaml==6.0.2",
|
|
36
36
|
"Jinja2==3.1.6",
|
|
37
|
-
"textual==5.0.1"
|
|
37
|
+
"textual==5.0.1",
|
|
38
|
+
"ply==3.11"
|
|
38
39
|
]
|
|
39
40
|
|
|
40
41
|
[project.optional-dependencies]
|
|
@@ -42,7 +43,7 @@ dev = [
|
|
|
42
43
|
"coverage", # testing
|
|
43
44
|
"mypy", # linting
|
|
44
45
|
"pytest", # testing
|
|
45
|
-
"ruff" # linting
|
|
46
|
+
"ruff", # linting
|
|
46
47
|
]
|
|
47
48
|
|
|
48
49
|
[project.scripts]
|
|
@@ -34,7 +34,7 @@ def download(
|
|
|
34
34
|
"""
|
|
35
35
|
Downloads the specified solution
|
|
36
36
|
"""
|
|
37
|
-
execute(Action.DOWNLOAD,verbose=verbose)
|
|
37
|
+
execute(Action.DOWNLOAD, verbose=verbose)
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
@typer_app.command()
|
|
@@ -58,7 +58,13 @@ def update(
|
|
|
58
58
|
"""
|
|
59
59
|
Updates the solution to the specified version. If a version is not specified - it lists the available versions that you can choose from.
|
|
60
60
|
"""
|
|
61
|
-
execute(
|
|
61
|
+
execute(
|
|
62
|
+
Action.UPDATE,
|
|
63
|
+
version=version,
|
|
64
|
+
no_prompt=yes,
|
|
65
|
+
recipe_location=recipe_location,
|
|
66
|
+
verbose=verbose,
|
|
67
|
+
)
|
|
62
68
|
|
|
63
69
|
|
|
64
70
|
@typer_app.command()
|
|
@@ -74,7 +80,12 @@ def assemble(
|
|
|
74
80
|
"""
|
|
75
81
|
Assembles the solution using the provided recipe
|
|
76
82
|
"""
|
|
77
|
-
execute(
|
|
83
|
+
execute(
|
|
84
|
+
Action.ASSEMBLE,
|
|
85
|
+
recipe_location=recipe_location,
|
|
86
|
+
verbose=verbose,
|
|
87
|
+
download=download,
|
|
88
|
+
)
|
|
78
89
|
|
|
79
90
|
|
|
80
91
|
@typer_app.command()
|
|
@@ -109,16 +120,28 @@ def stop():
|
|
|
109
120
|
execute(Action.STOP)
|
|
110
121
|
|
|
111
122
|
|
|
123
|
+
@typer_app.command()
|
|
124
|
+
def logs(service: Annotated[str, typer.Option(help="Service to log")] = None):
|
|
125
|
+
from shoestring_assembler.engine.action.docker import Docker
|
|
126
|
+
from shoestring_assembler.model.solution import SolutionModel
|
|
127
|
+
|
|
128
|
+
solution_model = SolutionModel()
|
|
129
|
+
Docker.logs(solution_model, service)
|
|
130
|
+
|
|
131
|
+
|
|
112
132
|
@typer_app.command()
|
|
113
133
|
def restart():
|
|
114
134
|
execute(Action.RESTART)
|
|
115
135
|
|
|
136
|
+
|
|
116
137
|
@typer_app.command()
|
|
117
138
|
def app():
|
|
118
139
|
from shoestring_assembler.view.cli_app import SolutionAssemblerApp
|
|
140
|
+
|
|
119
141
|
app = SolutionAssemblerApp()
|
|
120
142
|
app.run()
|
|
121
143
|
|
|
144
|
+
|
|
122
145
|
@typer_app.callback(invoke_without_command=True)
|
|
123
146
|
def main(
|
|
124
147
|
version: Annotated[
|
|
@@ -130,14 +153,13 @@ def main(
|
|
|
130
153
|
f"Shoestring Assembler version {shoestring_assembler.__version__}"
|
|
131
154
|
)
|
|
132
155
|
else:
|
|
133
|
-
pass
|
|
156
|
+
pass
|
|
134
157
|
|
|
135
158
|
|
|
136
|
-
from .engine.engine import Engine
|
|
137
159
|
from shoestring_assembler.view.plain_cli import PlainCLI
|
|
138
160
|
|
|
139
161
|
|
|
140
|
-
def execute(action
|
|
162
|
+
def execute(action, *, recipe_location=None, verbose=False, **kwargs):
|
|
141
163
|
if verbose:
|
|
142
164
|
Display.log_level = 5
|
|
143
165
|
|
|
@@ -148,7 +170,8 @@ def execute(action,*,recipe_location=None,verbose=False,**kwargs):
|
|
|
148
170
|
loop.run_until_complete(ui_task)
|
|
149
171
|
except asyncio.CancelledError:
|
|
150
172
|
Display.print_error("Closing")
|
|
151
|
-
|
|
173
|
+
|
|
174
|
+
|
|
152
175
|
def app():
|
|
153
176
|
try:
|
|
154
177
|
if os.geteuid() == 0:
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
class Constants:
|
|
5
|
+
SHOESTRING_SHARE = Path(os.getenv("HOME"))/".local/share/shoestring/"
|
|
6
|
+
INSTALLED_SOLUTIONS_LIST = SHOESTRING_SHARE / "installed.json"
|
|
7
|
+
CONSOLE_LOG = SHOESTRING_SHARE / "console_log.html"
|
|
8
|
+
DOCKER_NETWORK_NAME = "internal"
|
|
9
|
+
|
|
10
|
+
META_FILE_NAME = "meta.toml"
|
|
11
|
+
DOCKER_ALIAS_SUFFIX = ".docker.local"
|
|
12
|
+
|
|
13
|
+
# TODO
|
|
14
|
+
DEFAULT_GIT_HOST = ""
|
|
15
|
+
DEFAULT_GIT_REPO = ""
|
{shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/display.py
RENAMED
|
@@ -7,6 +7,7 @@ import rich.progress
|
|
|
7
7
|
import os
|
|
8
8
|
|
|
9
9
|
from shoestring_assembler.interface.events import Update
|
|
10
|
+
from shoestring_assembler.constants import Constants
|
|
10
11
|
from pathlib import Path
|
|
11
12
|
|
|
12
13
|
PREFIX = "[grey58]> [/grey58]"
|
|
@@ -146,7 +147,7 @@ class Display:
|
|
|
146
147
|
|
|
147
148
|
@classmethod
|
|
148
149
|
def finalise_log(cls):
|
|
149
|
-
cls.file_console.save_html(
|
|
150
|
+
cls.file_console.save_html(Constants.CONSOLE_LOG)
|
|
150
151
|
|
|
151
152
|
|
|
152
153
|
from rich.prompt import PromptBase, Confirm, InvalidResponse
|
|
@@ -59,7 +59,10 @@ class Assembler:
|
|
|
59
59
|
)
|
|
60
60
|
|
|
61
61
|
for source in used_sources:
|
|
62
|
-
await Update.InfoMsg(
|
|
62
|
+
await Update.InfoMsg(
|
|
63
|
+
f"Fetching {source.name}",
|
|
64
|
+
detail_level=Update.LevelOfDetail.ALWAYS_CLI_ONLY,
|
|
65
|
+
)
|
|
63
66
|
|
|
64
67
|
result = await source.fetch()
|
|
65
68
|
|
|
@@ -166,10 +169,10 @@ class Assembler:
|
|
|
166
169
|
Constants.DOCKER_NETWORK_NAME: {
|
|
167
170
|
"aliases": [f"{container.alias}{Constants.DOCKER_ALIAS_SUFFIX}"]
|
|
168
171
|
}
|
|
169
|
-
},
|
|
172
|
+
},
|
|
170
173
|
"logging": {
|
|
171
|
-
"driver": "
|
|
172
|
-
"options": {"
|
|
174
|
+
"driver": "json-file",
|
|
175
|
+
"options": {"max-size": "10m", "max-file": "3"},
|
|
173
176
|
},
|
|
174
177
|
"labels": {
|
|
175
178
|
"net.digitalshoestring.solution": self.solution_model.solution_details.slug,
|
|
@@ -7,20 +7,25 @@ from shoestring_assembler.interface.events import (
|
|
|
7
7
|
Update,
|
|
8
8
|
Progress,
|
|
9
9
|
ProgressSection,
|
|
10
|
+
FatalError
|
|
10
11
|
)
|
|
11
12
|
from shoestring_assembler.interface.events.progress import ProgressBar
|
|
12
13
|
|
|
13
14
|
from pathlib import Path
|
|
14
15
|
import yaml
|
|
15
16
|
import json
|
|
17
|
+
import datetime
|
|
16
18
|
|
|
17
19
|
|
|
18
|
-
# TODO - look at --progress json tag for all operations
|
|
20
|
+
# TODO - look at --progress json tag for all operations - when not affected by bug
|
|
19
21
|
|
|
20
22
|
|
|
21
23
|
class Docker:
|
|
22
24
|
@staticmethod
|
|
23
25
|
def base_compose_command(solution_model):
|
|
26
|
+
if not solution_model.fs.compose_file.exists():
|
|
27
|
+
raise FatalError("Solution hasn't been assembled yet")
|
|
28
|
+
|
|
24
29
|
return [
|
|
25
30
|
"docker",
|
|
26
31
|
"compose",
|
|
@@ -32,17 +37,37 @@ class Docker:
|
|
|
32
37
|
str(solution_model.fs.env_file),
|
|
33
38
|
]
|
|
34
39
|
|
|
40
|
+
@classmethod
|
|
41
|
+
def logs(cls,solution_model:SolutionModel, service):
|
|
42
|
+
command = [
|
|
43
|
+
*Docker.base_compose_command(solution_model),
|
|
44
|
+
"logs",
|
|
45
|
+
"-f"
|
|
46
|
+
]
|
|
47
|
+
if service:
|
|
48
|
+
command.append(str(service))
|
|
49
|
+
subprocess.run(command)
|
|
50
|
+
|
|
35
51
|
@classmethod
|
|
36
52
|
async def build(cls, solution_model: SolutionModel):
|
|
37
53
|
command = [
|
|
38
54
|
*Docker.base_compose_command(solution_model),
|
|
39
|
-
"
|
|
55
|
+
# "--progress",
|
|
56
|
+
# "json",
|
|
57
|
+
"build"
|
|
40
58
|
]
|
|
59
|
+
|
|
60
|
+
await Audit.submit("docker::build::command", Audit.Type.Log, command=command)
|
|
61
|
+
await Update.InfoMsg(
|
|
62
|
+
"(In future you will be shown step by step updates, but there is currently a bug in docker compose that is preventing this)"
|
|
63
|
+
) # https://github.com/docker/compose/issues/13164
|
|
64
|
+
|
|
41
65
|
process = subprocess.Popen(
|
|
42
66
|
command, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
43
67
|
)
|
|
44
68
|
out_buffer = bytearray()
|
|
45
69
|
err_buffer = bytearray()
|
|
70
|
+
last_update = datetime.datetime.now()
|
|
46
71
|
while process.returncode == None:
|
|
47
72
|
while True:
|
|
48
73
|
out_line = None
|
|
@@ -82,6 +107,9 @@ class Docker:
|
|
|
82
107
|
|
|
83
108
|
if out_line:
|
|
84
109
|
await Update.InfoMsg(f"[white]{out_line}", detail_level=2)
|
|
110
|
+
if datetime.datetime.now() - last_update > datetime.timedelta(seconds=30):
|
|
111
|
+
last_update = datetime.datetime.now()
|
|
112
|
+
await Update.InfoMsg(f"({last_update}) still working...")
|
|
85
113
|
if err_line:
|
|
86
114
|
await Update.SuccessMsg(f"{err_line}")
|
|
87
115
|
|
|
@@ -93,6 +121,10 @@ class Docker:
|
|
|
93
121
|
|
|
94
122
|
@classmethod
|
|
95
123
|
async def setup_containers(cls, solution_model: SolutionModel):
|
|
124
|
+
|
|
125
|
+
if solution_model.compose_spec is None:
|
|
126
|
+
raise FatalError("Solution doesn't have a compose file - this is likely because it hasn't been assembled")
|
|
127
|
+
|
|
96
128
|
for service_name, service_spec in solution_model.compose_spec[
|
|
97
129
|
"services"
|
|
98
130
|
].items():
|
|
@@ -109,7 +141,10 @@ class Docker:
|
|
|
109
141
|
else:
|
|
110
142
|
command.append(setup_cmd)
|
|
111
143
|
outcome = subprocess.run(command, capture_output=False)
|
|
112
|
-
|
|
144
|
+
if outcome.returncode == 0:
|
|
145
|
+
await Update.InfoMsg(f"{service_name} - Setup Successful")
|
|
146
|
+
else:
|
|
147
|
+
await Update.InfoMsg(f"{service_name} - No setup required")
|
|
113
148
|
|
|
114
149
|
@classmethod
|
|
115
150
|
async def start(cls, solution_model: SolutionModel):
|
|
@@ -122,7 +157,8 @@ class Docker:
|
|
|
122
157
|
"--remove-orphans",
|
|
123
158
|
]
|
|
124
159
|
|
|
125
|
-
|
|
160
|
+
await Audit.submit("docker::start::command",Audit.Type.Log,command=command)
|
|
161
|
+
|
|
126
162
|
process = subprocess.Popen(
|
|
127
163
|
command, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
128
164
|
)
|
|
@@ -187,6 +223,26 @@ class Docker:
|
|
|
187
223
|
|
|
188
224
|
return process.returncode == 0
|
|
189
225
|
|
|
226
|
+
@classmethod
|
|
227
|
+
async def get_running_list(cls):
|
|
228
|
+
# docker compose ls --format json
|
|
229
|
+
command = [
|
|
230
|
+
"docker",
|
|
231
|
+
"compose",
|
|
232
|
+
"ls",
|
|
233
|
+
"--format",
|
|
234
|
+
"json"
|
|
235
|
+
]
|
|
236
|
+
result = subprocess.run(command, capture_output=True)
|
|
237
|
+
|
|
238
|
+
if result.returncode !=0:
|
|
239
|
+
return None
|
|
240
|
+
|
|
241
|
+
try:
|
|
242
|
+
return json.loads(result.stdout)
|
|
243
|
+
except json.JSONDecodeError:
|
|
244
|
+
return None
|
|
245
|
+
|
|
190
246
|
|
|
191
247
|
async def parse_docker_json_progress(process: subprocess.Popen, callback):
|
|
192
248
|
out_buffer = bytearray()
|
|
@@ -12,16 +12,21 @@ version_regex = re.compile("^\s*(\d+)\.(\d+)\s*$")
|
|
|
12
12
|
class UserConfig:
|
|
13
13
|
@staticmethod
|
|
14
14
|
async def configure(solution_model: SolutionModel):
|
|
15
|
-
await Update.StepHeading("Configuring User Config")
|
|
16
15
|
for service_module in solution_model.service_modules:
|
|
17
16
|
if service_module.user_config.requires_configuration:
|
|
18
17
|
await UserConfig.apply_template(service_module)
|
|
18
|
+
await Update.InfoMsg(f"{service_module.name} - Complete")
|
|
19
|
+
else:
|
|
20
|
+
await Update.InfoMsg(f"{service_module.name} - Not Required")
|
|
19
21
|
|
|
20
|
-
await Update.SuccessMsg(f"
|
|
22
|
+
await Update.SuccessMsg(f"All config files complete")
|
|
21
23
|
|
|
22
24
|
@staticmethod
|
|
23
25
|
async def apply_template(sm: ServiceModuleModel):
|
|
24
26
|
# setup for template engine
|
|
27
|
+
|
|
28
|
+
await Update.DebugLog(f"Apply UC for {sm.name} -- {sm.user_config.context}")
|
|
29
|
+
|
|
25
30
|
jinja2_env = jinja2.Environment(
|
|
26
31
|
loader=jinja2.FileSystemLoader(sm.user_config.template.fs.dir)
|
|
27
32
|
)
|
|
@@ -45,9 +50,6 @@ class UserConfig:
|
|
|
45
50
|
sm.user_config.prev_answers = sm.user_config.answers
|
|
46
51
|
|
|
47
52
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
53
|
"""
|
|
52
54
|
Consider in Future:
|
|
53
55
|
* Looping prompts - e.g. power factor entry in PM analysis
|
{shoestring_assembler-0.1.1 → shoestring_assembler-0.2.0}/src/shoestring_assembler/engine/engine.py
RENAMED
|
@@ -125,7 +125,7 @@ class EngineInternal:
|
|
|
125
125
|
download_path = await self.download_solution(step.solution_spec)
|
|
126
126
|
resolution_args = [download_path]
|
|
127
127
|
case steps.AddInstalledSolution():
|
|
128
|
-
solution = await self.add_installed_solution(step.path)
|
|
128
|
+
solution = await self.add_installed_solution(step.path, step.base_name)
|
|
129
129
|
resolution_args = [solution]
|
|
130
130
|
case steps.SetSolutionContext():
|
|
131
131
|
outcome = await self.set_solution_context(step.solution)
|
|
@@ -164,6 +164,10 @@ class EngineInternal:
|
|
|
164
164
|
await self.download_update()
|
|
165
165
|
case steps.StopSolution():
|
|
166
166
|
await self.stop()
|
|
167
|
+
case steps.RemoveSolution():
|
|
168
|
+
await self.remove_solution()
|
|
169
|
+
case steps.RenameSolution():
|
|
170
|
+
await self.rename_solution(step.new_name)
|
|
167
171
|
|
|
168
172
|
step.resolve(*resolution_args)
|
|
169
173
|
|
|
@@ -197,8 +201,8 @@ class EngineInternal:
|
|
|
197
201
|
else:
|
|
198
202
|
raise FatalError("Unable to download solution")
|
|
199
203
|
|
|
200
|
-
async def add_installed_solution(self, path):
|
|
201
|
-
return await self.installed_solutions.add_solution(path)
|
|
204
|
+
async def add_installed_solution(self, path, base_name):
|
|
205
|
+
return await self.installed_solutions.add_solution(path, base_name)
|
|
202
206
|
|
|
203
207
|
async def set_solution_context(self, solution):
|
|
204
208
|
self.__solution_model = solution
|
|
@@ -214,7 +218,7 @@ class EngineInternal:
|
|
|
214
218
|
await Update.AttentionMsg("New Updates are available.")
|
|
215
219
|
return self.solution_model.version_control.available_updates[0]
|
|
216
220
|
else:
|
|
217
|
-
await Update.
|
|
221
|
+
await Update.NotifyMsg("Already using the latest update.")
|
|
218
222
|
return False
|
|
219
223
|
|
|
220
224
|
async def download_update(self):
|
|
@@ -237,10 +241,12 @@ class EngineInternal:
|
|
|
237
241
|
await Assembler(self.solution_model).generate_compose_file()
|
|
238
242
|
|
|
239
243
|
async def configure(self):
|
|
244
|
+
await Update.StageHeading("Generating Config Files")
|
|
240
245
|
await UserConfig.configure(self.solution_model)
|
|
241
246
|
|
|
242
247
|
async def build(self):
|
|
243
|
-
await Update.
|
|
248
|
+
await Update.StageHeading("Building solution")
|
|
249
|
+
await Update.InfoMsg("Building... (This may take several minutes)")
|
|
244
250
|
built = await Docker.build(self.solution_model)
|
|
245
251
|
if built:
|
|
246
252
|
await Update.SuccessMsg("Solution Built")
|
|
@@ -251,10 +257,12 @@ class EngineInternal:
|
|
|
251
257
|
return False
|
|
252
258
|
|
|
253
259
|
async def setup(self):
|
|
260
|
+
await Update.StageHeading("Setting up solution")
|
|
254
261
|
await Docker.setup_containers(self.solution_model)
|
|
262
|
+
await Update.SuccessMsg("Setup Complete")
|
|
255
263
|
|
|
256
264
|
async def start(self):
|
|
257
|
-
await Update.
|
|
265
|
+
await Update.StageHeading("Starting solution")
|
|
258
266
|
started = await Docker.start(self.solution_model)
|
|
259
267
|
if started:
|
|
260
268
|
await Update.SuccessMsg("Solution is now running in the background")
|
|
@@ -273,7 +281,16 @@ class EngineInternal:
|
|
|
273
281
|
await Update.SuccessMsg("Solution is now running in the background")
|
|
274
282
|
|
|
275
283
|
async def stop(self):
|
|
276
|
-
await Update.
|
|
284
|
+
await Update.StageHeading("Stopping solution")
|
|
277
285
|
stopped = await Docker.stop(self.solution_model)
|
|
278
286
|
if stopped:
|
|
279
287
|
await Update.SuccessMsg("Solution has now stopped")
|
|
288
|
+
|
|
289
|
+
async def remove_solution(self):
|
|
290
|
+
await Update.StageHeading("Removing Solution")
|
|
291
|
+
await self.installed_solutions.remove_solution(self.solution_model)
|
|
292
|
+
self.__solution_model = None
|
|
293
|
+
|
|
294
|
+
async def rename_solution(self, new_name):
|
|
295
|
+
await Update.StageHeading("Renaming Solution")
|
|
296
|
+
await self.installed_solutions.rename_solution(self.solution_model,new_name)
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
Created by PLY version 3.11 (http://www.dabeaz.com/ply)
|
|
2
|
+
|
|
3
|
+
Grammar
|
|
4
|
+
|
|
5
|
+
Rule 0 S' -> expression
|
|
6
|
+
Rule 1 expression -> ENTRY = ENTRY
|
|
7
|
+
Rule 2 expression -> expression & expression
|
|
8
|
+
Rule 3 expression -> expression | expression
|
|
9
|
+
Rule 4 expression -> ( expression )
|
|
10
|
+
|
|
11
|
+
Terminals, with rules where they appear
|
|
12
|
+
|
|
13
|
+
& : 2
|
|
14
|
+
( : 4
|
|
15
|
+
) : 4
|
|
16
|
+
= : 1
|
|
17
|
+
ENTRY : 1 1
|
|
18
|
+
error :
|
|
19
|
+
| : 3
|
|
20
|
+
|
|
21
|
+
Nonterminals, with rules where they appear
|
|
22
|
+
|
|
23
|
+
expression : 2 2 3 3 4 0
|
|
24
|
+
|
|
25
|
+
Parsing method: LALR
|
|
26
|
+
|
|
27
|
+
state 0
|
|
28
|
+
|
|
29
|
+
(0) S' -> . expression
|
|
30
|
+
(1) expression -> . ENTRY = ENTRY
|
|
31
|
+
(2) expression -> . expression & expression
|
|
32
|
+
(3) expression -> . expression | expression
|
|
33
|
+
(4) expression -> . ( expression )
|
|
34
|
+
|
|
35
|
+
ENTRY shift and go to state 2
|
|
36
|
+
( shift and go to state 3
|
|
37
|
+
|
|
38
|
+
expression shift and go to state 1
|
|
39
|
+
|
|
40
|
+
state 1
|
|
41
|
+
|
|
42
|
+
(0) S' -> expression .
|
|
43
|
+
(2) expression -> expression . & expression
|
|
44
|
+
(3) expression -> expression . | expression
|
|
45
|
+
|
|
46
|
+
& shift and go to state 4
|
|
47
|
+
| shift and go to state 5
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
state 2
|
|
51
|
+
|
|
52
|
+
(1) expression -> ENTRY . = ENTRY
|
|
53
|
+
|
|
54
|
+
= shift and go to state 6
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
state 3
|
|
58
|
+
|
|
59
|
+
(4) expression -> ( . expression )
|
|
60
|
+
(1) expression -> . ENTRY = ENTRY
|
|
61
|
+
(2) expression -> . expression & expression
|
|
62
|
+
(3) expression -> . expression | expression
|
|
63
|
+
(4) expression -> . ( expression )
|
|
64
|
+
|
|
65
|
+
ENTRY shift and go to state 2
|
|
66
|
+
( shift and go to state 3
|
|
67
|
+
|
|
68
|
+
expression shift and go to state 7
|
|
69
|
+
|
|
70
|
+
state 4
|
|
71
|
+
|
|
72
|
+
(2) expression -> expression & . expression
|
|
73
|
+
(1) expression -> . ENTRY = ENTRY
|
|
74
|
+
(2) expression -> . expression & expression
|
|
75
|
+
(3) expression -> . expression | expression
|
|
76
|
+
(4) expression -> . ( expression )
|
|
77
|
+
|
|
78
|
+
ENTRY shift and go to state 2
|
|
79
|
+
( shift and go to state 3
|
|
80
|
+
|
|
81
|
+
expression shift and go to state 8
|
|
82
|
+
|
|
83
|
+
state 5
|
|
84
|
+
|
|
85
|
+
(3) expression -> expression | . expression
|
|
86
|
+
(1) expression -> . ENTRY = ENTRY
|
|
87
|
+
(2) expression -> . expression & expression
|
|
88
|
+
(3) expression -> . expression | expression
|
|
89
|
+
(4) expression -> . ( expression )
|
|
90
|
+
|
|
91
|
+
ENTRY shift and go to state 2
|
|
92
|
+
( shift and go to state 3
|
|
93
|
+
|
|
94
|
+
expression shift and go to state 9
|
|
95
|
+
|
|
96
|
+
state 6
|
|
97
|
+
|
|
98
|
+
(1) expression -> ENTRY = . ENTRY
|
|
99
|
+
|
|
100
|
+
ENTRY shift and go to state 10
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
state 7
|
|
104
|
+
|
|
105
|
+
(4) expression -> ( expression . )
|
|
106
|
+
(2) expression -> expression . & expression
|
|
107
|
+
(3) expression -> expression . | expression
|
|
108
|
+
|
|
109
|
+
) shift and go to state 11
|
|
110
|
+
& shift and go to state 4
|
|
111
|
+
| shift and go to state 5
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
state 8
|
|
115
|
+
|
|
116
|
+
(2) expression -> expression & expression .
|
|
117
|
+
(2) expression -> expression . & expression
|
|
118
|
+
(3) expression -> expression . | expression
|
|
119
|
+
|
|
120
|
+
& reduce using rule 2 (expression -> expression & expression .)
|
|
121
|
+
| reduce using rule 2 (expression -> expression & expression .)
|
|
122
|
+
$end reduce using rule 2 (expression -> expression & expression .)
|
|
123
|
+
) reduce using rule 2 (expression -> expression & expression .)
|
|
124
|
+
|
|
125
|
+
! & [ shift and go to state 4 ]
|
|
126
|
+
! | [ shift and go to state 5 ]
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
state 9
|
|
130
|
+
|
|
131
|
+
(3) expression -> expression | expression .
|
|
132
|
+
(2) expression -> expression . & expression
|
|
133
|
+
(3) expression -> expression . | expression
|
|
134
|
+
|
|
135
|
+
& reduce using rule 3 (expression -> expression | expression .)
|
|
136
|
+
| reduce using rule 3 (expression -> expression | expression .)
|
|
137
|
+
$end reduce using rule 3 (expression -> expression | expression .)
|
|
138
|
+
) reduce using rule 3 (expression -> expression | expression .)
|
|
139
|
+
|
|
140
|
+
! & [ shift and go to state 4 ]
|
|
141
|
+
! | [ shift and go to state 5 ]
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
state 10
|
|
145
|
+
|
|
146
|
+
(1) expression -> ENTRY = ENTRY .
|
|
147
|
+
|
|
148
|
+
& reduce using rule 1 (expression -> ENTRY = ENTRY .)
|
|
149
|
+
| reduce using rule 1 (expression -> ENTRY = ENTRY .)
|
|
150
|
+
$end reduce using rule 1 (expression -> ENTRY = ENTRY .)
|
|
151
|
+
) reduce using rule 1 (expression -> ENTRY = ENTRY .)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
state 11
|
|
155
|
+
|
|
156
|
+
(4) expression -> ( expression ) .
|
|
157
|
+
|
|
158
|
+
& reduce using rule 4 (expression -> ( expression ) .)
|
|
159
|
+
| reduce using rule 4 (expression -> ( expression ) .)
|
|
160
|
+
$end reduce using rule 4 (expression -> ( expression ) .)
|
|
161
|
+
) reduce using rule 4 (expression -> ( expression ) .)
|
|
162
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
# parsetab.py
|
|
3
|
+
# This file is automatically generated. Do not edit.
|
|
4
|
+
# pylint: disable=W,C,R
|
|
5
|
+
_tabversion = '3.10'
|
|
6
|
+
|
|
7
|
+
_lr_method = 'LALR'
|
|
8
|
+
|
|
9
|
+
_lr_signature = 'left&|ENTRYexpression : ENTRY "=" ENTRYexpression : expression \'&\' expression\n | expression \'|\' expressionexpression : \'(\' expression \')\''
|
|
10
|
+
|
|
11
|
+
_lr_action_items = {'ENTRY':([0,3,4,5,6,],[2,2,2,2,10,]),'(':([0,3,4,5,],[3,3,3,3,]),'$end':([1,8,9,10,11,],[0,-2,-3,-1,-4,]),'&':([1,7,8,9,10,11,],[4,4,-2,-3,-1,-4,]),'|':([1,7,8,9,10,11,],[5,5,-2,-3,-1,-4,]),'=':([2,],[6,]),')':([7,8,9,10,11,],[11,-2,-3,-1,-4,]),}
|
|
12
|
+
|
|
13
|
+
_lr_action = {}
|
|
14
|
+
for _k, _v in _lr_action_items.items():
|
|
15
|
+
for _x,_y in zip(_v[0],_v[1]):
|
|
16
|
+
if not _x in _lr_action: _lr_action[_x] = {}
|
|
17
|
+
_lr_action[_x][_k] = _y
|
|
18
|
+
del _lr_action_items
|
|
19
|
+
|
|
20
|
+
_lr_goto_items = {'expression':([0,3,4,5,],[1,7,8,9,]),}
|
|
21
|
+
|
|
22
|
+
_lr_goto = {}
|
|
23
|
+
for _k, _v in _lr_goto_items.items():
|
|
24
|
+
for _x, _y in zip(_v[0], _v[1]):
|
|
25
|
+
if not _x in _lr_goto: _lr_goto[_x] = {}
|
|
26
|
+
_lr_goto[_x][_k] = _y
|
|
27
|
+
del _lr_goto_items
|
|
28
|
+
_lr_productions = [
|
|
29
|
+
("S' -> expression","S'",1,None,None,None),
|
|
30
|
+
('expression -> ENTRY = ENTRY','expression',3,'p_expression_assign','prompt_criteria.py',89),
|
|
31
|
+
('expression -> expression & expression','expression',3,'p_expression_binop','prompt_criteria.py',94),
|
|
32
|
+
('expression -> expression | expression','expression',3,'p_expression_binop','prompt_criteria.py',95),
|
|
33
|
+
('expression -> ( expression )','expression',3,'p_expression_group','prompt_criteria.py',103),
|
|
34
|
+
]
|