plash-cli 0.3.14__tar.gz → 0.3.15__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.
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plash_cli
3
- Version: 0.3.14
3
+ Version: 0.3.15
4
4
  Summary: CLI for the Plash hosting service
5
5
  Author-email: Jeremy Howard <info@fast.ai>
6
- License: Apache-2.0
6
+ License-Expression: Apache-2.0
7
7
  Project-URL: Repository, https://github.com/AnswerDotAI/plash_cli
8
8
  Project-URL: Documentation, https://AnswerDotAI.github.io/plash_cli
9
9
  Keywords: nbdev,jupyter,notebook,python
@@ -15,8 +15,8 @@ Classifier: Programming Language :: Python :: 3 :: Only
15
15
  Requires-Python: >=3.10
16
16
  Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
- Requires-Dist: fastcore>=1.12.27
19
- Requires-Dist: httpx>=0.28.1
18
+ Requires-Dist: fastcore>=2.2.20
19
+ Requires-Dist: httpx2
20
20
  Requires-Dist: python-dotenv
21
21
  Requires-Dist: pyjwt
22
22
  Requires-Dist: cryptography
@@ -32,34 +32,24 @@ Dynamic: license-file
32
32
 
33
33
  > [!WARNING]
34
34
  >
35
- > Plash is in Beta and we have released it in its semi-stable state to
36
- > gather early feedback to improve. We do not recommend hosting critical
37
- > applications yet.
35
+ > Plash is in Beta and we have released it in its semi-stable state to gather early feedback to improve. We do not recommend hosting critical applications yet.
38
36
 
39
37
  ## What is Plash
40
38
 
41
- Plash is a next-generation deployment platform for fast, hassle-free
42
- Python application hosting. It’s designed to be:
39
+ Plash is a next-generation deployment platform for fast, hassle-free Python application hosting. It’s designed to be:
43
40
 
44
- - **Simple and streamlined** - deploy your applications with minimal
45
- configuration
41
+ - **Simple and streamlined** - deploy your applications with minimal configuration
46
42
  - **Developer-focused** - built for coders, not cloud engineers
47
43
  - **Fast and efficient** - get your app online in seconds, not days
48
44
 
49
- Plash handles all the deployment complexities so you can focus on what
50
- matters: building great applications. With Plash, you can deploy any
51
- Python app using straightforward commands and configurations, letting
52
- you ship your work quickly and reliably.
45
+ Plash handles all the deployment complexities so you can focus on what matters: building great applications. With Plash, you can deploy any Python app using straightforward commands and configurations, letting you ship your work quickly and reliably.
53
46
 
54
- Whether you’re building web services, APIs, data applications, or tools,
55
- Plash provides the infrastructure backbone so you can concentrate on
56
- creating a splash with your code.
47
+ Whether you’re building web services, APIs, data applications, or tools, Plash provides the infrastructure backbone so you can concentrate on creating a splash with your code.
57
48
 
58
49
  ## Tutorial: deploy your first app
59
50
 
60
- In this tutorial you will learn how to deploy your first app. This
61
- tutorial will explore the basics of using Plash and help you get
62
- familiar with it at a high level.
51
+ In this tutorial you will learn how to deploy your first app.
52
+ This tutorial will explore the basics of using Plash and help you get familiar with it at a high level.
63
53
 
64
54
  **Prerequisites:**
65
55
 
@@ -81,23 +71,29 @@ The CLI lets you manage your whole app’s lifecycle
81
71
  Authenticate with your Plash account:
82
72
 
83
73
  ``` sh
84
- plash_login
74
+ plash-login
85
75
  ```
86
76
 
87
- This command opens your browser to authenticate with your Plash account.
88
- After completing the login process, you’ll see a “complete” confirmation
89
- page in your browser.
77
+ This command opens your browser to authenticate with your Plash account. After completing the login process, you’ll see a “complete” confirmation page in your browser.
90
78
 
91
79
  Return to your terminal where you’ll find the confirmation message:
92
80
 
93
- > Authentication successful! Config saved to
94
- > <your-global-config-path>/plash_config.json
81
+ > Authentication successful! Config saved to <your-global-config-path>/plash_config.json
82
+
83
+ #### Alternative Authentication Methods
84
+
85
+ If you’ve already logged in on one machine and want to authenticate on another without opening a browser, you can transfer your authentication token directly. Run `plash-login --show` on the machine where you’re already logged in to print your current token. You can then copy this and use `plash-login --token <your-token>` on the new machine to authenticate.
86
+
87
+ For convenience, you can pipe the token directly to your clipboard. On macOS, use `plash-login --show | pbcopy`. On Linux with X11, use `plash-login --show | xclip -selection clipboard` or `plash-login --show | xsel --clipboard`. On Windows PowerShell, use `plash-login --show | Set-Clipboard`.
88
+
89
+ For automated environments like CI/CD pipelines or scripts, you can set the `PLASH_TOKEN` environment variable instead of storing credentials in a config file. When this variable is set, the CLI will use it automatically without requiring `plash-login`. For example: `export PLASH_TOKEN="your-authentication-token"` on Unix-like systems, or `$env:PLASH_TOKEN="your-authentication-token"` in PowerShell.
95
90
 
96
91
  ### 3. Create your first app
97
92
 
98
93
  Create a new directory for your first app:
99
94
 
100
95
  ``` bash
96
+ %%bash
101
97
  mkdir -p plash-tutorial
102
98
  cd plash-tutorial
103
99
  ```
@@ -105,6 +101,7 @@ cd plash-tutorial
105
101
  Next, create the `main.py` file:
106
102
 
107
103
  ``` python
104
+ %%writefile main.py
108
105
  from fasthtml.common import *
109
106
 
110
107
  app, rt = fast_app()
@@ -116,24 +113,22 @@ def index():
116
113
  serve()
117
114
  ```
118
115
 
119
- This is a basic [FastHTML](https://fastht.ml) app. Plash also supports
120
- other popular python frameworks.
116
+ This is a basic [FastHTML](https://fastht.ml) app. Plash also supports other popular python frameworks.
121
117
 
122
118
  > [!WARNING]
123
119
  >
124
- > Your app must use port 5001, as this is the port exposed by Plash’s
125
- > Docker container. It also happens to be the default for FastHTML apps.
120
+ > Your app must use port 5001, as this is the port exposed by Plash’s Docker container. It also happens to be the default for FastHTML apps.
126
121
 
127
122
  And create the `requirements.txt` file:
128
123
 
129
124
  ``` python
125
+ %%writefile requirements.txt
130
126
  python-fasthtml
131
127
  ```
132
128
 
133
129
  ### 4. Deploy your app
134
130
 
135
- Now that you’ve created your app files, you’re ready to deploy! From
136
- your `plash-tutorial` directory, run: `plash_deploy`
131
+ Now that you’ve created your app files, you’re ready to deploy! From your `plash-tutorial` directory, run: `plash-deploy`
137
132
 
138
133
  This command will:
139
134
 
@@ -142,28 +137,27 @@ This command will:
142
137
  3. Build and deploy your application
143
138
 
144
139
  ``` bash
145
- plash_deploy
140
+ %%bash
141
+ plash-deploy
146
142
  ```
147
143
 
148
144
  Initializing deployment...
149
145
  ✅ Upload complete! Your app is currently being built.
150
146
  It will be live at https://example-app.pla.sh
151
147
 
152
- **Note:** You’ll see a different url that has been randomly generated
153
- for your app.
148
+ **Note:** You’ll see a different url that has been randomly generated for your app.
154
149
 
155
150
  ### 5. View your app
156
151
 
157
- Your app should be ready a couple of seconds after running the deploy
158
- command.
152
+ Your app should be ready a couple of seconds after running the deploy command.
159
153
 
160
154
  Once your app is ready, you can:
161
155
 
162
156
  1. Open the provided URL in your browser, or
163
- 2. Use the convenient plash_view command to open it automatically:
157
+ 2. Use the convenient plash-view command to open it automatically:
164
158
 
165
159
  ``` sh
166
- plash_view
160
+ plash-view
167
161
  ```
168
162
 
169
163
  When you visit that page you should see “Hello, World!”
@@ -172,21 +166,11 @@ When you visit that page you should see “Hello, World!”
172
166
 
173
167
  ## Where to go from here
174
168
 
175
- Learn more about what Plash has to offer in the rest of the docs at:
176
- <https://docs.pla.sh>
169
+ Learn more about what Plash has to offer in the rest of the docs at: <https://docs.pla.sh>
177
170
 
178
- To learn more about creating web apps with FastHTML, we recommend
179
- looking at the official docs at: <https://fastht.ml/docs/>. In
180
- particular, we recommend the following:
171
+ To learn more about creating web apps with FastHTML, we recommend looking at the official docs at: <https://fastht.ml/docs/>. In particular, we recommend the following:
181
172
 
182
- 1. [OAuth](https://fastht.ml/docs/explains/oauth.html) - Setup
183
- authentication for your Plash App with Google Sign-In or other OAuth
184
- Providers.
185
- 2. [Stripe](https://fastht.ml/docs/explains/stripe.html) - Accept
186
- payments for your products hosted on Plash with Stripe.
173
+ 1. [OAuth](https://fastht.ml/docs/explains/oauth.html) - Setup authentication for your Plash App with Google Sign-In or other OAuth Providers.
174
+ 2. [Stripe](https://fastht.ml/docs/explains/stripe.html) - Accept payments for your products hosted on Plash with Stripe.
187
175
 
188
- Would you like to use a different python web framework? Then check out
189
- the [examples
190
- section](https://github.com/AnswerDotAI/plash_cli/tree/main/examples) of
191
- the repo, it has examples for many popular python web frameworks like
192
- FastAPI, Gradio, and Streamlit.
176
+ Would you like to use a different python web framework? Then check out the [examples section](https://github.com/AnswerDotAI/plash_cli/tree/main/examples) of the repo, it has examples for many popular python web frameworks like FastAPI, Gradio, and Streamlit.
@@ -0,0 +1,149 @@
1
+ # Plash
2
+
3
+
4
+ <!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
5
+
6
+ > [!WARNING]
7
+ >
8
+ > Plash is in Beta and we have released it in its semi-stable state to gather early feedback to improve. We do not recommend hosting critical applications yet.
9
+
10
+ ## What is Plash
11
+
12
+ Plash is a next-generation deployment platform for fast, hassle-free Python application hosting. It’s designed to be:
13
+
14
+ - **Simple and streamlined** - deploy your applications with minimal configuration
15
+ - **Developer-focused** - built for coders, not cloud engineers
16
+ - **Fast and efficient** - get your app online in seconds, not days
17
+
18
+ Plash handles all the deployment complexities so you can focus on what matters: building great applications. With Plash, you can deploy any Python app using straightforward commands and configurations, letting you ship your work quickly and reliably.
19
+
20
+ Whether you’re building web services, APIs, data applications, or tools, Plash provides the infrastructure backbone so you can concentrate on creating a splash with your code.
21
+
22
+ ## Tutorial: deploy your first app
23
+
24
+ In this tutorial you will learn how to deploy your first app.
25
+ This tutorial will explore the basics of using Plash and help you get familiar with it at a high level.
26
+
27
+ **Prerequisites:**
28
+
29
+ - A registered account at <https://pla.sh>
30
+ - Basic terminal / command line skills
31
+
32
+ ### 1. Installation
33
+
34
+ Install Plash comandline interface (CLI) with pip:
35
+
36
+ ``` sh
37
+ pip install plash-cli
38
+ ```
39
+
40
+ The CLI lets you manage your whole app’s lifecycle
41
+
42
+ ### 2. CLI Login
43
+
44
+ Authenticate with your Plash account:
45
+
46
+ ``` sh
47
+ plash-login
48
+ ```
49
+
50
+ This command opens your browser to authenticate with your Plash account. After completing the login process, you’ll see a “complete” confirmation page in your browser.
51
+
52
+ Return to your terminal where you’ll find the confirmation message:
53
+
54
+ > Authentication successful! Config saved to <your-global-config-path>/plash_config.json
55
+
56
+ #### Alternative Authentication Methods
57
+
58
+ If you’ve already logged in on one machine and want to authenticate on another without opening a browser, you can transfer your authentication token directly. Run `plash-login --show` on the machine where you’re already logged in to print your current token. You can then copy this and use `plash-login --token <your-token>` on the new machine to authenticate.
59
+
60
+ For convenience, you can pipe the token directly to your clipboard. On macOS, use `plash-login --show | pbcopy`. On Linux with X11, use `plash-login --show | xclip -selection clipboard` or `plash-login --show | xsel --clipboard`. On Windows PowerShell, use `plash-login --show | Set-Clipboard`.
61
+
62
+ For automated environments like CI/CD pipelines or scripts, you can set the `PLASH_TOKEN` environment variable instead of storing credentials in a config file. When this variable is set, the CLI will use it automatically without requiring `plash-login`. For example: `export PLASH_TOKEN="your-authentication-token"` on Unix-like systems, or `$env:PLASH_TOKEN="your-authentication-token"` in PowerShell.
63
+
64
+ ### 3. Create your first app
65
+
66
+ Create a new directory for your first app:
67
+
68
+ ``` bash
69
+ %%bash
70
+ mkdir -p plash-tutorial
71
+ cd plash-tutorial
72
+ ```
73
+
74
+ Next, create the `main.py` file:
75
+
76
+ ``` python
77
+ %%writefile main.py
78
+ from fasthtml.common import *
79
+
80
+ app, rt = fast_app()
81
+
82
+ @rt
83
+ def index():
84
+ return H1("Hello, world!")
85
+
86
+ serve()
87
+ ```
88
+
89
+ This is a basic [FastHTML](https://fastht.ml) app. Plash also supports other popular python frameworks.
90
+
91
+ > [!WARNING]
92
+ >
93
+ > Your app must use port 5001, as this is the port exposed by Plash’s Docker container. It also happens to be the default for FastHTML apps.
94
+
95
+ And create the `requirements.txt` file:
96
+
97
+ ``` python
98
+ %%writefile requirements.txt
99
+ python-fasthtml
100
+ ```
101
+
102
+ ### 4. Deploy your app
103
+
104
+ Now that you’ve created your app files, you’re ready to deploy! From your `plash-tutorial` directory, run: `plash-deploy`
105
+
106
+ This command will:
107
+
108
+ 1. Package your application files
109
+ 2. Upload them to Plash’s servers
110
+ 3. Build and deploy your application
111
+
112
+ ``` bash
113
+ %%bash
114
+ plash-deploy
115
+ ```
116
+
117
+ Initializing deployment...
118
+ ✅ Upload complete! Your app is currently being built.
119
+ It will be live at https://example-app.pla.sh
120
+
121
+ **Note:** You’ll see a different url that has been randomly generated for your app.
122
+
123
+ ### 5. View your app
124
+
125
+ Your app should be ready a couple of seconds after running the deploy command.
126
+
127
+ Once your app is ready, you can:
128
+
129
+ 1. Open the provided URL in your browser, or
130
+ 2. Use the convenient plash-view command to open it automatically:
131
+
132
+ ``` sh
133
+ plash-view
134
+ ```
135
+
136
+ When you visit that page you should see “Hello, World!”
137
+
138
+ 🎉 Congratulations! You deployed your first app on Plash!
139
+
140
+ ## Where to go from here
141
+
142
+ Learn more about what Plash has to offer in the rest of the docs at: <https://docs.pla.sh>
143
+
144
+ To learn more about creating web apps with FastHTML, we recommend looking at the official docs at: <https://fastht.ml/docs/>. In particular, we recommend the following:
145
+
146
+ 1. [OAuth](https://fastht.ml/docs/explains/oauth.html) - Setup authentication for your Plash App with Google Sign-In or other OAuth Providers.
147
+ 2. [Stripe](https://fastht.ml/docs/explains/stripe.html) - Accept payments for your products hosted on Plash with Stripe.
148
+
149
+ Would you like to use a different python web framework? Then check out the [examples section](https://github.com/AnswerDotAI/plash_cli/tree/main/examples) of the repo, it has examples for many popular python web frameworks like FastAPI, Gradio, and Streamlit.
@@ -0,0 +1,2 @@
1
+ __version__ = "0.3.15"
2
+ from .cli import *
@@ -11,7 +11,7 @@ __all__ = ['PLASH_CONFIG_HOME', 'PLASH_DOMAIN', 'pat', 'log_modes', 'PlashError'
11
11
  # %% ../nbs/00_cli.ipynb #702c219c
12
12
  from fastcore.all import *
13
13
  from fastcore.xdg import *
14
- import secrets, webbrowser, httpx, io, tarfile, random, string
14
+ import secrets, webbrowser, httpx2, io, tarfile, random, string
15
15
  from pathlib import Path
16
16
  from uuid import uuid4
17
17
  from time import time, sleep
@@ -25,10 +25,10 @@ PLASH_DOMAIN = os.getenv("PLASH_DOMAIN","pla.sh") # pla.sh plash-dev.answer.ai
25
25
 
26
26
  # %% ../nbs/00_cli.ipynb #1de1e2b3
27
27
  def _get_client(cfg=PLASH_CONFIG_HOME):
28
- client = httpx.Client()
28
+ client = httpx2.Client()
29
29
  if tok := os.getenv("PLASH_TOKEN"): cookies = {"session_": tok}
30
30
  elif cfg.exists(): cookies = cfg.read_json()
31
- else: raise FileNotFoundError("Config not found. Run plash_login and retry.")
31
+ else: raise FileNotFoundError("Config not found. Run plash-login and retry.")
32
32
  client.cookies.update(cookies)
33
33
  client.headers.update({'X-PLASH': 'true', 'User-Agent': f'plash_cli/{__version__}'})
34
34
  return client
@@ -77,7 +77,7 @@ class PlashError(Exception): pass
77
77
  def _poll_cookies(paircode, interval=1, timeout=180):
78
78
  "Poll server for token until received or timeout"
79
79
  start = time()
80
- client = httpx.Client()
80
+ client = httpx2.Client()
81
81
  url = _endpoint(rt=f"/cli_token?paircode={paircode}")
82
82
  while time()-start < timeout:
83
83
  resp = client.get(url).raise_for_status()
@@ -98,7 +98,7 @@ def login(
98
98
  PLASH_CONFIG_HOME.write_json({"session_": token.strip()})
99
99
  return f"Token saved to {PLASH_CONFIG_HOME}"
100
100
  paircode = secrets.token_urlsafe(16)
101
- login_url = httpx.get(_endpoint(rt=f"/cli_login?paircode={paircode}")).text
101
+ login_url = httpx2.get(_endpoint(rt=f"/cli_login?paircode={paircode}")).text
102
102
  print(f"Opening browser for authentication:\n{login_url}\n")
103
103
  webbrowser.open(login_url)
104
104
 
@@ -185,7 +185,7 @@ def _deploy(
185
185
  ):
186
186
  print('Initializing deployment...')
187
187
  try: res = deploy(path=path, name=name, _force_data=force_data)
188
- except PlashError as e: return str(e)
188
+ except PlashError as e: raise CliError(str(e))
189
189
  print('✅ Upload complete! Your app is currently being built.\n' +
190
190
  f'It will be live at {res}')
191
191
  _deploy.__doc__ = deploy.__doc__
@@ -223,7 +223,7 @@ def _delete(
223
223
  confirm = input("Are you sure you want to delete the app? [y/N]: ")
224
224
  if confirm.lower() not in ['y', 'yes']: return print("Deletion cancelled.")
225
225
  try: print(delete_app(**kwargs))
226
- except PlashError as e: return str(e)
226
+ except PlashError as e: raise CliError(str(e))
227
227
  _delete.__doc__ = delete_app.__doc__
228
228
 
229
229
  # %% ../nbs/00_cli.ipynb #d72ccd37
@@ -240,7 +240,7 @@ def start_app(
240
240
  @delegates(start_app)
241
241
  def _start(**kwargs):
242
242
  try: print(start_app(**kwargs))
243
- except PlashError as e: return str(e)
243
+ except PlashError as e: raise CliError(str(e))
244
244
  _start.__doc__ = start_app.__doc__
245
245
 
246
246
  # %% ../nbs/00_cli.ipynb #ace91510
@@ -257,7 +257,7 @@ def stop_app(
257
257
  @delegates(stop_app)
258
258
  def _stop(**kwargs):
259
259
  try: print(stop_app(**kwargs))
260
- except PlashError as e: return str(e)
260
+ except PlashError as e: raise CliError(str(e))
261
261
  _stop.__doc__ = stop_app.__doc__
262
262
 
263
263
  # %% ../nbs/00_cli.ipynb #24e62f1f
@@ -291,7 +291,7 @@ def _logs(
291
291
  if kwargs.get('mode','build') == 'build' and 'Build End Time:' in new_text: return
292
292
  sleep(1)
293
293
  except KeyboardInterrupt: print("\nExiting"); return
294
- except PlashError as e: return str(e)
294
+ except PlashError as e: raise CliError(str(e))
295
295
  _logs.__doc__ = logs.__doc__
296
296
 
297
297
  # %% ../nbs/00_cli.ipynb #f8441125
@@ -318,7 +318,7 @@ def download_app(
318
318
  @delegates(download_app)
319
319
  def _download(**kwargs):
320
320
  try: print(f"Downloaded your app to: {download_app(**kwargs)}")
321
- except PlashError as e: return str(e)
321
+ except PlashError as e: raise CliError(str(e))
322
322
  _download.__doc__ = download_app.__doc__
323
323
 
324
324
  # %% ../nbs/00_cli.ipynb #8378e31d
@@ -330,7 +330,7 @@ def app_list():
330
330
  @call_parse
331
331
  def _app_list(verbose:bool=False): # Whether to show running status as well as name: 1=running, 0=stopped
332
332
  try: res = app_list()
333
- except PlashError as e: return str(e)
333
+ except PlashError as e: raise CliError(str(e))
334
334
  if not res: print("You don't have any deployed Plash apps.")
335
335
  for a in res: print(f"{a['running']} {a['name']}" if verbose else a['name'])
336
336
  _app_list.__doc__ = app_list.__doc__
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plash_cli
3
- Version: 0.3.14
3
+ Version: 0.3.15
4
4
  Summary: CLI for the Plash hosting service
5
5
  Author-email: Jeremy Howard <info@fast.ai>
6
- License: Apache-2.0
6
+ License-Expression: Apache-2.0
7
7
  Project-URL: Repository, https://github.com/AnswerDotAI/plash_cli
8
8
  Project-URL: Documentation, https://AnswerDotAI.github.io/plash_cli
9
9
  Keywords: nbdev,jupyter,notebook,python
@@ -15,8 +15,8 @@ Classifier: Programming Language :: Python :: 3 :: Only
15
15
  Requires-Python: >=3.10
16
16
  Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
- Requires-Dist: fastcore>=1.12.27
19
- Requires-Dist: httpx>=0.28.1
18
+ Requires-Dist: fastcore>=2.2.20
19
+ Requires-Dist: httpx2
20
20
  Requires-Dist: python-dotenv
21
21
  Requires-Dist: pyjwt
22
22
  Requires-Dist: cryptography
@@ -32,34 +32,24 @@ Dynamic: license-file
32
32
 
33
33
  > [!WARNING]
34
34
  >
35
- > Plash is in Beta and we have released it in its semi-stable state to
36
- > gather early feedback to improve. We do not recommend hosting critical
37
- > applications yet.
35
+ > Plash is in Beta and we have released it in its semi-stable state to gather early feedback to improve. We do not recommend hosting critical applications yet.
38
36
 
39
37
  ## What is Plash
40
38
 
41
- Plash is a next-generation deployment platform for fast, hassle-free
42
- Python application hosting. It’s designed to be:
39
+ Plash is a next-generation deployment platform for fast, hassle-free Python application hosting. It’s designed to be:
43
40
 
44
- - **Simple and streamlined** - deploy your applications with minimal
45
- configuration
41
+ - **Simple and streamlined** - deploy your applications with minimal configuration
46
42
  - **Developer-focused** - built for coders, not cloud engineers
47
43
  - **Fast and efficient** - get your app online in seconds, not days
48
44
 
49
- Plash handles all the deployment complexities so you can focus on what
50
- matters: building great applications. With Plash, you can deploy any
51
- Python app using straightforward commands and configurations, letting
52
- you ship your work quickly and reliably.
45
+ Plash handles all the deployment complexities so you can focus on what matters: building great applications. With Plash, you can deploy any Python app using straightforward commands and configurations, letting you ship your work quickly and reliably.
53
46
 
54
- Whether you’re building web services, APIs, data applications, or tools,
55
- Plash provides the infrastructure backbone so you can concentrate on
56
- creating a splash with your code.
47
+ Whether you’re building web services, APIs, data applications, or tools, Plash provides the infrastructure backbone so you can concentrate on creating a splash with your code.
57
48
 
58
49
  ## Tutorial: deploy your first app
59
50
 
60
- In this tutorial you will learn how to deploy your first app. This
61
- tutorial will explore the basics of using Plash and help you get
62
- familiar with it at a high level.
51
+ In this tutorial you will learn how to deploy your first app.
52
+ This tutorial will explore the basics of using Plash and help you get familiar with it at a high level.
63
53
 
64
54
  **Prerequisites:**
65
55
 
@@ -81,23 +71,29 @@ The CLI lets you manage your whole app’s lifecycle
81
71
  Authenticate with your Plash account:
82
72
 
83
73
  ``` sh
84
- plash_login
74
+ plash-login
85
75
  ```
86
76
 
87
- This command opens your browser to authenticate with your Plash account.
88
- After completing the login process, you’ll see a “complete” confirmation
89
- page in your browser.
77
+ This command opens your browser to authenticate with your Plash account. After completing the login process, you’ll see a “complete” confirmation page in your browser.
90
78
 
91
79
  Return to your terminal where you’ll find the confirmation message:
92
80
 
93
- > Authentication successful! Config saved to
94
- > <your-global-config-path>/plash_config.json
81
+ > Authentication successful! Config saved to <your-global-config-path>/plash_config.json
82
+
83
+ #### Alternative Authentication Methods
84
+
85
+ If you’ve already logged in on one machine and want to authenticate on another without opening a browser, you can transfer your authentication token directly. Run `plash-login --show` on the machine where you’re already logged in to print your current token. You can then copy this and use `plash-login --token <your-token>` on the new machine to authenticate.
86
+
87
+ For convenience, you can pipe the token directly to your clipboard. On macOS, use `plash-login --show | pbcopy`. On Linux with X11, use `plash-login --show | xclip -selection clipboard` or `plash-login --show | xsel --clipboard`. On Windows PowerShell, use `plash-login --show | Set-Clipboard`.
88
+
89
+ For automated environments like CI/CD pipelines or scripts, you can set the `PLASH_TOKEN` environment variable instead of storing credentials in a config file. When this variable is set, the CLI will use it automatically without requiring `plash-login`. For example: `export PLASH_TOKEN="your-authentication-token"` on Unix-like systems, or `$env:PLASH_TOKEN="your-authentication-token"` in PowerShell.
95
90
 
96
91
  ### 3. Create your first app
97
92
 
98
93
  Create a new directory for your first app:
99
94
 
100
95
  ``` bash
96
+ %%bash
101
97
  mkdir -p plash-tutorial
102
98
  cd plash-tutorial
103
99
  ```
@@ -105,6 +101,7 @@ cd plash-tutorial
105
101
  Next, create the `main.py` file:
106
102
 
107
103
  ``` python
104
+ %%writefile main.py
108
105
  from fasthtml.common import *
109
106
 
110
107
  app, rt = fast_app()
@@ -116,24 +113,22 @@ def index():
116
113
  serve()
117
114
  ```
118
115
 
119
- This is a basic [FastHTML](https://fastht.ml) app. Plash also supports
120
- other popular python frameworks.
116
+ This is a basic [FastHTML](https://fastht.ml) app. Plash also supports other popular python frameworks.
121
117
 
122
118
  > [!WARNING]
123
119
  >
124
- > Your app must use port 5001, as this is the port exposed by Plash’s
125
- > Docker container. It also happens to be the default for FastHTML apps.
120
+ > Your app must use port 5001, as this is the port exposed by Plash’s Docker container. It also happens to be the default for FastHTML apps.
126
121
 
127
122
  And create the `requirements.txt` file:
128
123
 
129
124
  ``` python
125
+ %%writefile requirements.txt
130
126
  python-fasthtml
131
127
  ```
132
128
 
133
129
  ### 4. Deploy your app
134
130
 
135
- Now that you’ve created your app files, you’re ready to deploy! From
136
- your `plash-tutorial` directory, run: `plash_deploy`
131
+ Now that you’ve created your app files, you’re ready to deploy! From your `plash-tutorial` directory, run: `plash-deploy`
137
132
 
138
133
  This command will:
139
134
 
@@ -142,28 +137,27 @@ This command will:
142
137
  3. Build and deploy your application
143
138
 
144
139
  ``` bash
145
- plash_deploy
140
+ %%bash
141
+ plash-deploy
146
142
  ```
147
143
 
148
144
  Initializing deployment...
149
145
  ✅ Upload complete! Your app is currently being built.
150
146
  It will be live at https://example-app.pla.sh
151
147
 
152
- **Note:** You’ll see a different url that has been randomly generated
153
- for your app.
148
+ **Note:** You’ll see a different url that has been randomly generated for your app.
154
149
 
155
150
  ### 5. View your app
156
151
 
157
- Your app should be ready a couple of seconds after running the deploy
158
- command.
152
+ Your app should be ready a couple of seconds after running the deploy command.
159
153
 
160
154
  Once your app is ready, you can:
161
155
 
162
156
  1. Open the provided URL in your browser, or
163
- 2. Use the convenient plash_view command to open it automatically:
157
+ 2. Use the convenient plash-view command to open it automatically:
164
158
 
165
159
  ``` sh
166
- plash_view
160
+ plash-view
167
161
  ```
168
162
 
169
163
  When you visit that page you should see “Hello, World!”
@@ -172,21 +166,11 @@ When you visit that page you should see “Hello, World!”
172
166
 
173
167
  ## Where to go from here
174
168
 
175
- Learn more about what Plash has to offer in the rest of the docs at:
176
- <https://docs.pla.sh>
169
+ Learn more about what Plash has to offer in the rest of the docs at: <https://docs.pla.sh>
177
170
 
178
- To learn more about creating web apps with FastHTML, we recommend
179
- looking at the official docs at: <https://fastht.ml/docs/>. In
180
- particular, we recommend the following:
171
+ To learn more about creating web apps with FastHTML, we recommend looking at the official docs at: <https://fastht.ml/docs/>. In particular, we recommend the following:
181
172
 
182
- 1. [OAuth](https://fastht.ml/docs/explains/oauth.html) - Setup
183
- authentication for your Plash App with Google Sign-In or other OAuth
184
- Providers.
185
- 2. [Stripe](https://fastht.ml/docs/explains/stripe.html) - Accept
186
- payments for your products hosted on Plash with Stripe.
173
+ 1. [OAuth](https://fastht.ml/docs/explains/oauth.html) - Setup authentication for your Plash App with Google Sign-In or other OAuth Providers.
174
+ 2. [Stripe](https://fastht.ml/docs/explains/stripe.html) - Accept payments for your products hosted on Plash with Stripe.
187
175
 
188
- Would you like to use a different python web framework? Then check out
189
- the [examples
190
- section](https://github.com/AnswerDotAI/plash_cli/tree/main/examples) of
191
- the repo, it has examples for many popular python web frameworks like
192
- FastAPI, Gradio, and Streamlit.
176
+ Would you like to use a different python web framework? Then check out the [examples section](https://github.com/AnswerDotAI/plash_cli/tree/main/examples) of the repo, it has examples for many popular python web frameworks like FastAPI, Gradio, and Streamlit.
@@ -1,5 +1,5 @@
1
- fastcore>=1.12.27
2
- httpx>=0.28.1
1
+ fastcore>=2.2.20
2
+ httpx2
3
3
  python-dotenv
4
4
  pyjwt
5
5
  cryptography
@@ -1,5 +1,5 @@
1
1
  [build-system]
2
- requires = ["setuptools>=64"]
2
+ requires = ["setuptools>=77"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
@@ -8,11 +8,11 @@ dynamic = ["version"]
8
8
  description = "CLI for the Plash hosting service"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
11
- license = {text = "Apache-2.0"}
11
+ license = "Apache-2.0"
12
12
  authors = [{name = "Jeremy Howard", email = "info@fast.ai"}]
13
13
  keywords = ['nbdev', 'jupyter', 'notebook', 'python']
14
14
  classifiers = ["Natural Language :: English", "Intended Audience :: Developers", "Development Status :: 3 - Alpha", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only"]
15
- dependencies = ['fastcore>=1.12.27', 'httpx>=0.28.1', 'python-dotenv', 'pyjwt', 'cryptography']
15
+ dependencies = ['fastcore>=2.2.20', 'httpx2', 'python-dotenv', 'pyjwt', 'cryptography']
16
16
 
17
17
  [project.urls]
18
18
  Repository = "https://github.com/AnswerDotAI/plash_cli"
@@ -1,165 +0,0 @@
1
- # Plash
2
-
3
-
4
- <!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
5
-
6
- > [!WARNING]
7
- >
8
- > Plash is in Beta and we have released it in its semi-stable state to
9
- > gather early feedback to improve. We do not recommend hosting critical
10
- > applications yet.
11
-
12
- ## What is Plash
13
-
14
- Plash is a next-generation deployment platform for fast, hassle-free
15
- Python application hosting. It’s designed to be:
16
-
17
- - **Simple and streamlined** - deploy your applications with minimal
18
- configuration
19
- - **Developer-focused** - built for coders, not cloud engineers
20
- - **Fast and efficient** - get your app online in seconds, not days
21
-
22
- Plash handles all the deployment complexities so you can focus on what
23
- matters: building great applications. With Plash, you can deploy any
24
- Python app using straightforward commands and configurations, letting
25
- you ship your work quickly and reliably.
26
-
27
- Whether you’re building web services, APIs, data applications, or tools,
28
- Plash provides the infrastructure backbone so you can concentrate on
29
- creating a splash with your code.
30
-
31
- ## Tutorial: deploy your first app
32
-
33
- In this tutorial you will learn how to deploy your first app. This
34
- tutorial will explore the basics of using Plash and help you get
35
- familiar with it at a high level.
36
-
37
- **Prerequisites:**
38
-
39
- - A registered account at <https://pla.sh>
40
- - Basic terminal / command line skills
41
-
42
- ### 1. Installation
43
-
44
- Install Plash comandline interface (CLI) with pip:
45
-
46
- ``` sh
47
- pip install plash-cli
48
- ```
49
-
50
- The CLI lets you manage your whole app’s lifecycle
51
-
52
- ### 2. CLI Login
53
-
54
- Authenticate with your Plash account:
55
-
56
- ``` sh
57
- plash_login
58
- ```
59
-
60
- This command opens your browser to authenticate with your Plash account.
61
- After completing the login process, you’ll see a “complete” confirmation
62
- page in your browser.
63
-
64
- Return to your terminal where you’ll find the confirmation message:
65
-
66
- > Authentication successful! Config saved to
67
- > <your-global-config-path>/plash_config.json
68
-
69
- ### 3. Create your first app
70
-
71
- Create a new directory for your first app:
72
-
73
- ``` bash
74
- mkdir -p plash-tutorial
75
- cd plash-tutorial
76
- ```
77
-
78
- Next, create the `main.py` file:
79
-
80
- ``` python
81
- from fasthtml.common import *
82
-
83
- app, rt = fast_app()
84
-
85
- @rt
86
- def index():
87
- return H1("Hello, world!")
88
-
89
- serve()
90
- ```
91
-
92
- This is a basic [FastHTML](https://fastht.ml) app. Plash also supports
93
- other popular python frameworks.
94
-
95
- > [!WARNING]
96
- >
97
- > Your app must use port 5001, as this is the port exposed by Plash’s
98
- > Docker container. It also happens to be the default for FastHTML apps.
99
-
100
- And create the `requirements.txt` file:
101
-
102
- ``` python
103
- python-fasthtml
104
- ```
105
-
106
- ### 4. Deploy your app
107
-
108
- Now that you’ve created your app files, you’re ready to deploy! From
109
- your `plash-tutorial` directory, run: `plash_deploy`
110
-
111
- This command will:
112
-
113
- 1. Package your application files
114
- 2. Upload them to Plash’s servers
115
- 3. Build and deploy your application
116
-
117
- ``` bash
118
- plash_deploy
119
- ```
120
-
121
- Initializing deployment...
122
- ✅ Upload complete! Your app is currently being built.
123
- It will be live at https://example-app.pla.sh
124
-
125
- **Note:** You’ll see a different url that has been randomly generated
126
- for your app.
127
-
128
- ### 5. View your app
129
-
130
- Your app should be ready a couple of seconds after running the deploy
131
- command.
132
-
133
- Once your app is ready, you can:
134
-
135
- 1. Open the provided URL in your browser, or
136
- 2. Use the convenient plash_view command to open it automatically:
137
-
138
- ``` sh
139
- plash_view
140
- ```
141
-
142
- When you visit that page you should see “Hello, World!”
143
-
144
- 🎉 Congratulations! You deployed your first app on Plash!
145
-
146
- ## Where to go from here
147
-
148
- Learn more about what Plash has to offer in the rest of the docs at:
149
- <https://docs.pla.sh>
150
-
151
- To learn more about creating web apps with FastHTML, we recommend
152
- looking at the official docs at: <https://fastht.ml/docs/>. In
153
- particular, we recommend the following:
154
-
155
- 1. [OAuth](https://fastht.ml/docs/explains/oauth.html) - Setup
156
- authentication for your Plash App with Google Sign-In or other OAuth
157
- Providers.
158
- 2. [Stripe](https://fastht.ml/docs/explains/stripe.html) - Accept
159
- payments for your products hosted on Plash with Stripe.
160
-
161
- Would you like to use a different python web framework? Then check out
162
- the [examples
163
- section](https://github.com/AnswerDotAI/plash_cli/tree/main/examples) of
164
- the repo, it has examples for many popular python web frameworks like
165
- FastAPI, Gradio, and Streamlit.
@@ -1,2 +0,0 @@
1
- __version__ = "0.3.14"
2
- from .cli import *
File without changes
File without changes
File without changes
File without changes