Skip to content

Commit e50cd18

Browse files
Added python getting started docs (#40)
1 parent 2539408 commit e50cd18

3 files changed

Lines changed: 95 additions & 0 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<FancyStep step={props.step}>
2+
<details>
3+
<summary>
4+
<strong>Install Velopack python library</strong>
5+
</summary>
6+
7+
Install velopack from the Python Package Index:
8+
```txt
9+
pip install velopack
10+
```
11+
</details>
12+
</FancyStep>

docs/getting-started/python.mdx

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
import InstallPip from './content/_install-pip.mdx';
2+
import InstallVpk from './content/_install-vpk.mdx';
3+
import BuildRelease from './content/_build-release.mdx';
4+
import Completion from './content/_completion.mdx';
5+
import Admonition from '@theme/Admonition';
6+
7+
8+
# Getting Started: Python
9+
<AppliesTo all />
10+
Get started with our python library.
11+
12+
13+
<InstallPip step={1}/>
14+
15+
<FancyStep step={2}>
16+
<details>
17+
<summary>
18+
<strong>Configure Velopack at the beginning of your entry point</strong>
19+
</summary>
20+
21+
Add the following code to your entry point (eg. `main.py`) as early as possible (before any electron startup code etc.):
22+
```python
23+
import velopack
24+
25+
if __name__ == "__main__":
26+
# Velopack builder needs to be the first thing to run in the main process.
27+
# In some cases, it might quit/restart the process to perform tasks.
28+
velopack.App().run()
29+
30+
# ... your other app startup code here
31+
```
32+
33+
</details>
34+
</FancyStep>
35+
36+
<FancyStep step={3}>
37+
<details>
38+
<summary>
39+
<strong>Add update check within your app</strong>
40+
</summary>
41+
42+
Velopack provides a simple way to check for updates and apply them.
43+
The following shows how to implement a basic update check within your application.
44+
45+
You can also split up the various methods to allow your users to control when to check for updates, download them, or apply them.
46+
47+
```python
48+
def update_app():
49+
manager = velopack.UpdateManager("https://the.place/you-host/updates")
50+
51+
update_info = manager.check_for_updates()
52+
if not update_info:
53+
return # no updates available
54+
55+
# Download the updates, optionally providing progress callbacks
56+
manager.download_updates(update_info)
57+
58+
# Apply the update and restart the app
59+
manager.apply_updates_and_restart(update_info)
60+
```
61+
62+
</details>
63+
</FancyStep>
64+
65+
<FancyStep step={4}>
66+
<details>
67+
<summary>
68+
<strong>Build your app</strong>
69+
</summary>
70+
71+
Compile your app to a binary (eg. `.exe` on Windows). Example using PyInstaller:
72+
```sh
73+
pyinstaller --onedir app.py
74+
```
75+
</details>
76+
</FancyStep>
77+
78+
<InstallVpk step={5}/>
79+
80+
<BuildRelease step={6}/>
81+
82+
<Completion />

sidebars.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const sidebars: SidebarsConfig = {
4747
doc("getting-started/wpf", "C# / WPF"),
4848
doc("getting-started/cpp", "C / C++"),
4949
doc("getting-started/electron", "JS / Electron"),
50+
doc("getting-started/python", "Python"),
5051
doc("getting-started/rust", "Rust"),
5152
doc("getting-started/uno", "C# / Uno Platform"),
5253
],

0 commit comments

Comments
 (0)