Skip to content

Commit f0759c7

Browse files
committed
feat: nicegui-app demo
1 parent 2f29263 commit f0759c7

35 files changed

+8083
-125
lines changed
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: 'publish'
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- release
8+
9+
defaults:
10+
run:
11+
shell: bash
12+
13+
jobs:
14+
publish-tauri:
15+
permissions:
16+
contents: write
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
include:
21+
- platform: 'macos-latest' # for Arm based macs (M1 and above).
22+
target: 'aarch64-apple-darwin'
23+
- platform: 'macos-latest' # for Intel based macs.
24+
target: 'x86_64-apple-darwin'
25+
- platform: 'ubuntu-22.04'
26+
target: 'x86_64-unknown-linux-gnu'
27+
- platform: 'windows-latest'
28+
target: 'x86_64-pc-windows-msvc'
29+
30+
runs-on: ${{ matrix.platform }}
31+
steps:
32+
- uses: actions/checkout@v4
33+
34+
- name: install dependencies (ubuntu only)
35+
if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above.
36+
run: |
37+
sudo apt-get update
38+
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
39+
40+
- name: install Rust stable
41+
uses: dtolnay/rust-toolchain@stable
42+
with:
43+
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
44+
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
45+
46+
- name: Rust cache
47+
uses: swatinem/rust-cache@v2
48+
49+
- name: Install uv
50+
uses: astral-sh/setup-uv@v5
51+
52+
# see:
53+
# - <https://github.com/astral-sh/python-build-standalone/releases>
54+
# - <https://raw.githubusercontent.com/astral-sh/python-build-standalone/latest-release/latest-release.json>
55+
# - <https://gregoryszorc.com/docs/python-build-standalone/main/running.html#obtaining-distributions>
56+
- name: download python-build-standalone
57+
env:
58+
PYTHON_VERSION: '3.13.1' # update this by yourself
59+
DATE: '20250115' # update this by yourself
60+
TARGET: ${{ matrix.target }}
61+
run: |
62+
url="https://github.com/astral-sh/python-build-standalone/releases/download/${DATE}/cpython-${PYTHON_VERSION}+${DATE}-${TARGET}-install_only_stripped.tar.gz"
63+
mkdir -p ./pyembed
64+
curl -L $url | tar -xz -C ./pyembed
65+
66+
- name: install your project into the embedded python environment
67+
env:
68+
PYTAURI_STANDALONE: 1 # see your `setup.py`
69+
PYTHON_PATH: ${{ matrix.platform == 'windows-latest' && './pyembed/python/python.exe' || './pyembed/python/bin/python3' }}
70+
run: |
71+
uv pip install \
72+
--exact \
73+
--python=${PYTHON_PATH} \
74+
.
75+
76+
- name: set build environment variables (windows)
77+
if: matrix.platform == 'windows-latest'
78+
shell: powershell
79+
run: |
80+
$PYO3_PYTHON = (Resolve-Path -LiteralPath ".\pyembed\python\python.exe").Path
81+
echo "PYO3_PYTHON=$PYO3_PYTHON" >> $env:GITHUB_ENV
82+
83+
- name: set build environment variables (linux)
84+
if: matrix.platform == 'ubuntu-22.04'
85+
shell: bash
86+
# `nicegui-app` is your app `productName` in `tauri.conf.json`.
87+
run: |
88+
export PYO3_PYTHON=$(realpath ./pyembed/python/bin/python3)
89+
export RUSTFLAGS=" \
90+
-C link-arg=-Wl,-rpath,\$ORIGIN/../lib/nicegui-app/lib \
91+
-L $(realpath ./pyembed/python/lib)"
92+
93+
echo "PYO3_PYTHON=$PYO3_PYTHON" >> $GITHUB_ENV
94+
echo "RUSTFLAGS=$RUSTFLAGS" >> $GITHUB_ENV
95+
96+
- name: set build environment variables (macos)
97+
if: matrix.platform == 'macos-latest'
98+
shell: bash
99+
run: |
100+
export PYO3_PYTHON=$(realpath ./pyembed/python/bin/python3)
101+
export RUSTFLAGS=" \
102+
-C link-arg=-Wl,-rpath,@executable_path/../Resources/lib \
103+
-L $(realpath ./pyembed/python/lib)"
104+
105+
echo "PYO3_PYTHON=$PYO3_PYTHON" >> $GITHUB_ENV
106+
echo "RUSTFLAGS=$RUSTFLAGS" >> $GITHUB_ENV
107+
108+
- name: Build and bundle the app
109+
uses: tauri-apps/tauri-action@v0
110+
env:
111+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112+
with:
113+
tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version.
114+
releaseName: 'App v__VERSION__'
115+
releaseBody: 'See the assets to download this version and install.'
116+
releaseDraft: true
117+
prerelease: false
118+
args: '--target ${{ matrix.target }} --config tauri.bundle.json --verbose'
119+
includeDebug: true

.gitignore

Lines changed: 34 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -1,171 +1,81 @@
1+
# Generated by Cargo
2+
# will have compiled files and executables
3+
/target/
4+
5+
# Generated by Tauri
6+
# will have schema files for capabilities auto-completion
7+
/gen/schemas
8+
19
# Byte-compiled / optimized / DLL files
210
__pycache__/
11+
.pytest_cache/
12+
*.pdb
313
*.py[cod]
4-
*$py.class
514

615
# C extensions
716
*.so
817

918
# Distribution / packaging
1019
.Python
20+
.venv/
21+
env/
22+
bin/
1123
build/
1224
develop-eggs/
1325
dist/
14-
downloads/
1526
eggs/
16-
.eggs/
1727
lib/
1828
lib64/
1929
parts/
2030
sdist/
2131
var/
22-
wheels/
23-
share/python-wheels/
32+
include/
33+
man/
34+
venv/
2435
*.egg-info/
2536
.installed.cfg
2637
*.egg
27-
MANIFEST
28-
29-
# PyInstaller
30-
# Usually these files are written by a python script from a template
31-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32-
*.manifest
33-
*.spec
3438

3539
# Installer logs
3640
pip-log.txt
3741
pip-delete-this-directory.txt
42+
pip-selfcheck.json
3843

3944
# Unit test / coverage reports
4045
htmlcov/
4146
.tox/
42-
.nox/
4347
.coverage
44-
.coverage.*
4548
.cache
4649
nosetests.xml
4750
coverage.xml
48-
*.cover
49-
*.py,cover
50-
.hypothesis/
51-
.pytest_cache/
52-
cover/
5351

5452
# Translations
5553
*.mo
56-
*.pot
54+
55+
# Mr Developer
56+
.mr.developer.cfg
57+
.project
58+
.pydevproject
59+
60+
# Rope
61+
.ropeproject
5762

5863
# Django stuff:
5964
*.log
60-
local_settings.py
61-
db.sqlite3
62-
db.sqlite3-journal
63-
64-
# Flask stuff:
65-
instance/
66-
.webassets-cache
65+
*.pot
6766

68-
# Scrapy stuff:
69-
.scrapy
67+
.DS_Store
7068

7169
# Sphinx documentation
7270
docs/_build/
7371

74-
# PyBuilder
75-
.pybuilder/
76-
target/
77-
78-
# Jupyter Notebook
79-
.ipynb_checkpoints
80-
81-
# IPython
82-
profile_default/
83-
ipython_config.py
84-
85-
# pyenv
86-
# For a library or package, you might want to ignore these files since the code is
87-
# intended to run in multiple environments; otherwise, check them in:
88-
# .python-version
89-
90-
# pipenv
91-
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92-
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93-
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94-
# install all needed dependencies.
95-
#Pipfile.lock
96-
97-
# UV
98-
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99-
# This is especially recommended for binary packages to ensure reproducibility, and is more
100-
# commonly ignored for libraries.
101-
#uv.lock
102-
103-
# poetry
104-
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105-
# This is especially recommended for binary packages to ensure reproducibility, and is more
106-
# commonly ignored for libraries.
107-
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108-
#poetry.lock
109-
110-
# pdm
111-
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112-
#pdm.lock
113-
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114-
# in version control.
115-
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
116-
.pdm.toml
117-
.pdm-python
118-
.pdm-build/
119-
120-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121-
__pypackages__/
122-
123-
# Celery stuff
124-
celerybeat-schedule
125-
celerybeat.pid
126-
127-
# SageMath parsed files
128-
*.sage.py
129-
130-
# Environments
131-
.env
132-
.venv
133-
env/
134-
venv/
135-
ENV/
136-
env.bak/
137-
venv.bak/
138-
139-
# Spyder project settings
140-
.spyderproject
141-
.spyproject
142-
143-
# Rope project settings
144-
.ropeproject
145-
146-
# mkdocs documentation
147-
/site
148-
149-
# mypy
150-
.mypy_cache/
151-
.dmypy.json
152-
dmypy.json
153-
154-
# Pyre type checker
155-
.pyre/
72+
# PyCharm
73+
.idea/
15674

157-
# pytype static type analyzer
158-
.pytype/
75+
# VSCode
76+
.vscode/
15977

160-
# Cython debug symbols
161-
cython_debug/
78+
# Pyenv
79+
.python-version
16280

163-
# PyCharm
164-
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165-
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166-
# and can be added to the global gitignore or merged into this file. For a more nuclear
167-
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
168-
#.idea/
169-
170-
# PyPI configuration file
171-
.pypirc
81+
/pyembed/

.taurignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# See: <https://tauri.app/develop/#reacting-to-source-code-changes>
2+
3+
__pycache__
4+
/pyembed/

0 commit comments

Comments
 (0)