1
1
# See:
2
2
# - <https://github.com/tauri-apps/tauri-action>
3
- # - <https://wsh032 .github.io/pytauri/>
3
+ # - <https://pytauri .github.io/pytauri/latest/usage/tutorial/build-standalone />
4
4
5
5
name : ' publish (standalone)'
6
6
@@ -49,33 +49,41 @@ jobs:
49
49
50
50
- name : Rust cache
51
51
uses : swatinem/rust-cache@v2
52
-
52
+
53
53
- name : Install uv
54
54
uses : astral-sh/setup-uv@v5
55
55
with :
56
56
enable-cache : true
57
-
57
+
58
58
# see:
59
59
# - <https://github.com/astral-sh/python-build-standalone/releases>
60
60
# - <https://raw.githubusercontent.com/astral-sh/python-build-standalone/latest-release/latest-release.json>
61
61
# - <https://gregoryszorc.com/docs/python-build-standalone/main/running.html#obtaining-distributions>
62
62
- name : download python-build-standalone
63
63
env :
64
64
PYTHON_VERSION : ' 3.13.1' # update this by yourself
65
- DATE : ' 20250115' # update this by yourself
65
+ TAG : ' 20250115' # update this by yourself
66
66
TARGET : ${{ matrix.target }}
67
67
run : |
68
- url="https://github.com/astral-sh/python-build-standalone/releases/download/${DATE}/cpython-${PYTHON_VERSION}+${DATE}-${TARGET}-install_only_stripped.tar.gz"
69
- mkdir -p ./pyembed
70
- curl -L $url | tar -xz -C ./pyembed
68
+ url="https://github.com/astral-sh/python-build-standalone/releases/download/${TAG}/cpython-${PYTHON_VERSION}+${TAG}-${TARGET}-install_only_stripped.tar.gz"
69
+ DEST_DIR="pyembed"
70
+ mkdir "$DEST_DIR"
71
+ curl -L "$url" | tar -xz -C "$DEST_DIR"
72
+
73
+ if [[ "${{ runner.os }}" == "macOS" ]]; then
74
+ python_major_minor="${PYTHON_VERSION%.*}" # "3.13.7" -> "3.13"
75
+ install_name_tool -id "@rpath/libpython${python_major_minor}.dylib" "$DEST_DIR/python/lib/libpython${python_major_minor}.dylib"
76
+ fi
71
77
72
78
- name : install your project into the embedded python environment
73
79
env :
74
80
PYTAURI_STANDALONE : 1 # see your `setup.py`
81
+ USE_CYTHON : 1 # see your `setup.py`
75
82
PYTHON_PATH : ${{ matrix.platform == 'windows-latest' && './pyembed/python/python.exe' || './pyembed/python/bin/python3' }}
76
83
run : |
77
84
uv pip install \
78
85
--exact \
86
+ --compile-bytecode \
79
87
--python=${PYTHON_PATH} \
80
88
.
81
89
@@ -89,11 +97,13 @@ jobs:
89
97
- name : set build environment variables (linux)
90
98
if : matrix.platform == 'ubuntu-22.04'
91
99
shell : bash
92
- # `nicegui-app` is your app `productName` in `tauri.conf.json`.
100
+ env :
101
+ # `nicegui-app` is your app `productName` in `tauri.conf.json`
102
+ PROJECT_NAME : ' nicegui-app'
93
103
run : |
94
104
export PYO3_PYTHON=$(realpath ./pyembed/python/bin/python3)
95
105
export RUSTFLAGS=" \
96
- -C link-arg=-Wl,-rpath,\$ORIGIN/../lib/nicegui-app /lib \
106
+ -C link-arg=-Wl,-rpath,\$ORIGIN/../lib/${PROJECT_NAME} /lib \
97
107
-L $(realpath ./pyembed/python/lib)"
98
108
99
109
echo "PYO3_PYTHON=$PYO3_PYTHON" >> $GITHUB_ENV
@@ -107,7 +117,7 @@ jobs:
107
117
export RUSTFLAGS=" \
108
118
-C link-arg=-Wl,-rpath,@executable_path/../Resources/lib \
109
119
-L $(realpath ./pyembed/python/lib)"
110
-
120
+
111
121
echo "PYO3_PYTHON=$PYO3_PYTHON" >> $GITHUB_ENV
112
122
echo "RUSTFLAGS=$RUSTFLAGS" >> $GITHUB_ENV
113
123
0 commit comments