plash-cli 0.3.4__tar.gz → 0.3.6__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.
- {plash_cli-0.3.4/plash_cli.egg-info → plash_cli-0.3.6}/PKG-INFO +1 -1
- plash_cli-0.3.6/plash_cli/__init__.py +2 -0
- {plash_cli-0.3.4 → plash_cli-0.3.6}/plash_cli/cli.py +15 -15
- {plash_cli-0.3.4 → plash_cli-0.3.6/plash_cli.egg-info}/PKG-INFO +1 -1
- {plash_cli-0.3.4 → plash_cli-0.3.6}/settings.ini +1 -1
- plash_cli-0.3.4/plash_cli/__init__.py +0 -1
- {plash_cli-0.3.4 → plash_cli-0.3.6}/LICENSE +0 -0
- {plash_cli-0.3.4 → plash_cli-0.3.6}/MANIFEST.in +0 -0
- {plash_cli-0.3.4 → plash_cli-0.3.6}/README.md +0 -0
- {plash_cli-0.3.4 → plash_cli-0.3.6}/plash_cli/_bash_magic.py +0 -0
- {plash_cli-0.3.4 → plash_cli-0.3.6}/plash_cli/_modidx.py +0 -0
- {plash_cli-0.3.4 → plash_cli-0.3.6}/plash_cli/assets/es256_public_key.pem +0 -0
- {plash_cli-0.3.4 → plash_cli-0.3.6}/plash_cli/auth.py +0 -0
- {plash_cli-0.3.4 → plash_cli-0.3.6}/plash_cli.egg-info/SOURCES.txt +0 -0
- {plash_cli-0.3.4 → plash_cli-0.3.6}/plash_cli.egg-info/dependency_links.txt +0 -0
- {plash_cli-0.3.4 → plash_cli-0.3.6}/plash_cli.egg-info/entry_points.txt +0 -0
- {plash_cli-0.3.4 → plash_cli-0.3.6}/plash_cli.egg-info/not-zip-safe +0 -0
- {plash_cli-0.3.4 → plash_cli-0.3.6}/plash_cli.egg-info/requires.txt +0 -0
- {plash_cli-0.3.4 → plash_cli-0.3.6}/plash_cli.egg-info/top_level.txt +0 -0
- {plash_cli-0.3.4 → plash_cli-0.3.6}/pyproject.toml +0 -0
- {plash_cli-0.3.4 → plash_cli-0.3.6}/setup.cfg +0 -0
- {plash_cli-0.3.4 → plash_cli-0.3.6}/setup.py +0 -0
|
@@ -77,7 +77,6 @@ def _poll_cookies(paircode, interval=1, timeout=180):
|
|
|
77
77
|
resp = client.get(url).raise_for_status()
|
|
78
78
|
if resp.text.strip(): return dict(client.cookies)
|
|
79
79
|
sleep(interval)
|
|
80
|
-
|
|
81
80
|
|
|
82
81
|
# %% ../nbs/00_cli.ipynb 14
|
|
83
82
|
@call_parse
|
|
@@ -91,7 +90,7 @@ def login(
|
|
|
91
90
|
return print(PLASH_CONFIG_HOME.read_json().get("session_", ""), end='')
|
|
92
91
|
if token:
|
|
93
92
|
PLASH_CONFIG_HOME.write_text(json.dumps({"session_": token.strip()}))
|
|
94
|
-
return
|
|
93
|
+
return f"Token saved to {PLASH_CONFIG_HOME}"
|
|
95
94
|
paircode = secrets.token_urlsafe(16)
|
|
96
95
|
login_url = httpx.get(_endpoint(rt=f"/cli_login?paircode={paircode}")).text
|
|
97
96
|
print(f"Opening browser for authentication:\n{login_url}\n")
|
|
@@ -100,13 +99,13 @@ def login(
|
|
|
100
99
|
cookies = _poll_cookies(paircode)
|
|
101
100
|
if cookies:
|
|
102
101
|
PLASH_CONFIG_HOME.write_text(json.dumps(cookies))
|
|
103
|
-
|
|
104
|
-
else:
|
|
102
|
+
return f"Authentication successful! Config saved to {PLASH_CONFIG_HOME}"
|
|
103
|
+
else: return "Authentication timed out."
|
|
105
104
|
|
|
106
105
|
# %% ../nbs/00_cli.ipynb 17
|
|
107
106
|
pat = r'(?m)^# /// (?P<type>[a-zA-Z0-9-]+)$\s(?P<content>(^#(| .*)$\s)+)^# ///$'
|
|
108
107
|
|
|
109
|
-
def _deps(script: bytes | str)
|
|
108
|
+
def _deps(script: bytes | str):
|
|
110
109
|
'Get the dependencies from the script. From: https://peps.python.org/pep-0723/'
|
|
111
110
|
name = 'script'
|
|
112
111
|
if isinstance(script, bytes): script = script.decode('utf-8')
|
|
@@ -171,8 +170,9 @@ def deploy(
|
|
|
171
170
|
r = _mk_auth_req(_endpoint(rt="/upload"), "post", files={'file': tarz},
|
|
172
171
|
data={'name': name, 'force_data': force_data})
|
|
173
172
|
if r:
|
|
174
|
-
|
|
175
|
-
|
|
173
|
+
return ('✅ Upload complete! Your app is currently being built.\n' +
|
|
174
|
+
f'It will be live at {name if "." in name else _endpoint(sub=name)}')
|
|
175
|
+
else: return 'Unknown failure'
|
|
176
176
|
|
|
177
177
|
# %% ../nbs/00_cli.ipynb 26
|
|
178
178
|
@call_parse
|
|
@@ -233,11 +233,11 @@ def logs(
|
|
|
233
233
|
text = ''
|
|
234
234
|
while True:
|
|
235
235
|
try:
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
236
|
+
r = _mk_auth_req(_endpoint(rt=f"/logs?name={name}&mode={mode}"))
|
|
237
|
+
print(r.text[len(text):], end='') # Only print updates
|
|
238
|
+
text = r.text
|
|
239
|
+
if mode == 'build' and 'Build End Time:' in r.text: return
|
|
240
|
+
sleep(1)
|
|
241
241
|
except KeyboardInterrupt: return "\nExiting"
|
|
242
242
|
if r := _mk_auth_req(_endpoint(rt=f"/logs?name={name}&mode={mode}")): return r.text
|
|
243
243
|
|
|
@@ -256,7 +256,7 @@ def download(
|
|
|
256
256
|
save_path.mkdir(exist_ok=True)
|
|
257
257
|
if not save_path._is_dir_empty(): return print(f'ERROR: Save path ({save_path}) is not empty.')
|
|
258
258
|
if r := _mk_auth_req(_endpoint(rt=f'/download?name={name}')):
|
|
259
|
-
with tarfile.open(fileobj=io.BytesIO(r.content), mode="r:gz") as tar: tar.extractall(path=save_path)
|
|
259
|
+
with tarfile.open(fileobj=io.BytesIO(r.content), mode="r:gz") as tar: tar.extractall(path=save_path, filter='data')
|
|
260
260
|
print(f"Downloaded your app to: {save_path}")
|
|
261
261
|
|
|
262
262
|
# %% ../nbs/00_cli.ipynb 48
|
|
@@ -267,5 +267,5 @@ def apps(verbose:bool=False):
|
|
|
267
267
|
if r:
|
|
268
268
|
apps = r.json()
|
|
269
269
|
if not apps: return "You don't have any deployed Plash apps."
|
|
270
|
-
if verbose: [
|
|
271
|
-
else: [
|
|
270
|
+
if verbose: return [(f"{a['running']} {a['name']}") for a in apps]
|
|
271
|
+
else: return [(a['name']) for a in apps]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.3.4"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|