plash-cli 0.3.13__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.
- {plash_cli-0.3.13/plash_cli.egg-info → plash_cli-0.3.15}/PKG-INFO +39 -55
- plash_cli-0.3.15/README.md +149 -0
- plash_cli-0.3.15/plash_cli/__init__.py +2 -0
- {plash_cli-0.3.13 → plash_cli-0.3.15}/plash_cli/auth.py +12 -6
- {plash_cli-0.3.13 → plash_cli-0.3.15}/plash_cli/cli.py +37 -24
- {plash_cli-0.3.13 → plash_cli-0.3.15/plash_cli.egg-info}/PKG-INFO +39 -55
- plash_cli-0.3.15/plash_cli.egg-info/entry_points.txt +13 -0
- {plash_cli-0.3.13 → plash_cli-0.3.15}/plash_cli.egg-info/requires.txt +2 -2
- {plash_cli-0.3.13 → plash_cli-0.3.15}/pyproject.toml +17 -12
- plash_cli-0.3.13/README.md +0 -165
- plash_cli-0.3.13/plash_cli/__init__.py +0 -2
- plash_cli-0.3.13/plash_cli.egg-info/entry_points.txt +0 -13
- {plash_cli-0.3.13 → plash_cli-0.3.15}/LICENSE +0 -0
- {plash_cli-0.3.13 → plash_cli-0.3.15}/MANIFEST.in +0 -0
- {plash_cli-0.3.13 → plash_cli-0.3.15}/plash_cli/_bash_magic.py +0 -0
- {plash_cli-0.3.13 → plash_cli-0.3.15}/plash_cli/_modidx.py +0 -0
- {plash_cli-0.3.13 → plash_cli-0.3.15}/plash_cli/assets/es256_public_key.pem +0 -0
- {plash_cli-0.3.13 → plash_cli-0.3.15}/plash_cli.egg-info/SOURCES.txt +0 -0
- {plash_cli-0.3.13 → plash_cli-0.3.15}/plash_cli.egg-info/dependency_links.txt +0 -0
- {plash_cli-0.3.13 → plash_cli-0.3.15}/plash_cli.egg-info/top_level.txt +0 -0
- {plash_cli-0.3.13 → plash_cli-0.3.15}/setup.cfg +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: plash_cli
|
|
3
|
-
Version: 0.3.
|
|
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
|
|
19
|
-
Requires-Dist:
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
157
|
+
2. Use the convenient plash-view command to open it automatically:
|
|
164
158
|
|
|
165
159
|
``` sh
|
|
166
|
-
|
|
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
|
-
|
|
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.
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
"""Client side logic to add Plash Auth to your app
|
|
1
|
+
"""Client side logic to add Plash Auth to your app
|
|
2
|
+
|
|
3
|
+
Docs: https://AnswerDotAI.github.io/plash_cli/auth.html.md"""
|
|
2
4
|
|
|
3
5
|
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/01_auth.ipynb.
|
|
4
6
|
|
|
@@ -27,9 +29,11 @@ def _signin_url(email_re: str=None, hd_re: str=None):
|
|
|
27
29
|
signin_completed_rt = "/signin_completed"
|
|
28
30
|
|
|
29
31
|
# %% ../nbs/01_auth.ipynb #74a0a24d
|
|
30
|
-
def mk_signin_url(
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
def mk_signin_url(
|
|
33
|
+
session: dict, # Session dictionary
|
|
34
|
+
email_re: str=None, # Regex filter for allowed email addresses
|
|
35
|
+
hd_re: str=None # Regex filter for allowed Google hosted domains
|
|
36
|
+
):
|
|
33
37
|
"Generate a Google Sign-In URL for Plash authentication."
|
|
34
38
|
if not _in_prod: return f"{signin_completed_rt}?signin_reply=mock-sign-in-reply"
|
|
35
39
|
res = _signin_url(email_re, hd_re)
|
|
@@ -50,8 +54,10 @@ class PlashAuthError(Exception):
|
|
|
50
54
|
pass
|
|
51
55
|
|
|
52
56
|
# %% ../nbs/01_auth.ipynb #a311ce9a
|
|
53
|
-
def goog_id_from_signin_reply(
|
|
54
|
-
|
|
57
|
+
def goog_id_from_signin_reply(
|
|
58
|
+
session: dict, # Session dictionary containing 'req_id'
|
|
59
|
+
reply: str # The JWT reply string from Plash after Google authentication
|
|
60
|
+
):
|
|
55
61
|
"Validate Google sign-in reply and returns Google user ID if valid."
|
|
56
62
|
if not _in_prod: return '424242424242424242424'
|
|
57
63
|
parsed = _parse_jwt(reply)
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
"""The Plash CLI tool
|
|
1
|
+
"""The Plash CLI tool
|
|
2
|
+
|
|
3
|
+
Docs: https://AnswerDotAI.github.io/plash_cli/cli.html.md"""
|
|
2
4
|
|
|
3
5
|
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_cli.ipynb.
|
|
4
6
|
|
|
@@ -9,7 +11,7 @@ __all__ = ['PLASH_CONFIG_HOME', 'PLASH_DOMAIN', 'pat', 'log_modes', 'PlashError'
|
|
|
9
11
|
# %% ../nbs/00_cli.ipynb #702c219c
|
|
10
12
|
from fastcore.all import *
|
|
11
13
|
from fastcore.xdg import *
|
|
12
|
-
import secrets, webbrowser,
|
|
14
|
+
import secrets, webbrowser, httpx2, io, tarfile, random, string
|
|
13
15
|
from pathlib import Path
|
|
14
16
|
from uuid import uuid4
|
|
15
17
|
from time import time, sleep
|
|
@@ -23,10 +25,10 @@ PLASH_DOMAIN = os.getenv("PLASH_DOMAIN","pla.sh") # pla.sh plash-dev.answer.ai
|
|
|
23
25
|
|
|
24
26
|
# %% ../nbs/00_cli.ipynb #1de1e2b3
|
|
25
27
|
def _get_client(cfg=PLASH_CONFIG_HOME):
|
|
26
|
-
client =
|
|
28
|
+
client = httpx2.Client()
|
|
27
29
|
if tok := os.getenv("PLASH_TOKEN"): cookies = {"session_": tok}
|
|
28
30
|
elif cfg.exists(): cookies = cfg.read_json()
|
|
29
|
-
else: raise FileNotFoundError("Config not found. Run
|
|
31
|
+
else: raise FileNotFoundError("Config not found. Run plash-login and retry.")
|
|
30
32
|
client.cookies.update(cookies)
|
|
31
33
|
client.headers.update({'X-PLASH': 'true', 'User-Agent': f'plash_cli/{__version__}'})
|
|
32
34
|
return client
|
|
@@ -75,7 +77,7 @@ class PlashError(Exception): pass
|
|
|
75
77
|
def _poll_cookies(paircode, interval=1, timeout=180):
|
|
76
78
|
"Poll server for token until received or timeout"
|
|
77
79
|
start = time()
|
|
78
|
-
client =
|
|
80
|
+
client = httpx2.Client()
|
|
79
81
|
url = _endpoint(rt=f"/cli_token?paircode={paircode}")
|
|
80
82
|
while time()-start < timeout:
|
|
81
83
|
resp = client.get(url).raise_for_status()
|
|
@@ -96,7 +98,7 @@ def login(
|
|
|
96
98
|
PLASH_CONFIG_HOME.write_json({"session_": token.strip()})
|
|
97
99
|
return f"Token saved to {PLASH_CONFIG_HOME}"
|
|
98
100
|
paircode = secrets.token_urlsafe(16)
|
|
99
|
-
login_url =
|
|
101
|
+
login_url = httpx2.get(_endpoint(rt=f"/cli_login?paircode={paircode}")).text
|
|
100
102
|
print(f"Opening browser for authentication:\n{login_url}\n")
|
|
101
103
|
webbrowser.open(login_url)
|
|
102
104
|
|
|
@@ -150,7 +152,8 @@ def create_tar_archive(path:Path, force_data:bool=False) -> tuple[io.BytesIO, in
|
|
|
150
152
|
def deploy(
|
|
151
153
|
path:Path='.', # Path to project
|
|
152
154
|
name:str=None, # Overrides the .plash file in project root if provided
|
|
153
|
-
_force_data:bool=False
|
|
155
|
+
_force_data:bool=False # Overwrite data/ directory during deployment
|
|
156
|
+
):
|
|
154
157
|
"""
|
|
155
158
|
Deploys app to production. By default, this command erases all files in your app which are not in data/.
|
|
156
159
|
Then uploads all files and folders, except paths starting with `.` and except the local data/ directory.
|
|
@@ -178,10 +181,11 @@ def deploy(
|
|
|
178
181
|
def _deploy(
|
|
179
182
|
path:Path='.', # Path to project
|
|
180
183
|
name:str=None, # Overrides the .plash file in project root if provided
|
|
181
|
-
force_data:bool=False
|
|
184
|
+
force_data:bool=False # Overwrite data/ directory during deployment
|
|
185
|
+
):
|
|
182
186
|
print('Initializing deployment...')
|
|
183
187
|
try: res = deploy(path=path, name=name, _force_data=force_data)
|
|
184
|
-
except PlashError as e:
|
|
188
|
+
except PlashError as e: raise CliError(str(e))
|
|
185
189
|
print('✅ Upload complete! Your app is currently being built.\n' +
|
|
186
190
|
f'It will be live at {res}')
|
|
187
191
|
_deploy.__doc__ = deploy.__doc__
|
|
@@ -201,7 +205,8 @@ def view(
|
|
|
201
205
|
# %% ../nbs/00_cli.ipynb #43535aef
|
|
202
206
|
def delete_app(
|
|
203
207
|
path:Path='.', # Path to project
|
|
204
|
-
name:str=None
|
|
208
|
+
name:str=None # Overrides the .plash file in project root if provided
|
|
209
|
+
):
|
|
205
210
|
'Delete your deployed app'
|
|
206
211
|
name = _prep(path, name)
|
|
207
212
|
_mk_auth_req(_endpoint(rt=f"/delete?name={name}"), "delete")
|
|
@@ -209,20 +214,23 @@ def delete_app(
|
|
|
209
214
|
|
|
210
215
|
@call_parse
|
|
211
216
|
@delegates(delete_app)
|
|
212
|
-
def _delete(
|
|
213
|
-
|
|
217
|
+
def _delete(
|
|
218
|
+
force:bool=False, # Skip confirmation prompt
|
|
219
|
+
**kwargs
|
|
220
|
+
):
|
|
214
221
|
'Delete your deployed app'
|
|
215
222
|
if not force:
|
|
216
223
|
confirm = input("Are you sure you want to delete the app? [y/N]: ")
|
|
217
224
|
if confirm.lower() not in ['y', 'yes']: return print("Deletion cancelled.")
|
|
218
225
|
try: print(delete_app(**kwargs))
|
|
219
|
-
except PlashError as e:
|
|
226
|
+
except PlashError as e: raise CliError(str(e))
|
|
220
227
|
_delete.__doc__ = delete_app.__doc__
|
|
221
228
|
|
|
222
229
|
# %% ../nbs/00_cli.ipynb #d72ccd37
|
|
223
230
|
def start_app(
|
|
224
231
|
path:Path='.', # Path to project
|
|
225
|
-
name:str=None
|
|
232
|
+
name:str=None # Overrides the .plash file in project root if provided
|
|
233
|
+
):
|
|
226
234
|
'Start your deployed app'
|
|
227
235
|
name = _prep(path, name)
|
|
228
236
|
_mk_auth_req(_endpoint(rt=f"/start?name={name}"))
|
|
@@ -232,13 +240,14 @@ def start_app(
|
|
|
232
240
|
@delegates(start_app)
|
|
233
241
|
def _start(**kwargs):
|
|
234
242
|
try: print(start_app(**kwargs))
|
|
235
|
-
except PlashError as e:
|
|
243
|
+
except PlashError as e: raise CliError(str(e))
|
|
236
244
|
_start.__doc__ = start_app.__doc__
|
|
237
245
|
|
|
238
246
|
# %% ../nbs/00_cli.ipynb #ace91510
|
|
239
247
|
def stop_app(
|
|
240
248
|
path:Path='.', # Path to project
|
|
241
|
-
name:str=None
|
|
249
|
+
name:str=None # Overrides the .plash file in project root if provided
|
|
250
|
+
):
|
|
242
251
|
'Stop your deployed app'
|
|
243
252
|
name = _prep(path, name)
|
|
244
253
|
_mk_auth_req(_endpoint(rt=f"/stop?name={name}"))
|
|
@@ -248,7 +257,7 @@ def stop_app(
|
|
|
248
257
|
@delegates(stop_app)
|
|
249
258
|
def _stop(**kwargs):
|
|
250
259
|
try: print(stop_app(**kwargs))
|
|
251
|
-
except PlashError as e:
|
|
260
|
+
except PlashError as e: raise CliError(str(e))
|
|
252
261
|
_stop.__doc__ = stop_app.__doc__
|
|
253
262
|
|
|
254
263
|
# %% ../nbs/00_cli.ipynb #24e62f1f
|
|
@@ -258,7 +267,8 @@ log_modes = str_enum('log_modes', 'build', 'app')
|
|
|
258
267
|
def logs(
|
|
259
268
|
path:Path='.', # Path to project
|
|
260
269
|
name:str=None, # Overrides the .plash file in project root if provided
|
|
261
|
-
mode:log_modes='build'
|
|
270
|
+
mode:log_modes='build' # Choose between build or app logs
|
|
271
|
+
):
|
|
262
272
|
'Get logs for your deployed app'
|
|
263
273
|
name = _prep(path, name)
|
|
264
274
|
r = _mk_auth_req(_endpoint(rt=f"/logs?name={name}&mode={mode}"))
|
|
@@ -266,8 +276,10 @@ def logs(
|
|
|
266
276
|
|
|
267
277
|
@call_parse
|
|
268
278
|
@delegates(logs)
|
|
269
|
-
def _logs(
|
|
270
|
-
|
|
279
|
+
def _logs(
|
|
280
|
+
tail:bool=False, # Tail the logs
|
|
281
|
+
**kwargs
|
|
282
|
+
):
|
|
271
283
|
try:
|
|
272
284
|
if not tail: return print(logs(**kwargs))
|
|
273
285
|
text = ''
|
|
@@ -279,7 +291,7 @@ def _logs(tail:bool=False, # Tail the logs
|
|
|
279
291
|
if kwargs.get('mode','build') == 'build' and 'Build End Time:' in new_text: return
|
|
280
292
|
sleep(1)
|
|
281
293
|
except KeyboardInterrupt: print("\nExiting"); return
|
|
282
|
-
except PlashError as e:
|
|
294
|
+
except PlashError as e: raise CliError(str(e))
|
|
283
295
|
_logs.__doc__ = logs.__doc__
|
|
284
296
|
|
|
285
297
|
# %% ../nbs/00_cli.ipynb #f8441125
|
|
@@ -290,7 +302,8 @@ def _is_dir_empty(self:Path): return next(self.iterdir(), None) is None
|
|
|
290
302
|
def download_app(
|
|
291
303
|
path:Path='.', # Path to project
|
|
292
304
|
name:str=None, # Overrides the .plash file in project root if provided
|
|
293
|
-
save_path:Path="./download/"
|
|
305
|
+
save_path:Path="./download/" # Save path (optional)
|
|
306
|
+
):
|
|
294
307
|
"Download deployed app to save_path."
|
|
295
308
|
name = _prep(path, name)
|
|
296
309
|
save_path = Path(save_path)
|
|
@@ -305,7 +318,7 @@ def download_app(
|
|
|
305
318
|
@delegates(download_app)
|
|
306
319
|
def _download(**kwargs):
|
|
307
320
|
try: print(f"Downloaded your app to: {download_app(**kwargs)}")
|
|
308
|
-
except PlashError as e:
|
|
321
|
+
except PlashError as e: raise CliError(str(e))
|
|
309
322
|
_download.__doc__ = download_app.__doc__
|
|
310
323
|
|
|
311
324
|
# %% ../nbs/00_cli.ipynb #8378e31d
|
|
@@ -317,7 +330,7 @@ def app_list():
|
|
|
317
330
|
@call_parse
|
|
318
331
|
def _app_list(verbose:bool=False): # Whether to show running status as well as name: 1=running, 0=stopped
|
|
319
332
|
try: res = app_list()
|
|
320
|
-
except PlashError as e:
|
|
333
|
+
except PlashError as e: raise CliError(str(e))
|
|
321
334
|
if not res: print("You don't have any deployed Plash apps.")
|
|
322
335
|
for a in res: print(f"{a['running']} {a['name']}" if verbose else a['name'])
|
|
323
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.
|
|
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
|
|
19
|
-
Requires-Dist:
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
157
|
+
2. Use the convenient plash-view command to open it automatically:
|
|
164
158
|
|
|
165
159
|
``` sh
|
|
166
|
-
|
|
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
|
-
|
|
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,13 @@
|
|
|
1
|
+
[console_scripts]
|
|
2
|
+
plash-apps = plash_cli.cli:_app_list
|
|
3
|
+
plash-delete = plash_cli.cli:_delete
|
|
4
|
+
plash-deploy = plash_cli.cli:_deploy
|
|
5
|
+
plash-download = plash_cli.cli:_download
|
|
6
|
+
plash-login = plash_cli.cli:login
|
|
7
|
+
plash-logs = plash_cli.cli:_logs
|
|
8
|
+
plash-start = plash_cli.cli:_start
|
|
9
|
+
plash-stop = plash_cli.cli:_stop
|
|
10
|
+
plash-view = plash_cli.cli:view
|
|
11
|
+
|
|
12
|
+
[nbdev]
|
|
13
|
+
plash_cli = plash_cli._modidx:d
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["setuptools>=
|
|
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 =
|
|
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', '
|
|
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"
|
|
@@ -26,15 +26,15 @@ dev = ['bash_kernel', 'nbdev>=3']
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
[project.scripts]
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
plash-deploy = "plash_cli.cli:_deploy"
|
|
30
|
+
plash-login = "plash_cli.cli:login"
|
|
31
|
+
plash-view = "plash_cli.cli:view"
|
|
32
|
+
plash-logs = "plash_cli.cli:_logs"
|
|
33
|
+
plash-delete = "plash_cli.cli:_delete"
|
|
34
|
+
plash-stop = "plash_cli.cli:_stop"
|
|
35
|
+
plash-start = "plash_cli.cli:_start"
|
|
36
|
+
plash-download = "plash_cli.cli:_download"
|
|
37
|
+
plash-apps = "plash_cli.cli:_app_list"
|
|
38
38
|
|
|
39
39
|
[tool.setuptools.dynamic]
|
|
40
40
|
version = {attr = "plash_cli.__version__"}
|
|
@@ -43,4 +43,9 @@ version = {attr = "plash_cli.__version__"}
|
|
|
43
43
|
include = ["plash_cli"]
|
|
44
44
|
|
|
45
45
|
[tool.nbdev]
|
|
46
|
+
allowed_metadata_keys = ['solveit']
|
|
47
|
+
allowed_cell_metadata_keys = ['solveit_ai']
|
|
46
48
|
custom_sidebar = false
|
|
49
|
+
|
|
50
|
+
[tool.chkstyle]
|
|
51
|
+
skip_paths = ["_modidx.py"]
|
plash_cli-0.3.13/README.md
DELETED
|
@@ -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,13 +0,0 @@
|
|
|
1
|
-
[console_scripts]
|
|
2
|
-
plash_apps = plash_cli.cli:_app_list
|
|
3
|
-
plash_delete = plash_cli.cli:_delete
|
|
4
|
-
plash_deploy = plash_cli.cli:_deploy
|
|
5
|
-
plash_download = plash_cli.cli:_download
|
|
6
|
-
plash_login = plash_cli.cli:login
|
|
7
|
-
plash_logs = plash_cli.cli:_logs
|
|
8
|
-
plash_start = plash_cli.cli:_start
|
|
9
|
-
plash_stop = plash_cli.cli:_stop
|
|
10
|
-
plash_view = plash_cli.cli:view
|
|
11
|
-
|
|
12
|
-
[nbdev]
|
|
13
|
-
plash_cli = plash_cli._modidx:d
|
|
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
|