brainframe-cli 0.3.2__py3-none-any.whl → 0.3.4__py3-none-any.whl
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.
- brainframe/cli/__init__.py +1 -1
- brainframe/cli/brainframe_compose.py +62 -17
- brainframe/cli/brainframe_shell.py +24 -11
- brainframe/cli/commands/install.py +4 -7
- brainframe/cli/commands/self_update.py +87 -21
- brainframe/cli/commands/uninstall.py +1 -1
- brainframe/cli/commands/update.py +18 -16
- brainframe/cli/commands/utils.py +12 -0
- brainframe/cli/config.py +6 -2
- brainframe/cli/dependencies.py +12 -6
- brainframe/cli/main.py +8 -4
- brainframe/cli/network.py +3 -0
- brainframe/cli/os_utils.py +5 -12
- brainframe/cli/translations/general.en.yml +3 -0
- brainframe/cli/translations/install.en.yml +2 -0
- brainframe/cli/translations/self-update.en.yml +2 -0
- brainframe/cli/translations/shell.en.yml +2 -1
- brainframe/cli/translations/uninstall.en.yml +4 -2
- brainframe/cli/translations/update.en.yml +1 -6
- brainframe_cli-0.3.4.dist-info/METADATA +191 -0
- brainframe_cli-0.3.4.dist-info/RECORD +34 -0
- brainframe_cli-0.3.2.dist-info/COPYING +0 -26
- brainframe_cli-0.3.2.dist-info/METADATA +0 -121
- brainframe_cli-0.3.2.dist-info/RECORD +0 -34
- {brainframe_cli-0.3.2.dist-info → brainframe_cli-0.3.4.dist-info}/WHEEL +0 -0
- {brainframe_cli-0.3.2.dist-info → brainframe_cli-0.3.4.dist-info}/entry_points.txt +0 -0
brainframe/cli/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.3.
|
|
1
|
+
__version__ = "0.3.4"
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import os
|
|
2
|
+
import stat
|
|
2
3
|
import subprocess
|
|
3
4
|
import sys
|
|
4
5
|
from pathlib import Path
|
|
6
|
+
from tempfile import NamedTemporaryFile
|
|
5
7
|
from typing import List
|
|
6
8
|
from typing import Optional
|
|
7
9
|
from typing import Tuple
|
|
@@ -9,11 +11,14 @@ from typing import Tuple
|
|
|
9
11
|
import i18n
|
|
10
12
|
import requests
|
|
11
13
|
import yaml
|
|
14
|
+
from packaging.version import InvalidVersion
|
|
15
|
+
from packaging.version import Version
|
|
12
16
|
|
|
13
17
|
from . import config
|
|
14
18
|
from . import frozen_utils
|
|
15
19
|
from . import os_utils
|
|
16
20
|
from . import print_utils
|
|
21
|
+
from .network import HTTP_TIMEOUT
|
|
17
22
|
|
|
18
23
|
# The URL to the docker-compose.yml
|
|
19
24
|
BRAINFRAME_DOCKER_COMPOSE_URL = "https://{subdomain}aotu.ai/releases/brainframe/{version}/docker-compose.yml"
|
|
@@ -35,23 +40,25 @@ def assert_installed(install_path: Path) -> None:
|
|
|
35
40
|
|
|
36
41
|
|
|
37
42
|
def get_docker_compose_command():
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
compose_version = subprocess.check_output(
|
|
41
|
-
["docker", "compose", "version", "--short"],
|
|
42
|
-
stderr=subprocess.DEVNULL,
|
|
43
|
-
)
|
|
44
|
-
return ["docker", "compose"], compose_version
|
|
45
|
-
except subprocess.CalledProcessError as e2:
|
|
43
|
+
failure = None
|
|
44
|
+
for command in (["docker", "compose"], ["docker-compose"]):
|
|
46
45
|
try:
|
|
47
46
|
compose_version = subprocess.check_output(
|
|
48
|
-
["
|
|
47
|
+
command + ["version", "--short"],
|
|
49
48
|
stderr=subprocess.DEVNULL,
|
|
50
49
|
)
|
|
51
|
-
return
|
|
52
|
-
except
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
return command, compose_version
|
|
51
|
+
except FileNotFoundError:
|
|
52
|
+
continue
|
|
53
|
+
except (OSError, subprocess.CalledProcessError) as error:
|
|
54
|
+
failure = "{}: {}".format(" ".join(command), error)
|
|
55
|
+
if failure is not None:
|
|
56
|
+
print_utils.fail_translate(
|
|
57
|
+
"install.compose-command-failed", error=failure
|
|
58
|
+
)
|
|
59
|
+
print_utils.fail_translate(
|
|
60
|
+
"install.install-dependency-manually", dependency="Docker Compose"
|
|
61
|
+
)
|
|
55
62
|
|
|
56
63
|
|
|
57
64
|
def run(install_path: Path, commands: List[str]) -> None:
|
|
@@ -106,7 +113,9 @@ def download(target: Path, version: str = "latest") -> None:
|
|
|
106
113
|
subdomain="staging." if config.is_staging.value else "",
|
|
107
114
|
version=version,
|
|
108
115
|
)
|
|
109
|
-
response = requests.get(
|
|
116
|
+
response = requests.get(
|
|
117
|
+
url, auth=credentials, stream=True, timeout=HTTP_TIMEOUT
|
|
118
|
+
)
|
|
110
119
|
if not response.ok:
|
|
111
120
|
print_utils.fail_translate(
|
|
112
121
|
"general.error-downloading-docker-compose",
|
|
@@ -114,7 +123,7 @@ def download(target: Path, version: str = "latest") -> None:
|
|
|
114
123
|
error_message=response.text,
|
|
115
124
|
)
|
|
116
125
|
|
|
117
|
-
target
|
|
126
|
+
_replace_compose_file(target, response.text)
|
|
118
127
|
|
|
119
128
|
if os_utils.is_root():
|
|
120
129
|
# Fix the permissions of the docker-compose.yml so that the BrainFrame
|
|
@@ -122,6 +131,32 @@ def download(target: Path, version: str = "latest") -> None:
|
|
|
122
131
|
os_utils.give_brainframe_group_rw_access([target])
|
|
123
132
|
|
|
124
133
|
|
|
134
|
+
def _replace_compose_file(target: Path, contents: str) -> None:
|
|
135
|
+
temporary_path = None
|
|
136
|
+
try:
|
|
137
|
+
with NamedTemporaryFile(
|
|
138
|
+
"w",
|
|
139
|
+
encoding="utf-8",
|
|
140
|
+
prefix=".brainframe-compose-",
|
|
141
|
+
dir=str(target.parent),
|
|
142
|
+
delete=False,
|
|
143
|
+
) as temporary:
|
|
144
|
+
temporary_path = Path(temporary.name)
|
|
145
|
+
temporary.write(contents)
|
|
146
|
+
temporary.flush()
|
|
147
|
+
os.fsync(temporary.fileno())
|
|
148
|
+
|
|
149
|
+
if target.exists():
|
|
150
|
+
existing = target.stat()
|
|
151
|
+
temporary_path.chmod(stat.S_IMODE(existing.st_mode))
|
|
152
|
+
if temporary_path.stat().st_gid != existing.st_gid:
|
|
153
|
+
os.chown(str(temporary_path), -1, existing.st_gid)
|
|
154
|
+
os.replace(str(temporary_path), str(target))
|
|
155
|
+
finally:
|
|
156
|
+
if temporary_path is not None and temporary_path.exists():
|
|
157
|
+
temporary_path.unlink()
|
|
158
|
+
|
|
159
|
+
|
|
125
160
|
def get_latest_version() -> str:
|
|
126
161
|
"""
|
|
127
162
|
:return: The latest available version in the format "vX.Y.Z"
|
|
@@ -133,8 +168,18 @@ def get_latest_version() -> str:
|
|
|
133
168
|
|
|
134
169
|
# Check what the latest version is
|
|
135
170
|
url = BRAINFRAME_LATEST_TAG_URL.format(subdomain=subdomain)
|
|
136
|
-
response = requests.get(url, auth=credentials)
|
|
137
|
-
|
|
171
|
+
response = requests.get(url, auth=credentials, timeout=HTTP_TIMEOUT)
|
|
172
|
+
if not response.ok:
|
|
173
|
+
print_utils.fail_translate(
|
|
174
|
+
"general.error-getting-latest-version",
|
|
175
|
+
status_code=response.status_code,
|
|
176
|
+
)
|
|
177
|
+
latest_version = response.text.strip()
|
|
178
|
+
try:
|
|
179
|
+
Version(latest_version)
|
|
180
|
+
except InvalidVersion:
|
|
181
|
+
print_utils.fail_translate("general.invalid-latest-version")
|
|
182
|
+
return latest_version
|
|
138
183
|
|
|
139
184
|
|
|
140
185
|
def check_existing_version(install_path: Path) -> str:
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import getpass
|
|
2
1
|
import os
|
|
2
|
+
import shlex
|
|
3
3
|
import subprocess
|
|
4
4
|
import sys
|
|
5
5
|
|
|
6
|
-
import i18n
|
|
7
|
-
import requests
|
|
8
|
-
import yaml
|
|
9
|
-
|
|
10
6
|
from . import os_utils
|
|
11
7
|
from . import print_utils
|
|
12
8
|
from .brainframe_compose import assert_has_docker_permissions
|
|
@@ -15,15 +11,32 @@ from .brainframe_compose import assert_has_docker_permissions
|
|
|
15
11
|
def run() -> None:
|
|
16
12
|
assert_has_docker_permissions()
|
|
17
13
|
|
|
18
|
-
image_name =
|
|
19
|
-
|
|
14
|
+
image_name = os.environ.get(
|
|
15
|
+
"BRAINFRAME_SHELL_IMAGE", "aotuai/brainframe-cli-20.04:0.3.2"
|
|
16
|
+
)
|
|
17
|
+
host_user = os_utils._current_user()
|
|
20
18
|
host_dir = os.getcwd()
|
|
21
|
-
full_command =
|
|
19
|
+
full_command = [
|
|
20
|
+
"docker",
|
|
21
|
+
"run",
|
|
22
|
+
"-it",
|
|
23
|
+
"--rm",
|
|
24
|
+
"-v",
|
|
25
|
+
"{}:/host".format(host_dir),
|
|
26
|
+
"-w",
|
|
27
|
+
"/host",
|
|
28
|
+
"-e",
|
|
29
|
+
"HOST_USER={}".format(host_user),
|
|
30
|
+
image_name,
|
|
31
|
+
]
|
|
22
32
|
|
|
23
|
-
print_utils.translate(
|
|
33
|
+
print_utils.translate(
|
|
34
|
+
" ".join(shlex.quote(part) for part in full_command),
|
|
35
|
+
color=print_utils.Color.GREEN,
|
|
36
|
+
)
|
|
24
37
|
|
|
25
38
|
try:
|
|
26
|
-
subprocess.run(full_command,
|
|
27
|
-
except
|
|
39
|
+
subprocess.run(full_command, check=True)
|
|
40
|
+
except (OSError, subprocess.CalledProcessError) as e:
|
|
28
41
|
print(f"Error: Failed to pull or run the image. Details: {e}")
|
|
29
42
|
sys.exit(1)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import shutil
|
|
2
1
|
from argparse import ArgumentParser
|
|
3
2
|
from pathlib import Path
|
|
4
3
|
|
|
@@ -31,12 +30,10 @@ def install():
|
|
|
31
30
|
|
|
32
31
|
# Check all dependencies
|
|
33
32
|
dependencies.docker.ensure(args.noninteractive, args.install_docker)
|
|
34
|
-
#
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
dependency="docker-compose",
|
|
39
|
-
)
|
|
33
|
+
# Frozen distributions cannot provide Compose through a Python dependency.
|
|
34
|
+
# Accept either the Docker Compose plugin or the standalone command.
|
|
35
|
+
if frozen_utils.is_frozen():
|
|
36
|
+
brainframe_compose.get_docker_compose_command()
|
|
40
37
|
|
|
41
38
|
download_version = brainframe_compose.get_latest_version()
|
|
42
39
|
print_utils.translate("install.install-version", version=download_version)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import hashlib
|
|
1
2
|
import os
|
|
2
|
-
import
|
|
3
|
+
import re
|
|
3
4
|
import stat
|
|
4
5
|
import sys
|
|
5
6
|
from argparse import ArgumentParser
|
|
@@ -7,7 +8,6 @@ from pathlib import Path
|
|
|
7
8
|
from tempfile import NamedTemporaryFile
|
|
8
9
|
from typing import Optional
|
|
9
10
|
from typing import Tuple
|
|
10
|
-
from typing import Union
|
|
11
11
|
|
|
12
12
|
import i18n
|
|
13
13
|
import requests
|
|
@@ -15,13 +15,16 @@ from brainframe.cli import __version__
|
|
|
15
15
|
from brainframe.cli import config
|
|
16
16
|
from brainframe.cli import frozen_utils
|
|
17
17
|
from brainframe.cli import print_utils
|
|
18
|
-
from
|
|
18
|
+
from brainframe.cli.network import HTTP_TIMEOUT
|
|
19
|
+
from packaging.version import Version
|
|
19
20
|
|
|
20
21
|
from .utils import command
|
|
22
|
+
from .utils import parse_version
|
|
21
23
|
|
|
22
24
|
_RELEASES_URL_PREFIX = "https://{subdomain}aotu.ai"
|
|
23
25
|
_BINARY_URL = "{prefix}/releases/brainframe-cli/brainframe"
|
|
24
26
|
_LATEST_TAG_URL = "{prefix}/releases/brainframe-cli/latest"
|
|
27
|
+
_CHECKSUM_URL = "{prefix}/releases/brainframe-cli/brainframe.sha256"
|
|
25
28
|
|
|
26
29
|
|
|
27
30
|
@command("self-update")
|
|
@@ -42,6 +45,13 @@ def self_update():
|
|
|
42
45
|
error_message += "\n"
|
|
43
46
|
error_message += i18n.t("general.retry-as-root")
|
|
44
47
|
print_utils.fail(error_message)
|
|
48
|
+
if not os.access(executable_path.parent, os.W_OK):
|
|
49
|
+
error_message = i18n.t(
|
|
50
|
+
"general.file-bad-write-permissions", path=executable_path.parent
|
|
51
|
+
)
|
|
52
|
+
error_message += "\n"
|
|
53
|
+
error_message += i18n.t("general.retry-as-root")
|
|
54
|
+
print_utils.fail(error_message)
|
|
45
55
|
|
|
46
56
|
credentials = config.staging_credentials()
|
|
47
57
|
|
|
@@ -50,7 +60,7 @@ def self_update():
|
|
|
50
60
|
)
|
|
51
61
|
binary_url = _BINARY_URL.format(prefix=prefix)
|
|
52
62
|
|
|
53
|
-
current_version =
|
|
63
|
+
current_version = parse_version(__version__)
|
|
54
64
|
latest_version = _latest_version(prefix, credentials)
|
|
55
65
|
|
|
56
66
|
if current_version >= latest_version:
|
|
@@ -60,9 +70,22 @@ def self_update():
|
|
|
60
70
|
latest_version=latest_version,
|
|
61
71
|
)
|
|
62
72
|
|
|
73
|
+
checksum_response = requests.get(
|
|
74
|
+
_CHECKSUM_URL.format(prefix=prefix),
|
|
75
|
+
auth=credentials,
|
|
76
|
+
timeout=HTTP_TIMEOUT,
|
|
77
|
+
)
|
|
78
|
+
if not checksum_response.ok or not re.fullmatch(
|
|
79
|
+
r"[0-9a-fA-F]{64}", checksum_response.text.strip()
|
|
80
|
+
):
|
|
81
|
+
print_utils.fail_translate("self-update.invalid-checksum")
|
|
82
|
+
expected_sha256 = checksum_response.text.strip().lower()
|
|
83
|
+
|
|
63
84
|
# Get the updated executable
|
|
64
85
|
print_utils.translate("self-update.downloading")
|
|
65
|
-
response = requests.get(
|
|
86
|
+
response = requests.get(
|
|
87
|
+
binary_url, auth=credentials, stream=True, timeout=HTTP_TIMEOUT
|
|
88
|
+
)
|
|
66
89
|
if not response.ok:
|
|
67
90
|
print_utils.fail_translate(
|
|
68
91
|
"self-update.error-downloading",
|
|
@@ -70,20 +93,19 @@ def self_update():
|
|
|
70
93
|
error_message=response.text,
|
|
71
94
|
)
|
|
72
95
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
96
|
+
try:
|
|
97
|
+
_replace_executable(
|
|
98
|
+
executable_path,
|
|
99
|
+
response.iter_content(_BLOCK_SIZE),
|
|
100
|
+
expected_size=(
|
|
101
|
+
int(response.headers["Content-Length"])
|
|
102
|
+
if "Content-Length" in response.headers
|
|
103
|
+
else None
|
|
104
|
+
),
|
|
105
|
+
expected_sha256=expected_sha256,
|
|
82
106
|
)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
# Really excited for copy3, coming this summer
|
|
86
|
-
shutil.copy2(new_executable.name, executable_path)
|
|
107
|
+
except (ValueError, requests.RequestException) as error:
|
|
108
|
+
print_utils.fail_translate("self-update.invalid-download", error=error)
|
|
87
109
|
|
|
88
110
|
print()
|
|
89
111
|
print_utils.translate(
|
|
@@ -91,12 +113,56 @@ def self_update():
|
|
|
91
113
|
)
|
|
92
114
|
|
|
93
115
|
|
|
116
|
+
def _replace_executable(
|
|
117
|
+
executable_path: Path, blocks, expected_size=None, expected_sha256=None
|
|
118
|
+
) -> None:
|
|
119
|
+
"""Write a complete replacement next to the executable, then swap it in."""
|
|
120
|
+
temporary_path = None
|
|
121
|
+
digest = hashlib.sha256()
|
|
122
|
+
size = 0
|
|
123
|
+
header = b""
|
|
124
|
+
try:
|
|
125
|
+
with NamedTemporaryFile(
|
|
126
|
+
"wb",
|
|
127
|
+
prefix=".brainframe-update-",
|
|
128
|
+
dir=str(executable_path.parent),
|
|
129
|
+
delete=False,
|
|
130
|
+
) as new_executable:
|
|
131
|
+
temporary_path = Path(new_executable.name)
|
|
132
|
+
for block in blocks:
|
|
133
|
+
if not block:
|
|
134
|
+
continue
|
|
135
|
+
header = (header + block[:4])[:4]
|
|
136
|
+
digest.update(block)
|
|
137
|
+
size += len(block)
|
|
138
|
+
new_executable.write(block)
|
|
139
|
+
if header != b"\x7fELF":
|
|
140
|
+
raise ValueError("download is not an ELF executable")
|
|
141
|
+
if expected_size is not None and size != expected_size:
|
|
142
|
+
raise ValueError("download size differs from Content-Length")
|
|
143
|
+
if (
|
|
144
|
+
expected_sha256 is not None
|
|
145
|
+
and digest.hexdigest() != expected_sha256
|
|
146
|
+
):
|
|
147
|
+
raise ValueError("download checksum does not match")
|
|
148
|
+
new_executable.flush()
|
|
149
|
+
os.fsync(new_executable.fileno())
|
|
150
|
+
|
|
151
|
+
temporary_path.chmod(stat.S_IMODE(executable_path.stat().st_mode))
|
|
152
|
+
os.replace(str(temporary_path), str(executable_path))
|
|
153
|
+
finally:
|
|
154
|
+
if temporary_path is not None and temporary_path.exists():
|
|
155
|
+
temporary_path.unlink()
|
|
156
|
+
|
|
157
|
+
|
|
94
158
|
def _latest_version(
|
|
95
159
|
url_prefix: str,
|
|
96
160
|
credentials: Optional[Tuple[str, str]],
|
|
97
|
-
) ->
|
|
161
|
+
) -> Version:
|
|
98
162
|
latest_tag_url = _LATEST_TAG_URL.format(prefix=url_prefix)
|
|
99
|
-
response = requests.get(
|
|
163
|
+
response = requests.get(
|
|
164
|
+
latest_tag_url, auth=credentials, timeout=HTTP_TIMEOUT
|
|
165
|
+
)
|
|
100
166
|
|
|
101
167
|
if not response.ok:
|
|
102
168
|
print_utils.fail_translate(
|
|
@@ -105,7 +171,7 @@ def _latest_version(
|
|
|
105
171
|
error_message=response.text,
|
|
106
172
|
)
|
|
107
173
|
|
|
108
|
-
return
|
|
174
|
+
return parse_version(response.text)
|
|
109
175
|
|
|
110
176
|
|
|
111
177
|
def _parse_args():
|
|
@@ -4,9 +4,9 @@ import i18n
|
|
|
4
4
|
from brainframe.cli import brainframe_compose
|
|
5
5
|
from brainframe.cli import config
|
|
6
6
|
from brainframe.cli import print_utils
|
|
7
|
-
from packaging import version
|
|
8
7
|
|
|
9
8
|
from .utils import command
|
|
9
|
+
from .utils import parse_version
|
|
10
10
|
from .utils import subcommand_parse_args
|
|
11
11
|
|
|
12
12
|
|
|
@@ -27,21 +27,22 @@ def update():
|
|
|
27
27
|
install_path
|
|
28
28
|
)
|
|
29
29
|
|
|
30
|
-
existing_version =
|
|
31
|
-
requested_version =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
30
|
+
existing_version = parse_version(existing_version_str)
|
|
31
|
+
requested_version = parse_version(requested_version_str)
|
|
32
|
+
|
|
33
|
+
force = args.force
|
|
34
|
+
if (
|
|
35
|
+
not force
|
|
36
|
+
and not args.noninteractive
|
|
37
|
+
and existing_version > requested_version
|
|
38
|
+
):
|
|
39
|
+
force = print_utils.ask_yes_no(
|
|
40
|
+
"update.ask-force-downgrade",
|
|
41
|
+
existing_version=existing_version_str,
|
|
42
|
+
requested_version=requested_version_str,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
if not force:
|
|
45
46
|
# Fail if the requested version is not an upgrade
|
|
46
47
|
if existing_version == requested_version:
|
|
47
48
|
print_utils.fail_translate(
|
|
@@ -105,6 +106,7 @@ def _parse_args():
|
|
|
105
106
|
)
|
|
106
107
|
|
|
107
108
|
parser.add_argument(
|
|
109
|
+
"-f",
|
|
108
110
|
"--force",
|
|
109
111
|
action="store_true",
|
|
110
112
|
help=i18n.t("update.force-help"),
|
brainframe/cli/commands/utils.py
CHANGED
|
@@ -6,6 +6,7 @@ from typing import Callable
|
|
|
6
6
|
|
|
7
7
|
from brainframe.cli import os_utils
|
|
8
8
|
from brainframe.cli import print_utils
|
|
9
|
+
from packaging import version
|
|
9
10
|
|
|
10
11
|
by_name = {}
|
|
11
12
|
"""A dict that maps command names to their corresponding function"""
|
|
@@ -42,3 +43,14 @@ def requires_root(function: Callable) -> Callable:
|
|
|
42
43
|
return function(*args, **kwargs)
|
|
43
44
|
|
|
44
45
|
return wrapper
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def parse_version(version_str: str) -> version.Version:
|
|
49
|
+
"""Parses a version string, exiting with a readable error if it is
|
|
50
|
+
malformed."""
|
|
51
|
+
try:
|
|
52
|
+
return version.Version(version_str.strip())
|
|
53
|
+
except version.InvalidVersion:
|
|
54
|
+
print_utils.fail_translate(
|
|
55
|
+
"general.invalid-version", version=version_str.strip()
|
|
56
|
+
)
|
brainframe/cli/config.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import os
|
|
2
|
-
from distutils.util import strtobool
|
|
3
2
|
from pathlib import Path
|
|
4
3
|
from typing import Callable
|
|
5
4
|
from typing import Dict
|
|
@@ -92,4 +91,9 @@ def _bool_converter(value: Union[str, bool]) -> bool:
|
|
|
92
91
|
if isinstance(value, bool):
|
|
93
92
|
return value
|
|
94
93
|
|
|
95
|
-
|
|
94
|
+
normalized = value.lower()
|
|
95
|
+
if normalized in ("y", "yes", "t", "true", "on", "1"):
|
|
96
|
+
return True
|
|
97
|
+
if normalized in ("n", "no", "f", "false", "off", "0"):
|
|
98
|
+
return False
|
|
99
|
+
raise ValueError("invalid truth value {!r}".format(value))
|
brainframe/cli/dependencies.py
CHANGED
|
@@ -5,6 +5,7 @@ import requests
|
|
|
5
5
|
|
|
6
6
|
from . import os_utils
|
|
7
7
|
from . import print_utils
|
|
8
|
+
from .network import HTTP_TIMEOUT
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
class Dependency:
|
|
@@ -26,16 +27,16 @@ class Dependency:
|
|
|
26
27
|
:param install_requested: If true, the user opted in to automatic
|
|
27
28
|
noninteractive installation
|
|
28
29
|
"""
|
|
29
|
-
|
|
30
|
+
if shutil.which(self.command_name) is not None:
|
|
31
|
+
# The command is already installed
|
|
32
|
+
return
|
|
33
|
+
|
|
34
|
+
# Only supported operating systems can request automatic installs.
|
|
30
35
|
if install_requested and not os_utils.is_supported():
|
|
31
36
|
print_utils.fail_translate(
|
|
32
37
|
"install.install-dependency-unsupported-os"
|
|
33
38
|
)
|
|
34
39
|
|
|
35
|
-
if shutil.which(self.command_name) is not None:
|
|
36
|
-
# The command is already installed
|
|
37
|
-
return
|
|
38
|
-
|
|
39
40
|
print_utils.translate(
|
|
40
41
|
"install.missing-dependency", dependency=self.command_name
|
|
41
42
|
)
|
|
@@ -59,7 +60,12 @@ class Dependency:
|
|
|
59
60
|
|
|
60
61
|
|
|
61
62
|
def _install_docker():
|
|
62
|
-
response = requests.get("https://get.docker.com")
|
|
63
|
+
response = requests.get("https://get.docker.com", timeout=HTTP_TIMEOUT)
|
|
64
|
+
if not response.ok:
|
|
65
|
+
print_utils.fail_translate(
|
|
66
|
+
"install.get-docker-script-http-error",
|
|
67
|
+
status_code=response.status_code,
|
|
68
|
+
)
|
|
63
69
|
|
|
64
70
|
with NamedTemporaryFile("w") as get_docker_script:
|
|
65
71
|
get_docker_script.write(response.text)
|
brainframe/cli/main.py
CHANGED
|
@@ -6,6 +6,7 @@ import sys
|
|
|
6
6
|
from argparse import ArgumentParser
|
|
7
7
|
|
|
8
8
|
import i18n
|
|
9
|
+
from brainframe.cli import __version__
|
|
9
10
|
from brainframe.cli import commands
|
|
10
11
|
from brainframe.cli import config
|
|
11
12
|
from brainframe.cli import frozen_utils
|
|
@@ -23,6 +24,11 @@ def main():
|
|
|
23
24
|
parser.add_argument(
|
|
24
25
|
"command", default=None, nargs="?", help=i18n.t("portal.command-help")
|
|
25
26
|
)
|
|
27
|
+
parser.add_argument(
|
|
28
|
+
"--version",
|
|
29
|
+
action="version",
|
|
30
|
+
version="brainframe {}".format(__version__),
|
|
31
|
+
)
|
|
26
32
|
|
|
27
33
|
config.load()
|
|
28
34
|
|
|
@@ -49,16 +55,14 @@ def main():
|
|
|
49
55
|
|
|
50
56
|
if args.command is None:
|
|
51
57
|
print_utils.translate("portal.no-command-provided")
|
|
58
|
+
sys.exit(2)
|
|
52
59
|
elif args.command in commands.by_name:
|
|
53
60
|
command = commands.by_name[args.command]
|
|
54
61
|
command()
|
|
55
62
|
else:
|
|
56
63
|
error_message = i18n.t("portal.unknown-command")
|
|
57
64
|
error_message = error_message.format(command=args.command)
|
|
58
|
-
|
|
59
|
-
error_message, color=print_utils.Color.RED, file=sys.stderr
|
|
60
|
-
)
|
|
61
|
-
parser.print_help()
|
|
65
|
+
parser.error(error_message)
|
|
62
66
|
|
|
63
67
|
|
|
64
68
|
if __name__ == "__main__":
|
brainframe/cli/os_utils.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import getpass
|
|
1
2
|
import os
|
|
2
3
|
import subprocess
|
|
3
4
|
import sys
|
|
@@ -135,7 +136,7 @@ def _current_user():
|
|
|
135
136
|
# "Why not use $USER here?" you might ask. Apparently $LOGNAME is a
|
|
136
137
|
# POSIX standard and $USER is not.
|
|
137
138
|
# https://unix.stackexchange.com/a/76369/117461
|
|
138
|
-
return os.environ.get("SUDO_USER"
|
|
139
|
+
return os.environ.get("SUDO_USER") or getpass.getuser()
|
|
139
140
|
|
|
140
141
|
|
|
141
142
|
def run(
|
|
@@ -168,18 +169,10 @@ def run(
|
|
|
168
169
|
return current_command.process
|
|
169
170
|
|
|
170
171
|
|
|
171
|
-
_SUPPORTED_DISTROS = {
|
|
172
|
-
"Ubuntu": ["18.04", "20.04"],
|
|
173
|
-
}
|
|
174
|
-
"""A dict whose keys are supported Linux distribution names and whose values
|
|
175
|
-
are all supported versions for that distribution.
|
|
176
|
-
"""
|
|
177
|
-
|
|
178
|
-
|
|
179
172
|
def is_supported() -> bool:
|
|
180
173
|
"""
|
|
181
174
|
:return: True if the user is on an officially supported Linux distribution
|
|
175
|
+
(Ubuntu). Releases are deliberately not enumerated, so a new Ubuntu
|
|
176
|
+
release does not require a code change.
|
|
182
177
|
"""
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
return name in _SUPPORTED_DISTROS and version in _SUPPORTED_DISTROS[name]
|
|
178
|
+
return distro.id() == "ubuntu"
|
|
@@ -6,6 +6,8 @@ en:
|
|
|
6
6
|
downloading-docker-compose: "Downloading docker-compose.yml..."
|
|
7
7
|
error-downloading-docker-compose: "Error while downloading
|
|
8
8
|
docker-compose.yml: HTTP %{status_code} - %{error_message}"
|
|
9
|
+
error-getting-latest-version: "Could not check the latest BrainFrame version: HTTP %{status_code}."
|
|
10
|
+
invalid-latest-version: "The latest BrainFrame version response is invalid."
|
|
9
11
|
noninteractive-help: "Prevents this command from prompting for input and
|
|
10
12
|
pulls configuration from flags instead. This can be useful for scripts."
|
|
11
13
|
adding-to-group: "Adding user to the %{group} group"
|
|
@@ -34,3 +36,4 @@ en:
|
|
|
34
36
|
missing-defaults-file: "This distribution is missing a defaults file. Please
|
|
35
37
|
re-install the latest version of the BrainFrame CLI and try again."
|
|
36
38
|
interrupted: "The operation was interrupted"
|
|
39
|
+
invalid-version: "\"%{version}\" is not a valid version number."
|
|
@@ -33,6 +33,7 @@ en:
|
|
|
33
33
|
supported for this operating system."
|
|
34
34
|
missing-dependency: "Dependency %{dependency} appears to be missing"
|
|
35
35
|
install-dependency-manually: "Please install %{dependency} and try again"
|
|
36
|
+
compose-command-failed: "Docker Compose is present but could not run: %{error}"
|
|
36
37
|
docker-compose-download-error: "Error while downloading the
|
|
37
38
|
docker-compose.yml file: {error}"
|
|
38
39
|
default-paths: "By default, the BrainFrame docker-compose.yml will be
|
|
@@ -60,6 +61,7 @@ en:
|
|
|
60
61
|
through the script at get.docker.com. Would you like to do this?"
|
|
61
62
|
get-docker-script-failed: "Failed to download the Docker installation script:
|
|
62
63
|
{error}"
|
|
64
|
+
get-docker-script-http-error: "Failed to download the Docker installation script: HTTP %{status_code}."
|
|
63
65
|
ask-docker-compose-path: "Where should Docker Compose be installed to?"
|
|
64
66
|
get-docker-compose-failed: "Failed to download Docker Compose: {error}"
|
|
65
67
|
unsupported-os: "Warning: You are using an unsupported operating system.
|
|
@@ -10,6 +10,8 @@ en:
|
|
|
10
10
|
HTTP %{status_code} - %{error_message}"
|
|
11
11
|
error-downloading: "Error while downloading the new version: HTTP
|
|
12
12
|
%{status_code} - %{error_message}"
|
|
13
|
+
invalid-checksum: "The release checksum is missing or invalid. The current executable was preserved."
|
|
14
|
+
invalid-download: "The downloaded executable failed validation: %{error}. The current executable was preserved."
|
|
13
15
|
|
|
14
16
|
already-up-to-date: "The CLI is already up-to-date. (Current version:
|
|
15
17
|
%{current_version}, latest version: %{latest_version})"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
en:
|
|
2
2
|
description: "Provides a shell to run various pre-installed cli commands to control,
|
|
3
|
-
monitor brainframe server, and download VisionCapsules
|
|
3
|
+
monitor brainframe server, and download VisionCapsules. Set
|
|
4
|
+
BRAINFRAME_SHELL_IMAGE to use a different published shell image."
|
|
4
5
|
usage: >-
|
|
5
6
|
brainframe shell
|
|
6
7
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
en:
|
|
2
|
-
description: "Uninstalls the BrainFrame server
|
|
3
|
-
uninstall the BrainFrame CLI itself."
|
|
2
|
+
description: "Uninstalls the BrainFrame server and deletes its install directory.
|
|
3
|
+
This command does not uninstall the BrainFrame CLI itself."
|
|
4
4
|
usage: "brainframe uninstall [<args>]"
|
|
5
5
|
delete-data-help: "If provided, data created by the BrainFrame server will be
|
|
6
6
|
deleted as well"
|
|
7
|
+
noninteractive-help: "Skip confirmation and delete the server install directory.
|
|
8
|
+
Add --delete-data to also delete the data directory."
|
|
7
9
|
|
|
8
10
|
ask-delete-data: "Would you like to delete all data created by the BrainFrame
|
|
9
11
|
server as well?"
|
|
@@ -13,11 +13,6 @@ en:
|
|
|
13
13
|
complete: "BrainFrame has been updated!"
|
|
14
14
|
upgrade-version: "BrainFrame:%{existing_version} detected under your installation
|
|
15
15
|
location, we will replace it with BrainFrame:%{requested_version}"
|
|
16
|
-
version-failing: "You have BrainFrame:%{existing_version} installed already.
|
|
17
|
-
The latest available version is BrainFrame:%{upgrade_version}. We don't
|
|
18
|
-
recommend downgrading BrainFrame for data integrity reasons. This request
|
|
19
|
-
will be ignored. You can force a downgrade by also supplying the --downgrade
|
|
20
|
-
flag."
|
|
21
16
|
version-already-installed: "BrainFrame:%{existing_version} is already
|
|
22
17
|
installed. This request will be ignored. You can force this release to be
|
|
23
18
|
re-downloaded using the --force flag."
|
|
@@ -26,6 +21,6 @@ en:
|
|
|
26
21
|
don't recommend downgrading BrainFrame for data integrity reasons. This
|
|
27
22
|
request will be ignored. You can force a downgrade using the --force flag."
|
|
28
23
|
ask-force-downgrade: "BrainFrame:%{requested_version} does not appear to
|
|
29
|
-
be a newer version
|
|
24
|
+
be a newer version than the current version, BrainFrame:%{existing_version}.
|
|
30
25
|
Downgrading BrainFrame is not officially supported and may lead to data loss.
|
|
31
26
|
Are you sure you want to continue?"
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: brainframe-cli
|
|
3
|
+
Version: 0.3.4
|
|
4
|
+
Summary: Makes installing and managing a BrainFrame server easy
|
|
5
|
+
Home-page: https://github.com/aotuai/brainframe_cli
|
|
6
|
+
License: BSD-3-Clause
|
|
7
|
+
Author: Aotu.ai
|
|
8
|
+
Author-email: info@aotu.ai
|
|
9
|
+
Requires-Python: >=3.6.9,<3.13
|
|
10
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Requires-Dist: distro (>=1.5,<2.0)
|
|
19
|
+
Requires-Dist: docker (>4.3.1,<7.0.0)
|
|
20
|
+
Requires-Dist: docker-compose (>=1.29.2,<2.0.0) ; python_version < "3.10"
|
|
21
|
+
Requires-Dist: packaging (>=20.4)
|
|
22
|
+
Requires-Dist: python-i18n (>=0.3,<0.4)
|
|
23
|
+
Requires-Dist: pyyaml (>=3.10,<6) ; python_version < "3.10"
|
|
24
|
+
Requires-Dist: pyyaml (>=6.0) ; python_version >= "3.10"
|
|
25
|
+
Requires-Dist: requests (>=2.24.0,<3.0.0)
|
|
26
|
+
Requires-Dist: urllib3 (<2) ; python_version < "3.10"
|
|
27
|
+
Requires-Dist: websocket-client (>=0.32.0,<1.0)
|
|
28
|
+
Project-URL: Repository, https://github.com/aotuai/brainframe_cli
|
|
29
|
+
Description-Content-Type: text/x-rst
|
|
30
|
+
|
|
31
|
+
==============
|
|
32
|
+
BrainFrame CLI
|
|
33
|
+
==============
|
|
34
|
+
|
|
35
|
+
The BrainFrame CLI is a tool for installing and managing a BrainFrame server.
|
|
36
|
+
|
|
37
|
+
Installation
|
|
38
|
+
------------
|
|
39
|
+
|
|
40
|
+
The recommended installation is the standalone Linux x86_64 executable. It
|
|
41
|
+
includes its own Python runtime, so the host Python is not used. Ubuntu is
|
|
42
|
+
the officially supported distribution, but other Linux distributions are
|
|
43
|
+
expected to work as well.
|
|
44
|
+
|
|
45
|
+
On Ubuntu:
|
|
46
|
+
|
|
47
|
+
.. code-block:: bash
|
|
48
|
+
|
|
49
|
+
curl -fL https://aotu.ai/releases/brainframe-cli/brainframe -o brainframe
|
|
50
|
+
chmod +x brainframe
|
|
51
|
+
sudo install -m 755 brainframe /usr/local/bin/brainframe
|
|
52
|
+
brainframe --version
|
|
53
|
+
|
|
54
|
+
Alternative: install with pip
|
|
55
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
56
|
+
|
|
57
|
+
Pip remains available for environments that prefer Python package management:
|
|
58
|
+
|
|
59
|
+
.. code-block:: bash
|
|
60
|
+
|
|
61
|
+
sudo -H pip3 install brainframe-cli
|
|
62
|
+
|
|
63
|
+
On systems where pip refuses system-wide installs, use a virtual environment
|
|
64
|
+
instead:
|
|
65
|
+
|
|
66
|
+
.. code-block:: bash
|
|
67
|
+
|
|
68
|
+
python3 -m venv my_venv
|
|
69
|
+
source my_venv/bin/activate
|
|
70
|
+
pip3 install brainframe-cli
|
|
71
|
+
|
|
72
|
+
Upgrading
|
|
73
|
+
---------
|
|
74
|
+
|
|
75
|
+
The standalone CLI can update itself after a new release is published:
|
|
76
|
+
|
|
77
|
+
.. code-block:: bash
|
|
78
|
+
|
|
79
|
+
sudo brainframe self-update
|
|
80
|
+
|
|
81
|
+
For a pip installation, upgrade with ``pip3 install --upgrade brainframe-cli``
|
|
82
|
+
instead.
|
|
83
|
+
|
|
84
|
+
``brainframe shell`` runs developer tools in a separate Docker image. Set
|
|
85
|
+
``BRAINFRAME_SHELL_IMAGE`` to select a newer published image when available.
|
|
86
|
+
|
|
87
|
+
Usage
|
|
88
|
+
-----
|
|
89
|
+
|
|
90
|
+
To install BrainFrame, simply run the ``install`` command as root:
|
|
91
|
+
|
|
92
|
+
.. code-block::
|
|
93
|
+
|
|
94
|
+
sudo brainframe install
|
|
95
|
+
|
|
96
|
+
``brainframe uninstall --noninteractive`` skips confirmation and deletes the
|
|
97
|
+
server install directory. Add ``--delete-data`` to delete the data directory.
|
|
98
|
+
|
|
99
|
+
BrainFrame can then be controlled like a normal Docker Compose application
|
|
100
|
+
using the ``compose`` command, which can be run from any directory.
|
|
101
|
+
|
|
102
|
+
.. code-block::
|
|
103
|
+
|
|
104
|
+
brainframe compose up -d
|
|
105
|
+
|
|
106
|
+
The following will show logs,
|
|
107
|
+
|
|
108
|
+
.. code-block::
|
|
109
|
+
|
|
110
|
+
brainframe compose logs -f core journal
|
|
111
|
+
|
|
112
|
+
How to integrate the following to cleanup logs,
|
|
113
|
+
|
|
114
|
+
.. code-block::
|
|
115
|
+
|
|
116
|
+
sudo truncate -s 0 $(docker inspect --format='{{.LogPath}}' brainframe-core-1 brainframe-journal-1)
|
|
117
|
+
|
|
118
|
+
For more information, take a look at the `Getting Started guide`_.
|
|
119
|
+
|
|
120
|
+
.. _`Getting Started guide`: https://aotu.ai/docs/getting_started/
|
|
121
|
+
|
|
122
|
+
Contributing
|
|
123
|
+
------------
|
|
124
|
+
|
|
125
|
+
We happily take community contributions! If there's something you'd like to
|
|
126
|
+
work on, but you're not sure how to start, feel free to create an issue on
|
|
127
|
+
Github and we'll try to point you in the right direction.
|
|
128
|
+
|
|
129
|
+
We use a couple formatting tools to keep our code style consistent. If you get
|
|
130
|
+
any CI failures, you can run the following commands to automatically format
|
|
131
|
+
your code to fit our guidelines:
|
|
132
|
+
|
|
133
|
+
.. code-block:: bash
|
|
134
|
+
|
|
135
|
+
pip install poetry==1.8.3
|
|
136
|
+
poetry install
|
|
137
|
+
poetry run isort .
|
|
138
|
+
poetry run black .
|
|
139
|
+
|
|
140
|
+
Build one PyPI wheel for Python 3.6–3.12. The wheel records different
|
|
141
|
+
dependencies for older and newer Python versions:
|
|
142
|
+
|
|
143
|
+
.. code-block:: bash
|
|
144
|
+
|
|
145
|
+
deployment/ide_cli build wheel-env
|
|
146
|
+
deployment/ide_cli build wheel
|
|
147
|
+
|
|
148
|
+
To validate the wheel and intended destination without uploading, run
|
|
149
|
+
``deployment/ide_cli push wheel --dry-run``. After configuring a TestPyPI token
|
|
150
|
+
with ``TWINE_USERNAME`` and ``TWINE_PASSWORD`` or ``~/.pypirc``, run
|
|
151
|
+
``deployment/ide_cli push wheel``. Add ``--pypi`` to publish to production PyPI.
|
|
152
|
+
|
|
153
|
+
Build the PyInstaller standalone Linux executable separately:
|
|
154
|
+
|
|
155
|
+
.. code-block:: bash
|
|
156
|
+
|
|
157
|
+
deployment/ide_cli build pyinstaller-binary-env
|
|
158
|
+
deployment/ide_cli build pyinstaller-binary
|
|
159
|
+
|
|
160
|
+
This creates ``dist/brainframe``. To publish it to the dev releases bucket,
|
|
161
|
+
run ``deployment/ide_cli push pyinstaller-to-aws`` with an AWS profile and
|
|
162
|
+
region (pass ``--profile`` and, if needed, ``--region``). ``--profile`` selects
|
|
163
|
+
credentials; add ``--prod`` to select the production releases bucket. Run
|
|
164
|
+
``deployment/ide_cli push pyinstaller-to-aws --help`` for setup details.
|
|
165
|
+
|
|
166
|
+
Debian packages use ``build deb-env`` and ``build deb``. That build path is
|
|
167
|
+
currently not release-ready.
|
|
168
|
+
|
|
169
|
+
To remove generated wheels, the standalone executable, Debian packages, and
|
|
170
|
+
Debian staging files before a fresh build:
|
|
171
|
+
|
|
172
|
+
.. code-block:: bash
|
|
173
|
+
|
|
174
|
+
deployment/ide_cli clean
|
|
175
|
+
|
|
176
|
+
``clean`` restores ``brainframe/cli/defaults.yaml`` if it still matches the
|
|
177
|
+
system-package copy left by a Debian build. It stops if that file has other
|
|
178
|
+
edits. Docker images remain cached; pass ``--no-cache`` to a ``*-env`` build when
|
|
179
|
+
testing the image build from scratch.
|
|
180
|
+
|
|
181
|
+
The wheel build uses one Python 3.12 Docker image and writes one wheel to
|
|
182
|
+
``dist/``. Install it for local testing with:
|
|
183
|
+
|
|
184
|
+
.. code-block:: bash
|
|
185
|
+
|
|
186
|
+
pip install dist/brainframe_cli-0.3.4-py3-none-any.whl
|
|
187
|
+
|
|
188
|
+
Once the Docker environments exist, rerun ``build wheel`` or
|
|
189
|
+
``build pyinstaller-binary`` without rebuilding them.
|
|
190
|
+
|
|
191
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
brainframe/cli/__init__.py,sha256=oYLGMpySamd16KLiaBTfRyrAS7_oyp-TOEHmzmeumwg,22
|
|
2
|
+
brainframe/cli/brainframe_compose.py,sha256=OuU9uCE9yuLY_6jovo-ClAW6_uzr97ceODoyfxsAYDs,7506
|
|
3
|
+
brainframe/cli/brainframe_shell.py,sha256=aUXmZ8YV5CQro8PgtyYt5ID5S9k7jyflBLH5adn0I9k,991
|
|
4
|
+
brainframe/cli/commands/__init__.py,sha256=eQA24GuE8YSm6RJL86Kv1vVMtjfG565xVqhfheGtRAM,257
|
|
5
|
+
brainframe/cli/commands/backup.py,sha256=HFAs42dO4kjxQey09AOOGEEcPiVinTv9NArkP057zKY,2699
|
|
6
|
+
brainframe/cli/commands/compose.py,sha256=Io73Ao-sddbbUhf89JZoxMptjH2Dcmx6FJVsBgxqEfI,311
|
|
7
|
+
brainframe/cli/commands/info.py,sha256=WXMfLoeyYCosl9__T1Tpsh5EN3CadxQpTCYAXYCMdUE,1230
|
|
8
|
+
brainframe/cli/commands/install.py,sha256=f7k-or-QkQYCvmzsquw4fGOPnVWONBjkwh6Fu2xqaf8,5725
|
|
9
|
+
brainframe/cli/commands/self_update.py,sha256=rJxjJKpd0dJBIKX2np-GHzPSQ6xesAiMJRlwiMxAZsU,6037
|
|
10
|
+
brainframe/cli/commands/shell.py,sha256=cWIx8qcwHrjKMU-vSOrLuY5YNyJVedv6V-fF9cb5Y04,422
|
|
11
|
+
brainframe/cli/commands/uninstall.py,sha256=fQ7CX9NF_dycja0rerQqwxf4KD27bXP6c5yTrU2vZUo,2205
|
|
12
|
+
brainframe/cli/commands/update.py,sha256=uIyaq2HWtHkf4DhDYIkNgLBFjNvNiepAWe06jw3HZdM,3257
|
|
13
|
+
brainframe/cli/commands/utils.py,sha256=LLPYUpWQ_F6BBeQZJaBN_dAOTE07pZrew8BGA-ScVaA,1468
|
|
14
|
+
brainframe/cli/config.py,sha256=Ezd_8HyCqDAr7QgA7CPic2OszUI-KKjuQzLVy6RhjY4,2882
|
|
15
|
+
brainframe/cli/defaults.yaml,sha256=mcg0pt52Xy7UWc-etFsbVqYn6sZ2EtJbwS4W-m2cYPA,142
|
|
16
|
+
brainframe/cli/dependencies.py,sha256=pjfT4uVNusnNBtBGxwwyWyRda7f9Qm_6v8o5nsMGuJ4,2660
|
|
17
|
+
brainframe/cli/frozen_utils.py,sha256=rPW37TdO7n4aitHtD0w2aq3IbyntJVcnT9096NgvIXc,1377
|
|
18
|
+
brainframe/cli/main.py,sha256=oUlGsrgW-cl2M1hzmoZDR7wsZHfVZX1a8J8YQkej-Ds,1945
|
|
19
|
+
brainframe/cli/network.py,sha256=izPCTqXNwe4LXcB3WqJC1QJFagx065fM-0wqCoSMZqA,84
|
|
20
|
+
brainframe/cli/os_utils.py,sha256=J_LxMrM95zTvknUPkb_uF2VIYwQ2xKy8Y3G__NkKd8s,5419
|
|
21
|
+
brainframe/cli/print_utils.py,sha256=liIvGsyWRFbPkLUeAjcbUhWB4vRkDn9TyxKUnmzAmf0,3472
|
|
22
|
+
brainframe/cli/translations/backup.en.yml,sha256=91dOE4JH_TPdKp8vRAJ3grnBVB5_jHjZsm8nF_bdOAI,1163
|
|
23
|
+
brainframe/cli/translations/general.en.yml,sha256=5tQb35wPIHVuTHULrs-ScBv8gpXdxjdmypoFK9bxqsE,2263
|
|
24
|
+
brainframe/cli/translations/info.en.yml,sha256=6dj1hstvTQ5F9UYjcK8PQaCz2zuFdtgGkAd4OAoS-BU,262
|
|
25
|
+
brainframe/cli/translations/install.en.yml,sha256=V6O34nw8V9UT6sYfP93pU7dTvZR4pD6CgiOFAUZAsnI,4097
|
|
26
|
+
brainframe/cli/translations/portal.en.yml,sha256=TAPrYBb3vF6BSwKclMtRjSs3zTJt9lNAJ5k5gVpUw_U,1406
|
|
27
|
+
brainframe/cli/translations/self-update.en.yml,sha256=GRsiPRC2NKM4UyWVcqp2WeJSvTV3TW63vk3LM4Fajmk,951
|
|
28
|
+
brainframe/cli/translations/shell.en.yml,sha256=V56EUT7xuEMQpjiiHYVXSt97aB386HTR2OJLaZIqQ5E,468
|
|
29
|
+
brainframe/cli/translations/uninstall.en.yml,sha256=06PVZ0Et12xgoMo7RX5Z8ldG2suYUZcCQ9GgZAqd7kU,1322
|
|
30
|
+
brainframe/cli/translations/update.en.yml,sha256=qWQxXjGXcLxAsZMrPHkkDQzYvluleMsR5oVq-3RShyY,1596
|
|
31
|
+
brainframe_cli-0.3.4.dist-info/METADATA,sha256=mCtmis71Qyq9Gos723axpJ9izEEG5Vjxk7bKgxAcUBM,6052
|
|
32
|
+
brainframe_cli-0.3.4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
33
|
+
brainframe_cli-0.3.4.dist-info/entry_points.txt,sha256=Tah5GI0gjeVzUGLJSPd5eIYQHb80Z2f7qEPtDQa1FPE,55
|
|
34
|
+
brainframe_cli-0.3.4.dist-info/RECORD,,
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
Copyright (C) 2020, Dilili Labs INC, all rights reserved.
|
|
2
|
-
|
|
3
|
-
Redistribution and use in source and binary forms, with or without
|
|
4
|
-
modification, are permitted provided that the following conditions are met:
|
|
5
|
-
|
|
6
|
-
1. Redistributions of source code must retain the above copyright notice, this
|
|
7
|
-
list of conditions and the following disclaimer.
|
|
8
|
-
|
|
9
|
-
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
10
|
-
this list of conditions and the following disclaimer in the documentation
|
|
11
|
-
and/or other materials provided with the distribution.
|
|
12
|
-
|
|
13
|
-
3. Neither the name of the copyright holder nor the names of its contributors
|
|
14
|
-
may be used to endorse or promote products derived from this software without
|
|
15
|
-
specific prior written permission.
|
|
16
|
-
|
|
17
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
18
|
-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
19
|
-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
20
|
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
21
|
-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
22
|
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
23
|
-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
24
|
-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
25
|
-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
26
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: brainframe-cli
|
|
3
|
-
Version: 0.3.2
|
|
4
|
-
Summary: Makes installing and managing a BrainFrame server easy
|
|
5
|
-
Home-page: https://github.com/aotuai/brainframe_cli
|
|
6
|
-
License: BSD-3-Clause
|
|
7
|
-
Author: Aotu.ai
|
|
8
|
-
Author-email: info@aotu.ai
|
|
9
|
-
Requires-Python: >=3.10,<4.0
|
|
10
|
-
Classifier: License :: OSI Approved :: BSD License
|
|
11
|
-
Classifier: Programming Language :: Python :: 3
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
-
Requires-Dist: distro (>=1.5,<2.0)
|
|
16
|
-
Requires-Dist: docker (>4.3.1,<7.0.0)
|
|
17
|
-
Requires-Dist: packaging (>=20.4,<21.0)
|
|
18
|
-
Requires-Dist: python-i18n (>=0.3,<0.4)
|
|
19
|
-
Requires-Dist: pyyaml (>=6.0)
|
|
20
|
-
Requires-Dist: requests (>=2.24.0,<3.0.0)
|
|
21
|
-
Requires-Dist: websocket-client (>=0.32.0,<1.0)
|
|
22
|
-
Project-URL: Repository, https://github.com/aotuai/brainframe_cli
|
|
23
|
-
Description-Content-Type: text/x-rst
|
|
24
|
-
|
|
25
|
-
==============
|
|
26
|
-
BrainFrame CLI
|
|
27
|
-
==============
|
|
28
|
-
|
|
29
|
-
The BrainFrame CLI is a tool for installing and managing a BrainFrame server.
|
|
30
|
-
|
|
31
|
-
Installation
|
|
32
|
-
------------
|
|
33
|
-
|
|
34
|
-
The CLI is installable with Pip. Ubuntu 18.04 and 20.04 are officially
|
|
35
|
-
supported, but other versions of Linux are expected to work as well.
|
|
36
|
-
|
|
37
|
-
On Ubuntu:
|
|
38
|
-
|
|
39
|
-
.. code-block::
|
|
40
|
-
|
|
41
|
-
sudo -H pip3 install brainframe-cli
|
|
42
|
-
|
|
43
|
-
Upgrading
|
|
44
|
-
---------
|
|
45
|
-
|
|
46
|
-
Pip can be used to upgrade to a new version.
|
|
47
|
-
|
|
48
|
-
.. code-block::
|
|
49
|
-
|
|
50
|
-
sudo -H pip3 install --upgrade brainframe-cli
|
|
51
|
-
|
|
52
|
-
Usage
|
|
53
|
-
-----
|
|
54
|
-
|
|
55
|
-
To install BrainFrame, simply run the ``install`` command as root:
|
|
56
|
-
|
|
57
|
-
.. code-block::
|
|
58
|
-
|
|
59
|
-
sudo brainframe install
|
|
60
|
-
|
|
61
|
-
BrainFrame can then be controlled like a normal Docker Compose application
|
|
62
|
-
using the ``compose`` command, which can be run from any directory.
|
|
63
|
-
|
|
64
|
-
.. code-block::
|
|
65
|
-
|
|
66
|
-
brainframe compose up -d
|
|
67
|
-
|
|
68
|
-
For more information, take a look at the `Getting Started guide`_.
|
|
69
|
-
|
|
70
|
-
.. _`Getting Started guide`: https://aotu.ai/docs/getting_started/
|
|
71
|
-
|
|
72
|
-
Contributing
|
|
73
|
-
------------
|
|
74
|
-
|
|
75
|
-
We happily take community contributions! If there's something you'd like to
|
|
76
|
-
work on, but you're not sure how to start, feel free to create an issue on
|
|
77
|
-
Github and we'll try to point you in the right direction.
|
|
78
|
-
|
|
79
|
-
We use a couple formatting tools to keep our code style consistent. If you get
|
|
80
|
-
any CI failures, you can run the following commands to automatically format
|
|
81
|
-
your code to fit our guidelines:
|
|
82
|
-
|
|
83
|
-
.. code-block:: bash
|
|
84
|
-
|
|
85
|
-
pip install poetry==1.8.3
|
|
86
|
-
poetry install
|
|
87
|
-
poetry run isort .
|
|
88
|
-
poetry run black .
|
|
89
|
-
|
|
90
|
-
Build & install local build for test:
|
|
91
|
-
|
|
92
|
-
.. code-block:: bash
|
|
93
|
-
|
|
94
|
-
python3 deployment/build.py --version 3.8
|
|
95
|
-
python3 deployment/build.py --version 3.10 3.12
|
|
96
|
-
pip install dist/brainframe_cli-0.3.0-py3-none-any.whl
|
|
97
|
-
|
|
98
|
-
The above build.py will copy pyproject.toml & poetry.lock in deployment folder
|
|
99
|
-
to the project root, and automatically run poetry build. Similar to below,
|
|
100
|
-
|
|
101
|
-
.. code-block:: bash
|
|
102
|
-
|
|
103
|
-
poetry build
|
|
104
|
-
pip install dist/brainframe_cli-0.3.0-py3-none-any.whl
|
|
105
|
-
|
|
106
|
-
The wheel build & test commands have been integrated in deployment/do script,
|
|
107
|
-
which support build & test on Ubuntu 18.04/20.04/22.04/24.04
|
|
108
|
-
|
|
109
|
-
.. code-block:: bash
|
|
110
|
-
|
|
111
|
-
deployment/do
|
|
112
|
-
|
|
113
|
-
Pyinstaller build:
|
|
114
|
-
|
|
115
|
-
The result will be in the dist/ directory
|
|
116
|
-
|
|
117
|
-
.. code-block:: bash
|
|
118
|
-
|
|
119
|
-
pyinstaller package/main.spec
|
|
120
|
-
|
|
121
|
-
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
brainframe/cli/__init__.py,sha256=VrXpHDu3erkzwl_WXrqINBm9xWkcyUy53IQOj042dOs,22
|
|
2
|
-
brainframe/cli/brainframe_compose.py,sha256=VUFkd9dSD5HiwVej4p-wFvdyKfaPklCcWEAKz7JKWw4,5998
|
|
3
|
-
brainframe/cli/brainframe_shell.py,sha256=6-R3TtIGJGyZipdxV414f3_BKKXrQiTfY6dabncDtoc,788
|
|
4
|
-
brainframe/cli/commands/__init__.py,sha256=eQA24GuE8YSm6RJL86Kv1vVMtjfG565xVqhfheGtRAM,257
|
|
5
|
-
brainframe/cli/commands/backup.py,sha256=HFAs42dO4kjxQey09AOOGEEcPiVinTv9NArkP057zKY,2699
|
|
6
|
-
brainframe/cli/commands/compose.py,sha256=Io73Ao-sddbbUhf89JZoxMptjH2Dcmx6FJVsBgxqEfI,311
|
|
7
|
-
brainframe/cli/commands/info.py,sha256=WXMfLoeyYCosl9__T1Tpsh5EN3CadxQpTCYAXYCMdUE,1230
|
|
8
|
-
brainframe/cli/commands/install.py,sha256=93mQ7_3ufvC_9bpJaaJ9Onm-4wY6OvkoKtHHr84AWiE,5785
|
|
9
|
-
brainframe/cli/commands/self_update.py,sha256=tPV5hNDkUDF83KGjD85WCtb_pzA4526mAQvhCMBwYQs,3648
|
|
10
|
-
brainframe/cli/commands/shell.py,sha256=cWIx8qcwHrjKMU-vSOrLuY5YNyJVedv6V-fF9cb5Y04,422
|
|
11
|
-
brainframe/cli/commands/uninstall.py,sha256=yS6THcnALobh8pDmB4E8vlZIrnLNL5Ee0tORUi9p4qo,2203
|
|
12
|
-
brainframe/cli/commands/update.py,sha256=Sxpq8a_1EF8WGqLpLbt9XBuNuvHc-uRnZSrubSec4Rw,3300
|
|
13
|
-
brainframe/cli/commands/utils.py,sha256=DmplbA6tXwdYQ6kAEvPgvuhPlQ3ycscYJNIFYaDPH9o,1082
|
|
14
|
-
brainframe/cli/config.py,sha256=aS8kV-RtYTUSiHRjzZYqJ0Jk46cj__1ETLOj_AjRSk0,2699
|
|
15
|
-
brainframe/cli/defaults.yaml,sha256=mcg0pt52Xy7UWc-etFsbVqYn6sZ2EtJbwS4W-m2cYPA,142
|
|
16
|
-
brainframe/cli/dependencies.py,sha256=UyrOxkOvka7qy5xjPHIuYmNqTjrJDVNmnuUow_6IVA4,2435
|
|
17
|
-
brainframe/cli/frozen_utils.py,sha256=rPW37TdO7n4aitHtD0w2aq3IbyntJVcnT9096NgvIXc,1377
|
|
18
|
-
brainframe/cli/main.py,sha256=NhYU3Gwvr-a7lCr__wA0LBGT0RSUKdmFm2ASZbjEVUA,1862
|
|
19
|
-
brainframe/cli/os_utils.py,sha256=wxLk27Uj-FJkBzcJT4T6boEFDW8QBlRGU1Nt5ZGaEWA,5569
|
|
20
|
-
brainframe/cli/print_utils.py,sha256=liIvGsyWRFbPkLUeAjcbUhWB4vRkDn9TyxKUnmzAmf0,3472
|
|
21
|
-
brainframe/cli/translations/backup.en.yml,sha256=91dOE4JH_TPdKp8vRAJ3grnBVB5_jHjZsm8nF_bdOAI,1163
|
|
22
|
-
brainframe/cli/translations/general.en.yml,sha256=Da321e7E0t0BcCieM8iExffBV1EeUgVgPTZeisUIUTc,2015
|
|
23
|
-
brainframe/cli/translations/info.en.yml,sha256=6dj1hstvTQ5F9UYjcK8PQaCz2zuFdtgGkAd4OAoS-BU,262
|
|
24
|
-
brainframe/cli/translations/install.en.yml,sha256=qmeVCTm-iR3bf4HNql3ieUT6TFxXTgHMHEyK2c6cwHE,3909
|
|
25
|
-
brainframe/cli/translations/portal.en.yml,sha256=TAPrYBb3vF6BSwKclMtRjSs3zTJt9lNAJ5k5gVpUw_U,1406
|
|
26
|
-
brainframe/cli/translations/self-update.en.yml,sha256=5_p5uEuTpSMi6FJBTTxrKhn9E38PLqWrW0nk4nNAyfE,732
|
|
27
|
-
brainframe/cli/translations/shell.en.yml,sha256=93gpkVProI4zyfXgf5HI5DctyOM58T3wQXBwLKJVpsU,396
|
|
28
|
-
brainframe/cli/translations/uninstall.en.yml,sha256=z6ZSQljS2P9AEPnfk9vbs6uLBoVQJXHLH_-z4P3-seU,1149
|
|
29
|
-
brainframe/cli/translations/update.en.yml,sha256=o9mjpipmKYcUzrP_36PBmrOI-sgA55t31gCV-neYdwI,1913
|
|
30
|
-
brainframe_cli-0.3.2.dist-info/COPYING,sha256=gUdx8BDkY31TjlE3BXyajv8oSs-1hxBD4NUn-hUZi6w,1502
|
|
31
|
-
brainframe_cli-0.3.2.dist-info/METADATA,sha256=9WC8FqUCjCFulvTnZCC_BmYt8WQzp-gx7CNMLGv2AVs,3168
|
|
32
|
-
brainframe_cli-0.3.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
33
|
-
brainframe_cli-0.3.2.dist-info/entry_points.txt,sha256=Tah5GI0gjeVzUGLJSPd5eIYQHb80Z2f7qEPtDQa1FPE,55
|
|
34
|
-
brainframe_cli-0.3.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|