plash-cli 0.3.15__tar.gz → 0.3.16__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.15/plash_cli.egg-info → plash_cli-0.3.16}/PKG-INFO +40 -40
- {plash_cli-0.3.15 → plash_cli-0.3.16}/README.md +37 -37
- plash_cli-0.3.16/plash_cli/__init__.py +2 -0
- {plash_cli-0.3.15 → plash_cli-0.3.16}/plash_cli/_bash_magic.py +5 -4
- plash_cli-0.3.16/plash_cli/_modidx.py +61 -0
- {plash_cli-0.3.15 → plash_cli-0.3.16}/plash_cli/auth.py +12 -12
- {plash_cli-0.3.15 → plash_cli-0.3.16}/plash_cli/cli.py +32 -34
- {plash_cli-0.3.15 → plash_cli-0.3.16/plash_cli.egg-info}/PKG-INFO +40 -40
- {plash_cli-0.3.15 → plash_cli-0.3.16}/plash_cli.egg-info/entry_points.txt +1 -1
- {plash_cli-0.3.15 → plash_cli-0.3.16}/plash_cli.egg-info/requires.txt +1 -1
- {plash_cli-0.3.15 → plash_cli-0.3.16}/pyproject.toml +37 -9
- plash_cli-0.3.15/plash_cli/__init__.py +0 -2
- plash_cli-0.3.15/plash_cli/_modidx.py +0 -41
- {plash_cli-0.3.15 → plash_cli-0.3.16}/LICENSE +0 -0
- {plash_cli-0.3.15 → plash_cli-0.3.16}/MANIFEST.in +0 -0
- {plash_cli-0.3.15 → plash_cli-0.3.16}/plash_cli/assets/es256_public_key.pem +0 -0
- {plash_cli-0.3.15 → plash_cli-0.3.16}/plash_cli.egg-info/SOURCES.txt +0 -0
- {plash_cli-0.3.15 → plash_cli-0.3.16}/plash_cli.egg-info/dependency_links.txt +0 -0
- {plash_cli-0.3.15 → plash_cli-0.3.16}/plash_cli.egg-info/top_level.txt +0 -0
- {plash_cli-0.3.15 → plash_cli-0.3.16}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: plash_cli
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.16
|
|
4
4
|
Summary: CLI for the Plash hosting service
|
|
5
5
|
Author-email: Jeremy Howard <info@fast.ai>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -12,7 +12,7 @@ Classifier: Intended Audience :: Developers
|
|
|
12
12
|
Classifier: Development Status :: 3 - Alpha
|
|
13
13
|
Classifier: Programming Language :: Python :: 3
|
|
14
14
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
-
Requires-Python: >=3.
|
|
15
|
+
Requires-Python: >=3.11
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
License-File: LICENSE
|
|
18
18
|
Requires-Dist: fastcore>=2.2.20
|
|
@@ -22,21 +22,21 @@ Requires-Dist: pyjwt
|
|
|
22
22
|
Requires-Dist: cryptography
|
|
23
23
|
Provides-Extra: dev
|
|
24
24
|
Requires-Dist: bash_kernel; extra == "dev"
|
|
25
|
-
Requires-Dist:
|
|
25
|
+
Requires-Dist: fastship; extra == "dev"
|
|
26
26
|
Dynamic: license-file
|
|
27
27
|
|
|
28
28
|
# Plash
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
|
|
30
|
+
Deploy your python apps in seconds. Fast, reliable, and effortless hosting for developers who want to focus on building, not deploying.
|
|
32
31
|
|
|
33
32
|
> [!WARNING]
|
|
34
|
-
>
|
|
35
33
|
> 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.
|
|
36
34
|
|
|
35
|
+
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
|
|
36
|
+
|
|
37
37
|
## What is Plash
|
|
38
38
|
|
|
39
|
-
Plash is a next-generation deployment platform for fast, hassle-free Python application hosting. It
|
|
39
|
+
Plash is a next-generation deployment platform for fast, hassle-free Python application hosting. It's designed to be:
|
|
40
40
|
|
|
41
41
|
- **Simple and streamlined** - deploy your applications with minimal configuration
|
|
42
42
|
- **Developer-focused** - built for coders, not cloud engineers
|
|
@@ -44,45 +44,44 @@ Plash is a next-generation deployment platform for fast, hassle-free Python appl
|
|
|
44
44
|
|
|
45
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.
|
|
46
46
|
|
|
47
|
-
Whether you
|
|
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.
|
|
48
48
|
|
|
49
49
|
## Tutorial: deploy your first app
|
|
50
50
|
|
|
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.
|
|
51
|
+
In this tutorial you will learn how to deploy your first app. This tutorial will explore the basics of using Plash and help you get familiar with it at a high level.
|
|
53
52
|
|
|
54
53
|
**Prerequisites:**
|
|
55
54
|
|
|
56
|
-
- A registered account at
|
|
55
|
+
- A registered account at [https://pla.sh](https://pla.sh)
|
|
57
56
|
- Basic terminal / command line skills
|
|
58
57
|
|
|
59
58
|
### 1. Installation
|
|
60
59
|
|
|
61
60
|
Install Plash comandline interface (CLI) with pip:
|
|
62
61
|
|
|
63
|
-
```
|
|
62
|
+
```sh
|
|
64
63
|
pip install plash-cli
|
|
65
64
|
```
|
|
66
65
|
|
|
67
|
-
The CLI lets you manage your whole app
|
|
66
|
+
The CLI lets you manage your whole app's lifecycle
|
|
68
67
|
|
|
69
68
|
### 2. CLI Login
|
|
70
69
|
|
|
71
70
|
Authenticate with your Plash account:
|
|
72
71
|
|
|
73
|
-
```
|
|
72
|
+
```sh
|
|
74
73
|
plash-login
|
|
75
74
|
```
|
|
76
75
|
|
|
77
|
-
This command opens your browser to authenticate with your Plash account. After completing the login process, you
|
|
76
|
+
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.
|
|
78
77
|
|
|
79
|
-
Return to your terminal where you
|
|
78
|
+
Return to your terminal where you'll find the confirmation message:
|
|
80
79
|
|
|
81
|
-
> Authentication successful! Config saved to
|
|
80
|
+
> Authentication successful! Config saved to /plash\_config.json
|
|
82
81
|
|
|
83
82
|
#### Alternative Authentication Methods
|
|
84
83
|
|
|
85
|
-
If you
|
|
84
|
+
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
85
|
|
|
87
86
|
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
87
|
|
|
@@ -92,7 +91,7 @@ For automated environments like CI/CD pipelines or scripts, you can set the `PLA
|
|
|
92
91
|
|
|
93
92
|
Create a new directory for your first app:
|
|
94
93
|
|
|
95
|
-
```
|
|
94
|
+
```python
|
|
96
95
|
%%bash
|
|
97
96
|
mkdir -p plash-tutorial
|
|
98
97
|
cd plash-tutorial
|
|
@@ -100,7 +99,7 @@ cd plash-tutorial
|
|
|
100
99
|
|
|
101
100
|
Next, create the `main.py` file:
|
|
102
101
|
|
|
103
|
-
```
|
|
102
|
+
```python
|
|
104
103
|
%%writefile main.py
|
|
105
104
|
from fasthtml.common import *
|
|
106
105
|
|
|
@@ -116,36 +115,37 @@ serve()
|
|
|
116
115
|
This is a basic [FastHTML](https://fastht.ml) app. Plash also supports other popular python frameworks.
|
|
117
116
|
|
|
118
117
|
> [!WARNING]
|
|
119
|
-
>
|
|
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.
|
|
118
|
+
> 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.
|
|
121
119
|
|
|
122
120
|
And create the `requirements.txt` file:
|
|
123
121
|
|
|
124
|
-
```
|
|
122
|
+
```python
|
|
125
123
|
%%writefile requirements.txt
|
|
126
124
|
python-fasthtml
|
|
127
125
|
```
|
|
128
126
|
|
|
129
127
|
### 4. Deploy your app
|
|
130
128
|
|
|
131
|
-
Now that you
|
|
129
|
+
Now that you've created your app files, you're ready to deploy! From your `plash-tutorial` directory, run: `plash-deploy`
|
|
132
130
|
|
|
133
131
|
This command will:
|
|
134
132
|
|
|
135
|
-
1.
|
|
136
|
-
2.
|
|
137
|
-
3.
|
|
133
|
+
1. Package your application files
|
|
134
|
+
2. Upload them to Plash's servers
|
|
135
|
+
3. Build and deploy your application
|
|
138
136
|
|
|
139
|
-
```
|
|
137
|
+
```python
|
|
140
138
|
%%bash
|
|
141
139
|
plash-deploy
|
|
142
140
|
```
|
|
143
141
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
142
|
+
```output
|
|
143
|
+
Initializing deployment...
|
|
144
|
+
✅ Upload complete! Your app is currently being built.
|
|
145
|
+
It will be live at https://example-app.pla.sh
|
|
146
|
+
```
|
|
147
147
|
|
|
148
|
-
**Note:** You
|
|
148
|
+
**Note:** You'll see a different url that has been randomly generated for your app.
|
|
149
149
|
|
|
150
150
|
### 5. View your app
|
|
151
151
|
|
|
@@ -153,24 +153,24 @@ Your app should be ready a couple of seconds after running the deploy command.
|
|
|
153
153
|
|
|
154
154
|
Once your app is ready, you can:
|
|
155
155
|
|
|
156
|
-
1.
|
|
157
|
-
2.
|
|
156
|
+
1. Open the provided URL in your browser, or
|
|
157
|
+
2. Use the convenient plash-view command to open it automatically:
|
|
158
158
|
|
|
159
|
-
```
|
|
159
|
+
```sh
|
|
160
160
|
plash-view
|
|
161
161
|
```
|
|
162
162
|
|
|
163
|
-
When you visit that page you should see
|
|
163
|
+
When you visit that page you should see "Hello, World!"
|
|
164
164
|
|
|
165
165
|
🎉 Congratulations! You deployed your first app on Plash!
|
|
166
166
|
|
|
167
167
|
## Where to go from here
|
|
168
168
|
|
|
169
|
-
Learn more about what Plash has to offer in the rest of the docs at:
|
|
169
|
+
Learn more about what Plash has to offer in the rest of the docs at: [https://docs.pla.sh](https://docs.pla.sh)
|
|
170
170
|
|
|
171
|
-
To learn more about creating web apps with FastHTML, we recommend looking at the official docs at:
|
|
171
|
+
To learn more about creating web apps with FastHTML, we recommend looking at the official docs at: [https://fastht.ml/docs/](https://fastht.ml/docs/). In particular, we recommend the following:
|
|
172
172
|
|
|
173
|
-
1.
|
|
174
|
-
2.
|
|
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.
|
|
175
175
|
|
|
176
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,15 +1,15 @@
|
|
|
1
1
|
# Plash
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
|
|
3
|
+
Deploy your python apps in seconds. Fast, reliable, and effortless hosting for developers who want to focus on building, not deploying.
|
|
5
4
|
|
|
6
5
|
> [!WARNING]
|
|
7
|
-
>
|
|
8
6
|
> 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
7
|
|
|
8
|
+
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
|
|
9
|
+
|
|
10
10
|
## What is Plash
|
|
11
11
|
|
|
12
|
-
Plash is a next-generation deployment platform for fast, hassle-free Python application hosting. It
|
|
12
|
+
Plash is a next-generation deployment platform for fast, hassle-free Python application hosting. It's designed to be:
|
|
13
13
|
|
|
14
14
|
- **Simple and streamlined** - deploy your applications with minimal configuration
|
|
15
15
|
- **Developer-focused** - built for coders, not cloud engineers
|
|
@@ -17,45 +17,44 @@ Plash is a next-generation deployment platform for fast, hassle-free Python appl
|
|
|
17
17
|
|
|
18
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
19
|
|
|
20
|
-
Whether you
|
|
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
21
|
|
|
22
22
|
## Tutorial: deploy your first app
|
|
23
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.
|
|
24
|
+
In this tutorial you will learn how to deploy your first app. This tutorial will explore the basics of using Plash and help you get familiar with it at a high level.
|
|
26
25
|
|
|
27
26
|
**Prerequisites:**
|
|
28
27
|
|
|
29
|
-
- A registered account at
|
|
28
|
+
- A registered account at [https://pla.sh](https://pla.sh)
|
|
30
29
|
- Basic terminal / command line skills
|
|
31
30
|
|
|
32
31
|
### 1. Installation
|
|
33
32
|
|
|
34
33
|
Install Plash comandline interface (CLI) with pip:
|
|
35
34
|
|
|
36
|
-
```
|
|
35
|
+
```sh
|
|
37
36
|
pip install plash-cli
|
|
38
37
|
```
|
|
39
38
|
|
|
40
|
-
The CLI lets you manage your whole app
|
|
39
|
+
The CLI lets you manage your whole app's lifecycle
|
|
41
40
|
|
|
42
41
|
### 2. CLI Login
|
|
43
42
|
|
|
44
43
|
Authenticate with your Plash account:
|
|
45
44
|
|
|
46
|
-
```
|
|
45
|
+
```sh
|
|
47
46
|
plash-login
|
|
48
47
|
```
|
|
49
48
|
|
|
50
|
-
This command opens your browser to authenticate with your Plash account. After completing the login process, you
|
|
49
|
+
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
50
|
|
|
52
|
-
Return to your terminal where you
|
|
51
|
+
Return to your terminal where you'll find the confirmation message:
|
|
53
52
|
|
|
54
|
-
> Authentication successful! Config saved to
|
|
53
|
+
> Authentication successful! Config saved to /plash\_config.json
|
|
55
54
|
|
|
56
55
|
#### Alternative Authentication Methods
|
|
57
56
|
|
|
58
|
-
If you
|
|
57
|
+
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
58
|
|
|
60
59
|
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
60
|
|
|
@@ -65,7 +64,7 @@ For automated environments like CI/CD pipelines or scripts, you can set the `PLA
|
|
|
65
64
|
|
|
66
65
|
Create a new directory for your first app:
|
|
67
66
|
|
|
68
|
-
```
|
|
67
|
+
```python
|
|
69
68
|
%%bash
|
|
70
69
|
mkdir -p plash-tutorial
|
|
71
70
|
cd plash-tutorial
|
|
@@ -73,7 +72,7 @@ cd plash-tutorial
|
|
|
73
72
|
|
|
74
73
|
Next, create the `main.py` file:
|
|
75
74
|
|
|
76
|
-
```
|
|
75
|
+
```python
|
|
77
76
|
%%writefile main.py
|
|
78
77
|
from fasthtml.common import *
|
|
79
78
|
|
|
@@ -89,36 +88,37 @@ serve()
|
|
|
89
88
|
This is a basic [FastHTML](https://fastht.ml) app. Plash also supports other popular python frameworks.
|
|
90
89
|
|
|
91
90
|
> [!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.
|
|
91
|
+
> 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
92
|
|
|
95
93
|
And create the `requirements.txt` file:
|
|
96
94
|
|
|
97
|
-
```
|
|
95
|
+
```python
|
|
98
96
|
%%writefile requirements.txt
|
|
99
97
|
python-fasthtml
|
|
100
98
|
```
|
|
101
99
|
|
|
102
100
|
### 4. Deploy your app
|
|
103
101
|
|
|
104
|
-
Now that you
|
|
102
|
+
Now that you've created your app files, you're ready to deploy! From your `plash-tutorial` directory, run: `plash-deploy`
|
|
105
103
|
|
|
106
104
|
This command will:
|
|
107
105
|
|
|
108
|
-
1.
|
|
109
|
-
2.
|
|
110
|
-
3.
|
|
106
|
+
1. Package your application files
|
|
107
|
+
2. Upload them to Plash's servers
|
|
108
|
+
3. Build and deploy your application
|
|
111
109
|
|
|
112
|
-
```
|
|
110
|
+
```python
|
|
113
111
|
%%bash
|
|
114
112
|
plash-deploy
|
|
115
113
|
```
|
|
116
114
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
```output
|
|
116
|
+
Initializing deployment...
|
|
117
|
+
✅ Upload complete! Your app is currently being built.
|
|
118
|
+
It will be live at https://example-app.pla.sh
|
|
119
|
+
```
|
|
120
120
|
|
|
121
|
-
**Note:** You
|
|
121
|
+
**Note:** You'll see a different url that has been randomly generated for your app.
|
|
122
122
|
|
|
123
123
|
### 5. View your app
|
|
124
124
|
|
|
@@ -126,24 +126,24 @@ Your app should be ready a couple of seconds after running the deploy command.
|
|
|
126
126
|
|
|
127
127
|
Once your app is ready, you can:
|
|
128
128
|
|
|
129
|
-
1.
|
|
130
|
-
2.
|
|
129
|
+
1. Open the provided URL in your browser, or
|
|
130
|
+
2. Use the convenient plash-view command to open it automatically:
|
|
131
131
|
|
|
132
|
-
```
|
|
132
|
+
```sh
|
|
133
133
|
plash-view
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
-
When you visit that page you should see
|
|
136
|
+
When you visit that page you should see "Hello, World!"
|
|
137
137
|
|
|
138
138
|
🎉 Congratulations! You deployed your first app on Plash!
|
|
139
139
|
|
|
140
140
|
## Where to go from here
|
|
141
141
|
|
|
142
|
-
Learn more about what Plash has to offer in the rest of the docs at:
|
|
142
|
+
Learn more about what Plash has to offer in the rest of the docs at: [https://docs.pla.sh](https://docs.pla.sh)
|
|
143
143
|
|
|
144
|
-
To learn more about creating web apps with FastHTML, we recommend looking at the official docs at:
|
|
144
|
+
To learn more about creating web apps with FastHTML, we recommend looking at the official docs at: [https://fastht.ml/docs/](https://fastht.ml/docs/). In particular, we recommend the following:
|
|
145
145
|
|
|
146
|
-
1.
|
|
147
|
-
2.
|
|
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
148
|
|
|
149
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,3 @@
|
|
|
1
|
-
from IPython.core.magic import register_line_cell_magic
|
|
2
1
|
from bash_kernel.kernel import BashKernel
|
|
3
2
|
import re
|
|
4
3
|
from pathlib import Path
|
|
@@ -15,15 +14,17 @@ def interpolate_variables(text):
|
|
|
15
14
|
text = text.replace(match.group(0), str(ip.user_ns[varname]))
|
|
16
15
|
return text
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
def bash(line, cell=None):
|
|
17
|
+
def bash(line, cell=None):
|
|
20
18
|
code = f'{line}\n{cell}' if cell else line
|
|
21
19
|
code = interpolate_variables(code)
|
|
22
20
|
print(bk.bashwrapper.run_command(code))
|
|
23
21
|
|
|
24
|
-
@register_line_cell_magic
|
|
25
22
|
def writefile(line, cell):
|
|
26
23
|
cell = interpolate_variables(cell)
|
|
27
24
|
pwd = bk.bashwrapper.run_command('pwd').strip()
|
|
28
25
|
fpath = Path(pwd) / line
|
|
29
26
|
fpath.write_text(cell)
|
|
27
|
+
|
|
28
|
+
if ip:
|
|
29
|
+
ip.register_magic_function(bash, 'line_cell')
|
|
30
|
+
ip.register_magic_function(writefile, 'line_cell')
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Autogenerated by nbdev
|
|
2
|
+
|
|
3
|
+
d = { 'settings': { 'branch': 'main',
|
|
4
|
+
'lib_path': 'plash_cli',
|
|
5
|
+
'git_url': 'https://github.com/AnswerDotAI/plash_cli',
|
|
6
|
+
'doc_host': 'https://AnswerDotAI.github.io',
|
|
7
|
+
'doc_baseurl': '/plash_cli'},
|
|
8
|
+
'syms': { 'plash_cli.auth': { 'plash_cli.auth._signin_url': ('reference/auth.html#_signin_url', 'plash_cli/auth.py'),
|
|
9
|
+
'plash_cli.auth.mk_signin_url': ('reference/auth.html#mk_signin_url', 'plash_cli/auth.py'),
|
|
10
|
+
'plash_cli.auth._parse_jwt': ('reference/auth.html#_parse_jwt', 'plash_cli/auth.py'),
|
|
11
|
+
'plash_cli.auth.PlashAuthError': ('reference/auth.html#plashautherror', 'plash_cli/auth.py'),
|
|
12
|
+
'plash_cli.auth.goog_id_from_signin_reply': ( 'reference/auth.html#goog_id_from_signin_reply',
|
|
13
|
+
'plash_cli/auth.py')},
|
|
14
|
+
'plash_cli.cli': { 'plash_cli.cli._get_client': ('reference/cli.html#_get_client', 'plash_cli/cli.py'),
|
|
15
|
+
'plash_cli.cli._mk_auth_req': ('reference/cli.html#_mk_auth_req', 'plash_cli/cli.py'),
|
|
16
|
+
'plash_cli.cli._get_app_name': ('reference/cli.html#_get_app_name', 'plash_cli/cli.py'),
|
|
17
|
+
'plash_cli.cli._prep': ('reference/cli.html#_prep', 'plash_cli/cli.py'),
|
|
18
|
+
'plash_cli.cli._endpoint': ('reference/cli.html#_endpoint', 'plash_cli/cli.py'),
|
|
19
|
+
'plash_cli.cli._is_included': ('reference/cli.html#_is_included', 'plash_cli/cli.py'),
|
|
20
|
+
'plash_cli.cli.PlashError': ('reference/cli.html#plasherror', 'plash_cli/cli.py'),
|
|
21
|
+
'plash_cli.cli._poll_cookies': ('reference/cli.html#_poll_cookies', 'plash_cli/cli.py'),
|
|
22
|
+
'plash_cli.cli.login': ('reference/cli.html#login', 'plash_cli/cli.py'),
|
|
23
|
+
'plash_cli.cli._deps': ('reference/cli.html#_deps', 'plash_cli/cli.py'),
|
|
24
|
+
'plash_cli.cli._validate_app': ('reference/cli.html#_validate_app', 'plash_cli/cli.py'),
|
|
25
|
+
'plash_cli.cli.create_tar_archive': ('reference/cli.html#create_tar_archive', 'plash_cli/cli.py'),
|
|
26
|
+
'plash_cli.cli.deploy': ('reference/cli.html#deploy', 'plash_cli/cli.py'),
|
|
27
|
+
'plash_cli.cli._deploy': ('reference/cli.html#_deploy', 'plash_cli/cli.py'),
|
|
28
|
+
'plash_cli.cli.view': ('reference/cli.html#view', 'plash_cli/cli.py'),
|
|
29
|
+
'plash_cli.cli.delete_app': ('reference/cli.html#delete_app', 'plash_cli/cli.py'),
|
|
30
|
+
'plash_cli.cli._delete': ('reference/cli.html#_delete', 'plash_cli/cli.py'),
|
|
31
|
+
'plash_cli.cli.start_app': ('reference/cli.html#start_app', 'plash_cli/cli.py'),
|
|
32
|
+
'plash_cli.cli._start': ('reference/cli.html#_start', 'plash_cli/cli.py'),
|
|
33
|
+
'plash_cli.cli.stop_app': ('reference/cli.html#stop_app', 'plash_cli/cli.py'),
|
|
34
|
+
'plash_cli.cli._stop': ('reference/cli.html#_stop', 'plash_cli/cli.py'),
|
|
35
|
+
'plash_cli.cli.logs': ('reference/cli.html#logs', 'plash_cli/cli.py'),
|
|
36
|
+
'plash_cli.cli._logs': ('reference/cli.html#_logs', 'plash_cli/cli.py'),
|
|
37
|
+
'plash_cli.cli.Path._is_dir_empty': ('reference/cli.html#path._is_dir_empty', 'plash_cli/cli.py'),
|
|
38
|
+
'plash_cli.cli.download_app': ('reference/cli.html#download_app', 'plash_cli/cli.py'),
|
|
39
|
+
'plash_cli.cli._download': ('reference/cli.html#_download', 'plash_cli/cli.py'),
|
|
40
|
+
'plash_cli.cli.app_list': ('reference/cli.html#app_list', 'plash_cli/cli.py'),
|
|
41
|
+
'plash_cli.cli._app_list': ('reference/cli.html#_app_list', 'plash_cli/cli.py'),
|
|
42
|
+
'plash_cli.cli.plash_tool_info': ('reference/cli.html#plash_tool_info', 'plash_cli/cli.py')}}}
|
|
43
|
+
|
|
44
|
+
docs = { 'How To': [ ( 'Add Environment Variables',
|
|
45
|
+
'how_to/env_vars.md',
|
|
46
|
+
'Use environment variables to configure your app without changing code. Perfect for secrets, API keys, '
|
|
47
|
+
'and other configuration values.'),
|
|
48
|
+
( 'Add Dependencies',
|
|
49
|
+
'how_to/add_dependencies.md',
|
|
50
|
+
'How to add python and non-python dependencies to your app'),
|
|
51
|
+
('Add Custom Domains', 'how_to/add_custom_domain.md', 'How to add custom domains'),
|
|
52
|
+
('Restore backups', 'how_to/restore_backups.md', "How to restore your app's data"),
|
|
53
|
+
('Auth', 'how_to/auth.md', 'Add Google sign-in to a Plash app')],
|
|
54
|
+
'Explanations': [ ( 'Docker Caching',
|
|
55
|
+
'explains/docker_caching.md',
|
|
56
|
+
'Understanding how our Dockerfile structure is designed to save you valuable development time'),
|
|
57
|
+
('Data Storage', 'explains/data_storage.md', 'Explainer on how Plash deals with data storage'),
|
|
58
|
+
( 'Usage-Based Billing',
|
|
59
|
+
'explains/usage_billing.md',
|
|
60
|
+
'Plash charges you only for the resources your applications actually consume.')],
|
|
61
|
+
'Reference': ['plash_cli.cli', 'plash_cli.auth']}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
"""Client side logic to add Plash Auth to your app
|
|
2
2
|
|
|
3
|
-
Docs: https://AnswerDotAI.github.io/plash_cli/auth.
|
|
3
|
+
Docs: https://AnswerDotAI.github.io/plash_cli/reference/auth.md"""
|
|
4
4
|
|
|
5
|
-
# AUTOGENERATED! DO NOT EDIT! File to edit: ../
|
|
5
|
+
# AUTOGENERATED! DO NOT EDIT! File to edit: ../ship/reference/01_auth.ipynb.
|
|
6
6
|
|
|
7
7
|
# %% auto #0
|
|
8
8
|
__all__ = ['signin_completed_rt', 'mk_signin_url', 'PlashAuthError', 'goog_id_from_signin_reply']
|
|
9
9
|
|
|
10
|
-
# %%
|
|
11
|
-
import
|
|
10
|
+
# %% #c6aa552a
|
|
11
|
+
import httpx2,os,jwt
|
|
12
12
|
from pathlib import Path
|
|
13
13
|
from warnings import warn
|
|
14
14
|
|
|
15
15
|
from . import __version__
|
|
16
16
|
|
|
17
|
-
# %%
|
|
17
|
+
# %% #d3504f51
|
|
18
18
|
_in_prod = os.getenv('PLASH_PRODUCTION', '') == '1'
|
|
19
19
|
|
|
20
|
-
# %%
|
|
20
|
+
# %% #e6590075
|
|
21
21
|
def _signin_url(email_re: str=None, hd_re: str=None):
|
|
22
|
-
res =
|
|
22
|
+
res = httpx2.post(os.environ['PLASH_AUTH_URL'], json=dict(email_re=email_re, hd_re=hd_re),
|
|
23
23
|
auth=(os.environ['PLASH_APP_ID'], os.environ['PLASH_APP_SECRET']),
|
|
24
24
|
headers={'X-PLASH-AUTH-VERSION': __version__}).raise_for_status().json()
|
|
25
25
|
if "warning" in res: warn(res.pop('warning'))
|
|
26
26
|
return res
|
|
27
27
|
|
|
28
|
-
# %%
|
|
28
|
+
# %% #4b15411c
|
|
29
29
|
signin_completed_rt = "/signin_completed"
|
|
30
30
|
|
|
31
|
-
# %%
|
|
31
|
+
# %% #74a0a24d
|
|
32
32
|
def mk_signin_url(
|
|
33
33
|
session: dict, # Session dictionary
|
|
34
34
|
email_re: str=None, # Regex filter for allowed email addresses
|
|
@@ -40,7 +40,7 @@ def mk_signin_url(
|
|
|
40
40
|
session['req_id'] = res['req_id']
|
|
41
41
|
return res['plash_signin_url']
|
|
42
42
|
|
|
43
|
-
# %%
|
|
43
|
+
# %% #8e66bb6e
|
|
44
44
|
def _parse_jwt(reply: str) -> dict:
|
|
45
45
|
"Parse JWT reply and return decoded claims or error info"
|
|
46
46
|
try: decoded = jwt.decode(reply, key=open(Path(__file__).parent / "assets" / "es256_public_key.pem","rb").read(), algorithms=["ES256"],
|
|
@@ -48,12 +48,12 @@ def _parse_jwt(reply: str) -> dict:
|
|
|
48
48
|
except Exception as e: return dict(req_id=None, sub=None, err=f'JWT validation failed: {e}')
|
|
49
49
|
return dict(req_id=decoded.get('req_id'), sub=decoded.get('sub'), err=decoded.get('err'))
|
|
50
50
|
|
|
51
|
-
# %%
|
|
51
|
+
# %% #0e61fbdd
|
|
52
52
|
class PlashAuthError(Exception):
|
|
53
53
|
"""Raised when Plash authentication fails"""
|
|
54
54
|
pass
|
|
55
55
|
|
|
56
|
-
# %%
|
|
56
|
+
# %% #a311ce9a
|
|
57
57
|
def goog_id_from_signin_reply(
|
|
58
58
|
session: dict, # Session dictionary containing 'req_id'
|
|
59
59
|
reply: str # The JWT reply string from Plash after Google authentication
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"""The Plash CLI tool
|
|
2
2
|
|
|
3
|
-
Docs: https://AnswerDotAI.github.io/plash_cli/cli.
|
|
3
|
+
Docs: https://AnswerDotAI.github.io/plash_cli/reference/cli.md"""
|
|
4
4
|
|
|
5
|
-
# AUTOGENERATED! DO NOT EDIT! File to edit: ../
|
|
5
|
+
# AUTOGENERATED! DO NOT EDIT! File to edit: ../ship/reference/00_cli.ipynb.
|
|
6
6
|
|
|
7
7
|
# %% auto #0
|
|
8
8
|
__all__ = ['PLASH_CONFIG_HOME', 'PLASH_DOMAIN', 'pat', 'log_modes', 'PlashError', 'login', 'create_tar_archive', 'deploy', 'view',
|
|
9
9
|
'delete_app', 'start_app', 'stop_app', 'logs', 'download_app', 'app_list', 'plash_tool_info']
|
|
10
10
|
|
|
11
|
-
# %%
|
|
11
|
+
# %% #702c219c
|
|
12
12
|
from fastcore.all import *
|
|
13
13
|
from fastcore.xdg import *
|
|
14
14
|
import secrets, webbrowser, httpx2, io, tarfile, random, string
|
|
@@ -19,11 +19,11 @@ import io, os, re, tarfile
|
|
|
19
19
|
|
|
20
20
|
from . import __version__
|
|
21
21
|
|
|
22
|
-
# %%
|
|
22
|
+
# %% #2fc99aa4
|
|
23
23
|
PLASH_CONFIG_HOME = xdg_config_home() / 'plash_config.json'
|
|
24
24
|
PLASH_DOMAIN = os.getenv("PLASH_DOMAIN","pla.sh") # pla.sh plash-dev.answer.ai localhost:5002
|
|
25
25
|
|
|
26
|
-
# %%
|
|
26
|
+
# %% #1de1e2b3
|
|
27
27
|
def _get_client(cfg=PLASH_CONFIG_HOME):
|
|
28
28
|
client = httpx2.Client()
|
|
29
29
|
if tok := os.getenv("PLASH_TOKEN"): cookies = {"session_": tok}
|
|
@@ -33,14 +33,15 @@ def _get_client(cfg=PLASH_CONFIG_HOME):
|
|
|
33
33
|
client.headers.update({'X-PLASH': 'true', 'User-Agent': f'plash_cli/{__version__}'})
|
|
34
34
|
return client
|
|
35
35
|
|
|
36
|
-
# %%
|
|
36
|
+
# %% #47d01e47
|
|
37
37
|
def _mk_auth_req(url:str, method:str='get', timeout=300., **kwargs):
|
|
38
38
|
r = getattr(_get_client(), method)(url, timeout=timeout, **kwargs)
|
|
39
39
|
if r.status_code == 200: return r
|
|
40
|
-
msg = r.headers.get('X-Plash-Error') or r.text.strip()
|
|
41
|
-
|
|
40
|
+
msg = r.headers.get('X-Plash-Error') or r.text.strip()
|
|
41
|
+
if not msg and r.status_code == 303: msg = 'Not authenticated. Run plash-login and retry.'
|
|
42
|
+
raise PlashError(msg or f'HTTP {r.status_code}')
|
|
42
43
|
|
|
43
|
-
# %%
|
|
44
|
+
# %% #7edae5c8
|
|
44
45
|
def _get_app_name(path:Path):
|
|
45
46
|
plash_app = Path(path) / '.plash'
|
|
46
47
|
if not plash_app.exists(): raise FileNotFoundError(f"File not found: {plash_app=}")
|
|
@@ -52,15 +53,15 @@ def _get_app_name(path:Path):
|
|
|
52
53
|
raise RuntimeError(f"{plash_app=} did not have a PLASH_APP_NAME")
|
|
53
54
|
|
|
54
55
|
|
|
55
|
-
# %%
|
|
56
|
+
# %% #b607f7a9
|
|
56
57
|
def _prep(path,name): return name if name else _get_app_name(Path(path))
|
|
57
58
|
|
|
58
|
-
# %%
|
|
59
|
+
# %% #acaf42cf
|
|
59
60
|
def _endpoint(sub='', rt=''):
|
|
60
61
|
p = "http" if "localhost" in PLASH_DOMAIN else "https"
|
|
61
62
|
return f"{p}://{sub}{'.' if sub else ''}{PLASH_DOMAIN}{rt}"
|
|
62
63
|
|
|
63
|
-
# %%
|
|
64
|
+
# %% #d1638ced
|
|
64
65
|
def _is_included(path):
|
|
65
66
|
"Returns True if path should be included in deployment"
|
|
66
67
|
if path.name.startswith('.'): return False
|
|
@@ -70,10 +71,10 @@ def _is_included(path):
|
|
|
70
71
|
'.vscode', '.idea', '.sesskey'}
|
|
71
72
|
return not any(p in excludes for p in path.parts)
|
|
72
73
|
|
|
73
|
-
# %%
|
|
74
|
+
# %% #a20045ed
|
|
74
75
|
class PlashError(Exception): pass
|
|
75
76
|
|
|
76
|
-
# %%
|
|
77
|
+
# %% #b7d4028e
|
|
77
78
|
def _poll_cookies(paircode, interval=1, timeout=180):
|
|
78
79
|
"Poll server for token until received or timeout"
|
|
79
80
|
start = time()
|
|
@@ -84,7 +85,7 @@ def _poll_cookies(paircode, interval=1, timeout=180):
|
|
|
84
85
|
if resp.text.strip(): return dict(client.cookies)
|
|
85
86
|
sleep(interval)
|
|
86
87
|
|
|
87
|
-
# %%
|
|
88
|
+
# %% #eadaa5df
|
|
88
89
|
@call_parse
|
|
89
90
|
def login(
|
|
90
91
|
token:str=None, # Token to save directly to config
|
|
@@ -108,7 +109,7 @@ def login(
|
|
|
108
109
|
print(f"Authentication successful! Config saved to {PLASH_CONFIG_HOME}")
|
|
109
110
|
else: print("Authentication timed out.")
|
|
110
111
|
|
|
111
|
-
# %%
|
|
112
|
+
# %% #d52c060e
|
|
112
113
|
pat = r'(?m)^# /// (?P<type>[a-zA-Z0-9-]+)$\s(?P<content>(^#(| .*)$\s)+)^# ///$'
|
|
113
114
|
|
|
114
115
|
def _deps(script: bytes | str):
|
|
@@ -124,7 +125,7 @@ def _deps(script: bytes | str):
|
|
|
124
125
|
return '\n'.join(tomllib.loads(content)['dependencies'])
|
|
125
126
|
else: return None
|
|
126
127
|
|
|
127
|
-
# %%
|
|
128
|
+
# %% #3747912c
|
|
128
129
|
def _validate_app(path):
|
|
129
130
|
"Validates directory `path` is a deployable Plash app"
|
|
130
131
|
if not (path / 'main.py').exists():
|
|
@@ -133,7 +134,7 @@ def _validate_app(path):
|
|
|
133
134
|
if deps and (path/"requirements.txt").exists():
|
|
134
135
|
raise PlashError('A Plash app should not contain both a requirements.txt file and inline dependencies (see PEP723).')
|
|
135
136
|
|
|
136
|
-
# %%
|
|
137
|
+
# %% #ee0a7f14
|
|
137
138
|
def create_tar_archive(path:Path, force_data:bool=False) -> tuple[io.BytesIO, int]:
|
|
138
139
|
"Creates a tar archive of a directory, excluding files based on is_included"
|
|
139
140
|
tarz = io.BytesIO()
|
|
@@ -148,17 +149,14 @@ def create_tar_archive(path:Path, force_data:bool=False) -> tuple[io.BytesIO, in
|
|
|
148
149
|
tarz.seek(0)
|
|
149
150
|
return tarz, len(files)
|
|
150
151
|
|
|
151
|
-
# %%
|
|
152
|
+
# %% #2f2a6e00
|
|
152
153
|
def deploy(
|
|
153
154
|
path:Path='.', # Path to project
|
|
154
155
|
name:str=None, # Overrides the .plash file in project root if provided
|
|
155
156
|
_force_data:bool=False # Overwrite data/ directory during deployment
|
|
156
157
|
):
|
|
157
158
|
"""
|
|
158
|
-
Deploys app to production. By default, this command erases all files in your app which are not in data/.
|
|
159
|
-
Then uploads all files and folders, except paths starting with `.` and except the local data/ directory.
|
|
160
|
-
If `force_data` is used, then it erases all files in production. Then it uploads all files and folders,
|
|
161
|
-
including `data/`, except paths starting with `.`.
|
|
159
|
+
Deploys app to production. By default, this command erases all files in your app which are not in data/. Then uploads all files and folders, except paths starting with `.` and except the local data/ directory. If `force_data` is used, then it erases all files in production. Then it uploads all files and folders, including `data/`, except paths starting with `.`.
|
|
162
160
|
"""
|
|
163
161
|
path = Path(path)
|
|
164
162
|
if name == '': raise PlashError('App name cannot be an empty string')
|
|
@@ -176,7 +174,7 @@ def deploy(
|
|
|
176
174
|
_mk_auth_req(_endpoint(rt="/upload"), "post", files={'file': tarz}, data={'name': name, 'force_data': _force_data})
|
|
177
175
|
return name if "." in name else _endpoint(sub=name)
|
|
178
176
|
|
|
179
|
-
# %%
|
|
177
|
+
# %% #59d06b03
|
|
180
178
|
@call_parse
|
|
181
179
|
def _deploy(
|
|
182
180
|
path:Path='.', # Path to project
|
|
@@ -190,7 +188,7 @@ def _deploy(
|
|
|
190
188
|
f'It will be live at {res}')
|
|
191
189
|
_deploy.__doc__ = deploy.__doc__
|
|
192
190
|
|
|
193
|
-
# %%
|
|
191
|
+
# %% #75f7d1ab
|
|
194
192
|
@call_parse
|
|
195
193
|
def view(
|
|
196
194
|
path:Path='.', # Path to project directory
|
|
@@ -202,7 +200,7 @@ def view(
|
|
|
202
200
|
print(f"Opening browser to view app :\n{url}\n")
|
|
203
201
|
webbrowser.open(url)
|
|
204
202
|
|
|
205
|
-
# %%
|
|
203
|
+
# %% #43535aef
|
|
206
204
|
def delete_app(
|
|
207
205
|
path:Path='.', # Path to project
|
|
208
206
|
name:str=None # Overrides the .plash file in project root if provided
|
|
@@ -226,7 +224,7 @@ def _delete(
|
|
|
226
224
|
except PlashError as e: raise CliError(str(e))
|
|
227
225
|
_delete.__doc__ = delete_app.__doc__
|
|
228
226
|
|
|
229
|
-
# %%
|
|
227
|
+
# %% #d72ccd37
|
|
230
228
|
def start_app(
|
|
231
229
|
path:Path='.', # Path to project
|
|
232
230
|
name:str=None # Overrides the .plash file in project root if provided
|
|
@@ -243,7 +241,7 @@ def _start(**kwargs):
|
|
|
243
241
|
except PlashError as e: raise CliError(str(e))
|
|
244
242
|
_start.__doc__ = start_app.__doc__
|
|
245
243
|
|
|
246
|
-
# %%
|
|
244
|
+
# %% #ace91510
|
|
247
245
|
def stop_app(
|
|
248
246
|
path:Path='.', # Path to project
|
|
249
247
|
name:str=None # Overrides the .plash file in project root if provided
|
|
@@ -260,10 +258,10 @@ def _stop(**kwargs):
|
|
|
260
258
|
except PlashError as e: raise CliError(str(e))
|
|
261
259
|
_stop.__doc__ = stop_app.__doc__
|
|
262
260
|
|
|
263
|
-
# %%
|
|
261
|
+
# %% #24e62f1f
|
|
264
262
|
log_modes = str_enum('log_modes', 'build', 'app')
|
|
265
263
|
|
|
266
|
-
# %%
|
|
264
|
+
# %% #4c1597b9
|
|
267
265
|
def logs(
|
|
268
266
|
path:Path='.', # Path to project
|
|
269
267
|
name:str=None, # Overrides the .plash file in project root if provided
|
|
@@ -294,11 +292,11 @@ def _logs(
|
|
|
294
292
|
except PlashError as e: raise CliError(str(e))
|
|
295
293
|
_logs.__doc__ = logs.__doc__
|
|
296
294
|
|
|
297
|
-
# %%
|
|
295
|
+
# %% #f8441125
|
|
298
296
|
@patch
|
|
299
297
|
def _is_dir_empty(self:Path): return next(self.iterdir(), None) is None
|
|
300
298
|
|
|
301
|
-
# %%
|
|
299
|
+
# %% #1c057f57
|
|
302
300
|
def download_app(
|
|
303
301
|
path:Path='.', # Path to project
|
|
304
302
|
name:str=None, # Overrides the .plash file in project root if provided
|
|
@@ -321,7 +319,7 @@ def _download(**kwargs):
|
|
|
321
319
|
except PlashError as e: raise CliError(str(e))
|
|
322
320
|
_download.__doc__ = download_app.__doc__
|
|
323
321
|
|
|
324
|
-
# %%
|
|
322
|
+
# %% #8378e31d
|
|
325
323
|
def app_list():
|
|
326
324
|
"List your deployed apps"
|
|
327
325
|
r = _mk_auth_req(_endpoint(rt="/user_apps"))
|
|
@@ -335,7 +333,7 @@ def _app_list(verbose:bool=False): # Whether to show running status as well as n
|
|
|
335
333
|
for a in res: print(f"{a['running']} {a['name']}" if verbose else a['name'])
|
|
336
334
|
_app_list.__doc__ = app_list.__doc__
|
|
337
335
|
|
|
338
|
-
# %%
|
|
336
|
+
# %% #6ff07c8d
|
|
339
337
|
def plash_tool_info():
|
|
340
338
|
from dialoghelper import add_msg
|
|
341
339
|
add_msg('Plash tools: &`[login, deploy, start_app, stop_app, logs, download_app, app_list]`')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: plash_cli
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.16
|
|
4
4
|
Summary: CLI for the Plash hosting service
|
|
5
5
|
Author-email: Jeremy Howard <info@fast.ai>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -12,7 +12,7 @@ Classifier: Intended Audience :: Developers
|
|
|
12
12
|
Classifier: Development Status :: 3 - Alpha
|
|
13
13
|
Classifier: Programming Language :: Python :: 3
|
|
14
14
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
-
Requires-Python: >=3.
|
|
15
|
+
Requires-Python: >=3.11
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
License-File: LICENSE
|
|
18
18
|
Requires-Dist: fastcore>=2.2.20
|
|
@@ -22,21 +22,21 @@ Requires-Dist: pyjwt
|
|
|
22
22
|
Requires-Dist: cryptography
|
|
23
23
|
Provides-Extra: dev
|
|
24
24
|
Requires-Dist: bash_kernel; extra == "dev"
|
|
25
|
-
Requires-Dist:
|
|
25
|
+
Requires-Dist: fastship; extra == "dev"
|
|
26
26
|
Dynamic: license-file
|
|
27
27
|
|
|
28
28
|
# Plash
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
|
|
30
|
+
Deploy your python apps in seconds. Fast, reliable, and effortless hosting for developers who want to focus on building, not deploying.
|
|
32
31
|
|
|
33
32
|
> [!WARNING]
|
|
34
|
-
>
|
|
35
33
|
> 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.
|
|
36
34
|
|
|
35
|
+
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
|
|
36
|
+
|
|
37
37
|
## What is Plash
|
|
38
38
|
|
|
39
|
-
Plash is a next-generation deployment platform for fast, hassle-free Python application hosting. It
|
|
39
|
+
Plash is a next-generation deployment platform for fast, hassle-free Python application hosting. It's designed to be:
|
|
40
40
|
|
|
41
41
|
- **Simple and streamlined** - deploy your applications with minimal configuration
|
|
42
42
|
- **Developer-focused** - built for coders, not cloud engineers
|
|
@@ -44,45 +44,44 @@ Plash is a next-generation deployment platform for fast, hassle-free Python appl
|
|
|
44
44
|
|
|
45
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.
|
|
46
46
|
|
|
47
|
-
Whether you
|
|
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.
|
|
48
48
|
|
|
49
49
|
## Tutorial: deploy your first app
|
|
50
50
|
|
|
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.
|
|
51
|
+
In this tutorial you will learn how to deploy your first app. This tutorial will explore the basics of using Plash and help you get familiar with it at a high level.
|
|
53
52
|
|
|
54
53
|
**Prerequisites:**
|
|
55
54
|
|
|
56
|
-
- A registered account at
|
|
55
|
+
- A registered account at [https://pla.sh](https://pla.sh)
|
|
57
56
|
- Basic terminal / command line skills
|
|
58
57
|
|
|
59
58
|
### 1. Installation
|
|
60
59
|
|
|
61
60
|
Install Plash comandline interface (CLI) with pip:
|
|
62
61
|
|
|
63
|
-
```
|
|
62
|
+
```sh
|
|
64
63
|
pip install plash-cli
|
|
65
64
|
```
|
|
66
65
|
|
|
67
|
-
The CLI lets you manage your whole app
|
|
66
|
+
The CLI lets you manage your whole app's lifecycle
|
|
68
67
|
|
|
69
68
|
### 2. CLI Login
|
|
70
69
|
|
|
71
70
|
Authenticate with your Plash account:
|
|
72
71
|
|
|
73
|
-
```
|
|
72
|
+
```sh
|
|
74
73
|
plash-login
|
|
75
74
|
```
|
|
76
75
|
|
|
77
|
-
This command opens your browser to authenticate with your Plash account. After completing the login process, you
|
|
76
|
+
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.
|
|
78
77
|
|
|
79
|
-
Return to your terminal where you
|
|
78
|
+
Return to your terminal where you'll find the confirmation message:
|
|
80
79
|
|
|
81
|
-
> Authentication successful! Config saved to
|
|
80
|
+
> Authentication successful! Config saved to /plash\_config.json
|
|
82
81
|
|
|
83
82
|
#### Alternative Authentication Methods
|
|
84
83
|
|
|
85
|
-
If you
|
|
84
|
+
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
85
|
|
|
87
86
|
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
87
|
|
|
@@ -92,7 +91,7 @@ For automated environments like CI/CD pipelines or scripts, you can set the `PLA
|
|
|
92
91
|
|
|
93
92
|
Create a new directory for your first app:
|
|
94
93
|
|
|
95
|
-
```
|
|
94
|
+
```python
|
|
96
95
|
%%bash
|
|
97
96
|
mkdir -p plash-tutorial
|
|
98
97
|
cd plash-tutorial
|
|
@@ -100,7 +99,7 @@ cd plash-tutorial
|
|
|
100
99
|
|
|
101
100
|
Next, create the `main.py` file:
|
|
102
101
|
|
|
103
|
-
```
|
|
102
|
+
```python
|
|
104
103
|
%%writefile main.py
|
|
105
104
|
from fasthtml.common import *
|
|
106
105
|
|
|
@@ -116,36 +115,37 @@ serve()
|
|
|
116
115
|
This is a basic [FastHTML](https://fastht.ml) app. Plash also supports other popular python frameworks.
|
|
117
116
|
|
|
118
117
|
> [!WARNING]
|
|
119
|
-
>
|
|
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.
|
|
118
|
+
> 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.
|
|
121
119
|
|
|
122
120
|
And create the `requirements.txt` file:
|
|
123
121
|
|
|
124
|
-
```
|
|
122
|
+
```python
|
|
125
123
|
%%writefile requirements.txt
|
|
126
124
|
python-fasthtml
|
|
127
125
|
```
|
|
128
126
|
|
|
129
127
|
### 4. Deploy your app
|
|
130
128
|
|
|
131
|
-
Now that you
|
|
129
|
+
Now that you've created your app files, you're ready to deploy! From your `plash-tutorial` directory, run: `plash-deploy`
|
|
132
130
|
|
|
133
131
|
This command will:
|
|
134
132
|
|
|
135
|
-
1.
|
|
136
|
-
2.
|
|
137
|
-
3.
|
|
133
|
+
1. Package your application files
|
|
134
|
+
2. Upload them to Plash's servers
|
|
135
|
+
3. Build and deploy your application
|
|
138
136
|
|
|
139
|
-
```
|
|
137
|
+
```python
|
|
140
138
|
%%bash
|
|
141
139
|
plash-deploy
|
|
142
140
|
```
|
|
143
141
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
142
|
+
```output
|
|
143
|
+
Initializing deployment...
|
|
144
|
+
✅ Upload complete! Your app is currently being built.
|
|
145
|
+
It will be live at https://example-app.pla.sh
|
|
146
|
+
```
|
|
147
147
|
|
|
148
|
-
**Note:** You
|
|
148
|
+
**Note:** You'll see a different url that has been randomly generated for your app.
|
|
149
149
|
|
|
150
150
|
### 5. View your app
|
|
151
151
|
|
|
@@ -153,24 +153,24 @@ Your app should be ready a couple of seconds after running the deploy command.
|
|
|
153
153
|
|
|
154
154
|
Once your app is ready, you can:
|
|
155
155
|
|
|
156
|
-
1.
|
|
157
|
-
2.
|
|
156
|
+
1. Open the provided URL in your browser, or
|
|
157
|
+
2. Use the convenient plash-view command to open it automatically:
|
|
158
158
|
|
|
159
|
-
```
|
|
159
|
+
```sh
|
|
160
160
|
plash-view
|
|
161
161
|
```
|
|
162
162
|
|
|
163
|
-
When you visit that page you should see
|
|
163
|
+
When you visit that page you should see "Hello, World!"
|
|
164
164
|
|
|
165
165
|
🎉 Congratulations! You deployed your first app on Plash!
|
|
166
166
|
|
|
167
167
|
## Where to go from here
|
|
168
168
|
|
|
169
|
-
Learn more about what Plash has to offer in the rest of the docs at:
|
|
169
|
+
Learn more about what Plash has to offer in the rest of the docs at: [https://docs.pla.sh](https://docs.pla.sh)
|
|
170
170
|
|
|
171
|
-
To learn more about creating web apps with FastHTML, we recommend looking at the official docs at:
|
|
171
|
+
To learn more about creating web apps with FastHTML, we recommend looking at the official docs at: [https://fastht.ml/docs/](https://fastht.ml/docs/). In particular, we recommend the following:
|
|
172
172
|
|
|
173
|
-
1.
|
|
174
|
-
2.
|
|
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.
|
|
175
175
|
|
|
176
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.
|
|
@@ -7,7 +7,7 @@ name = "plash_cli"
|
|
|
7
7
|
dynamic = ["version"]
|
|
8
8
|
description = "CLI for the Plash hosting service"
|
|
9
9
|
readme = "README.md"
|
|
10
|
-
requires-python = ">=3.
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
11
|
license = "Apache-2.0"
|
|
12
12
|
authors = [{name = "Jeremy Howard", email = "info@fast.ai"}]
|
|
13
13
|
keywords = ['nbdev', 'jupyter', 'notebook', 'python']
|
|
@@ -18,11 +18,11 @@ dependencies = ['fastcore>=2.2.20', 'httpx2', 'python-dotenv', 'pyjwt', 'cryptog
|
|
|
18
18
|
Repository = "https://github.com/AnswerDotAI/plash_cli"
|
|
19
19
|
Documentation = "https://AnswerDotAI.github.io/plash_cli"
|
|
20
20
|
|
|
21
|
-
[project.entry-points.nbdev]
|
|
22
|
-
plash_cli = "plash_cli._modidx:d"
|
|
23
21
|
|
|
22
|
+
[project.entry-points.fastship]
|
|
23
|
+
plash_cli = "plash_cli._modidx:d"
|
|
24
24
|
[project.optional-dependencies]
|
|
25
|
-
dev = ['bash_kernel', '
|
|
25
|
+
dev = ['bash_kernel', 'fastship']
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
[project.scripts]
|
|
@@ -42,10 +42,38 @@ version = {attr = "plash_cli.__version__"}
|
|
|
42
42
|
[tool.setuptools.packages.find]
|
|
43
43
|
include = ["plash_cli"]
|
|
44
44
|
|
|
45
|
-
[tool.nbdev]
|
|
46
|
-
allowed_metadata_keys = ['solveit']
|
|
47
|
-
allowed_cell_metadata_keys = ['solveit_ai']
|
|
48
|
-
custom_sidebar = false
|
|
49
|
-
|
|
50
45
|
[tool.chkstyle]
|
|
51
46
|
skip_paths = ["_modidx.py"]
|
|
47
|
+
|
|
48
|
+
[tool.fastship]
|
|
49
|
+
to-meta = ["export"]
|
|
50
|
+
allowed-metadata-keys = ['solveit']
|
|
51
|
+
allowed-cell-metadata-keys = ['solveit_ai']
|
|
52
|
+
math = "dollars"
|
|
53
|
+
title = "plash_cli"
|
|
54
|
+
site-url = "https://AnswerDotAI.github.io/plash_cli"
|
|
55
|
+
favicon = "favicon.ico"
|
|
56
|
+
description = "CLI for the Plash hosting service"
|
|
57
|
+
open-graph = true
|
|
58
|
+
toc = true
|
|
59
|
+
css = "styles.css"
|
|
60
|
+
logo = "logo.svg"
|
|
61
|
+
show-title = false
|
|
62
|
+
|
|
63
|
+
[[tool.fastship.nav-links]]
|
|
64
|
+
text = "Home"
|
|
65
|
+
href = "https://pla.sh"
|
|
66
|
+
|
|
67
|
+
[[tool.fastship.nav-links]]
|
|
68
|
+
text = "Docs"
|
|
69
|
+
href = "https://docs.pla.sh"
|
|
70
|
+
|
|
71
|
+
[[tool.fastship.tools]]
|
|
72
|
+
icon = "github"
|
|
73
|
+
href = "https://github.com/answerdotai/plash_cli"
|
|
74
|
+
label = "GitHub"
|
|
75
|
+
|
|
76
|
+
[[tool.fastship.tools]]
|
|
77
|
+
icon = "x"
|
|
78
|
+
href = "https://x.com/answerdotai"
|
|
79
|
+
label = "Answer.ai Twitter"
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# Autogenerated by nbdev
|
|
2
|
-
|
|
3
|
-
d = { 'settings': { 'branch': 'main',
|
|
4
|
-
'doc_baseurl': '/plash_cli',
|
|
5
|
-
'doc_host': 'https://AnswerDotAI.github.io',
|
|
6
|
-
'git_url': 'https://github.com/AnswerDotAI/plash_cli',
|
|
7
|
-
'lib_path': 'plash_cli'},
|
|
8
|
-
'syms': { 'plash_cli.auth': { 'plash_cli.auth.PlashAuthError': ('auth.html#plashautherror', 'plash_cli/auth.py'),
|
|
9
|
-
'plash_cli.auth._parse_jwt': ('auth.html#_parse_jwt', 'plash_cli/auth.py'),
|
|
10
|
-
'plash_cli.auth._signin_url': ('auth.html#_signin_url', 'plash_cli/auth.py'),
|
|
11
|
-
'plash_cli.auth.goog_id_from_signin_reply': ('auth.html#goog_id_from_signin_reply', 'plash_cli/auth.py'),
|
|
12
|
-
'plash_cli.auth.mk_signin_url': ('auth.html#mk_signin_url', 'plash_cli/auth.py')},
|
|
13
|
-
'plash_cli.cli': { 'plash_cli.cli.Path._is_dir_empty': ('cli.html#path._is_dir_empty', 'plash_cli/cli.py'),
|
|
14
|
-
'plash_cli.cli.PlashError': ('cli.html#plasherror', 'plash_cli/cli.py'),
|
|
15
|
-
'plash_cli.cli._app_list': ('cli.html#_app_list', 'plash_cli/cli.py'),
|
|
16
|
-
'plash_cli.cli._delete': ('cli.html#_delete', 'plash_cli/cli.py'),
|
|
17
|
-
'plash_cli.cli._deploy': ('cli.html#_deploy', 'plash_cli/cli.py'),
|
|
18
|
-
'plash_cli.cli._deps': ('cli.html#_deps', 'plash_cli/cli.py'),
|
|
19
|
-
'plash_cli.cli._download': ('cli.html#_download', 'plash_cli/cli.py'),
|
|
20
|
-
'plash_cli.cli._endpoint': ('cli.html#_endpoint', 'plash_cli/cli.py'),
|
|
21
|
-
'plash_cli.cli._get_app_name': ('cli.html#_get_app_name', 'plash_cli/cli.py'),
|
|
22
|
-
'plash_cli.cli._get_client': ('cli.html#_get_client', 'plash_cli/cli.py'),
|
|
23
|
-
'plash_cli.cli._is_included': ('cli.html#_is_included', 'plash_cli/cli.py'),
|
|
24
|
-
'plash_cli.cli._logs': ('cli.html#_logs', 'plash_cli/cli.py'),
|
|
25
|
-
'plash_cli.cli._mk_auth_req': ('cli.html#_mk_auth_req', 'plash_cli/cli.py'),
|
|
26
|
-
'plash_cli.cli._poll_cookies': ('cli.html#_poll_cookies', 'plash_cli/cli.py'),
|
|
27
|
-
'plash_cli.cli._prep': ('cli.html#_prep', 'plash_cli/cli.py'),
|
|
28
|
-
'plash_cli.cli._start': ('cli.html#_start', 'plash_cli/cli.py'),
|
|
29
|
-
'plash_cli.cli._stop': ('cli.html#_stop', 'plash_cli/cli.py'),
|
|
30
|
-
'plash_cli.cli._validate_app': ('cli.html#_validate_app', 'plash_cli/cli.py'),
|
|
31
|
-
'plash_cli.cli.app_list': ('cli.html#app_list', 'plash_cli/cli.py'),
|
|
32
|
-
'plash_cli.cli.create_tar_archive': ('cli.html#create_tar_archive', 'plash_cli/cli.py'),
|
|
33
|
-
'plash_cli.cli.delete_app': ('cli.html#delete_app', 'plash_cli/cli.py'),
|
|
34
|
-
'plash_cli.cli.deploy': ('cli.html#deploy', 'plash_cli/cli.py'),
|
|
35
|
-
'plash_cli.cli.download_app': ('cli.html#download_app', 'plash_cli/cli.py'),
|
|
36
|
-
'plash_cli.cli.login': ('cli.html#login', 'plash_cli/cli.py'),
|
|
37
|
-
'plash_cli.cli.logs': ('cli.html#logs', 'plash_cli/cli.py'),
|
|
38
|
-
'plash_cli.cli.plash_tool_info': ('cli.html#plash_tool_info', 'plash_cli/cli.py'),
|
|
39
|
-
'plash_cli.cli.start_app': ('cli.html#start_app', 'plash_cli/cli.py'),
|
|
40
|
-
'plash_cli.cli.stop_app': ('cli.html#stop_app', 'plash_cli/cli.py'),
|
|
41
|
-
'plash_cli.cli.view': ('cli.html#view', 'plash_cli/cli.py')}}}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|