Skip to content

Commit 82fa930

Browse files
Add a note about packaging NiceGUI scripts (zauberzeug#5297)
### Motivation In zauberzeug#5247 we noticed that packaging NiceGUI scripts (apps without `@page` or `root` functions) does not work - especially using the `--onefile` argument. ### Implementation This PR adds a note about this limitation and adjusts the demo accordingly. ### Progress - [x] I chose a meaningful title that completes the sentence: "If applied, this PR will..." - [x] The implementation is complete. - [x] Pytests are not necessary. - [x] Documentation has been added.
1 parent 3aeaae8 commit 82fa930

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

website/documentation/content/section_configuration_deployment.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,11 @@ def uvicorn_ssl():
254254
NiceGUI apps can also be bundled into an executable with `nicegui-pack` which is based on [PyInstaller](https://www.pyinstaller.org/).
255255
This allows you to distribute your app as a single file that can be executed on any computer.
256256
257-
Just make sure to call `ui.run` with `reload=False` in your main script to disable the auto-reload feature.
257+
Just make sure
258+
259+
- to call `ui.run` with `reload=False` in your main script to disable the auto-reload feature, and
260+
- to pass a `root` page function to `ui.run` or define at least one decorated `@page` function.
261+
258262
Running the `nicegui-pack` command below will create an executable `myapp` in the `dist` folder:
259263
''')
260264

@@ -267,9 +271,10 @@ def pyinstaller():
267271
```python
268272
from nicegui import native, ui
269273
270-
ui.label('Hello from PyInstaller')
274+
def root():
275+
ui.label('Hello from PyInstaller')
271276
272-
ui.run(reload=False, port=native.find_open_port())
277+
ui.run(root, reload=False, port=native.find_open_port())
273278
```
274279
''')
275280
with bash_window(classes='max-w-lg w-full'):

0 commit comments

Comments
 (0)