Skip to content

Commit 655f36b

Browse files
authored
ci: Include source-distribution when publishing Flet packages (#5669)
* fix: pass value to change event in Switch * ci: build sdist * include tar.gz sdist files when uploading artifacts * update glob expressions * ls -laR dist * updates * --dry-run * cleanup * remove --dry-run * updates * remove --dry-run * updates * updates * updates * updates * rm -rf "$FLET_DESKTOP_APP"
1 parent 9a03928 commit 655f36b

File tree

3 files changed

+91
-65
lines changed

3 files changed

+91
-65
lines changed

.github/workflows/ci.yml

Lines changed: 86 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,21 @@ on:
66
- '**'
77
tags:
88
- '*'
9-
paths-ignore:
10-
- "**/*.md"
9+
paths:
10+
- '.github/workflows/ci.yml'
11+
- '.github/scripts/**'
12+
- 'client/**'
13+
- 'sdk/python/packages/**'
14+
- 'packages/flet/**'
15+
- '.fvmrc'
1116
pull_request:
12-
paths-ignore:
13-
- "**/*.md"
17+
paths:
18+
- '.github/workflows/ci.yml'
19+
- '.github/scripts/**'
20+
- 'client/**'
21+
- 'sdk/python/packages/**'
22+
- 'packages/flet/**'
23+
- '.fvmrc'
1424
workflow_dispatch:
1525

1626
permissions:
@@ -151,20 +161,13 @@ jobs:
151161
shell: bash
152162
run: |
153163
source "$SCRIPTS/common.sh"
154-
155-
# Convert to POSIX for bash compatibility
156-
SDK_PYTHON="$(cygpath -u "$SDK_PYTHON")"
157-
SCRIPTS="$(cygpath -u "$SCRIPTS")"
158-
159-
# Replace: version = "" -> version = "<PYPI_VER>"
160-
vp="${SDK_PYTHON}/packages/flet-desktop/src/flet_desktop/version.py"
161-
sed -i 's/^version = ""$/version = "'"$PYPI_VER"'"/' "$vp"
162-
164+
patch_python_package_versions
163165
patch_toml_versions "${SDK_PYTHON}/packages/flet-desktop/pyproject.toml" "$PYPI_VER"
164166
165167
- name: Build Flutter Windows client
166168
env:
167-
RELEASE_DIR: ${{ env.ROOT }}\client\build\windows\x64\runner\Release
169+
RUNNER_DIR: ${{ env.ROOT }}/client/build/windows/x64/runner
170+
RELEASE_DIR: ${{ env.ROOT }}/client/build/windows/x64/runner/Release
168171
shell: bash
169172
working-directory: client
170173
run: |
@@ -176,27 +179,24 @@ jobs:
176179
cp "${WINDIR}/system32/vcruntime140_1.dll" "$RELEASE_DIR"
177180
178181
# Rename Release folder to flet
179-
RUNNER_DIR="$(dirname "$RELEASE_DIR")"
180182
mv "$RELEASE_DIR" "${RUNNER_DIR}/flet"
181183
182184
# Zip up the runner
183-
cd build/windows/x64/runner
184-
7z a flet-windows.zip flet
185+
cd "$RUNNER_DIR"
186+
7z a "${ROOT}/client/flet-windows.zip" "flet"
185187
186-
# Stage app into Python package
187-
mkdir -p "${SDK_PYTHON}/packages/flet-desktop/src/flet_desktop/app"
188-
cp -r "flet" "${SDK_PYTHON}/packages/flet-desktop/src/flet_desktop/app/flet"
188+
# Stage app into flet-desktop package
189+
FLET_DESKTOP_APP="${SDK_PYTHON}/packages/flet-desktop/src/flet_desktop/app"
190+
mkdir -p "$FLET_DESKTOP_APP"
191+
cp -r "flet" "${FLET_DESKTOP_APP}/flet"
189192
190-
- name: Build Python wheels
193+
- name: Build flet-desktop Python package
191194
shell: bash
192195
run: |
193196
source "$SCRIPTS/common.sh"
194197
195-
# Convert Windows env paths to POSIX for bash
196-
SDK_PYTHON="$(cygpath -u "$SDK_PYTHON")"
197-
198198
cd "$SDK_PYTHON"
199-
uv build --wheel --package flet-desktop
199+
uv build --package flet-desktop --wheel
200200
201201
# Ensure glob expands
202202
shopt -s nullglob
@@ -213,7 +213,7 @@ jobs:
213213
name: windows-artifacts
214214
if-no-files-found: error
215215
path: |
216-
client/build/windows/x64/runner/flet-windows.zip
216+
client/flet-windows.zip
217217
sdk/python/dist/*.whl
218218
219219
# ===========================
@@ -250,14 +250,14 @@ jobs:
250250
mkdir -p "${SDK_PYTHON}/packages/flet-desktop/src/flet_desktop/app"
251251
cp flet-macos.tar.gz "${SDK_PYTHON}/packages/flet-desktop/src/flet_desktop/app"
252252
253-
- name: Build Python wheels
253+
- name: Build flet-desktop Python package
254254
shell: bash
255255
working-directory: ${{ env.SDK_PYTHON }}
256256
run: |
257257
source "$SCRIPTS/common.sh"
258258
259259
patch_python_package_versions
260-
uv build --wheel --package flet-desktop
260+
uv build --package flet-desktop --wheel
261261
262262
for file in dist/*-py3-none-any.whl; do
263263
repackage_wheel_with_tag "$file" "py3-none-macosx_12_0_arm64"
@@ -271,8 +271,8 @@ jobs:
271271
name: macos-artifacts
272272
if-no-files-found: error
273273
path: |
274-
sdk/python/dist/*.whl
275274
client/flet-macos.tar.gz
275+
sdk/python/dist/*.whl
276276
277277
# ===========================
278278
# Build Flet Client for Linux
@@ -389,7 +389,7 @@ jobs:
389389
build_flutter "flet-desktop"
390390
build_flutter "flet-desktop-light"
391391
392-
- name: Build Python wheels
392+
- name: Build flet-desktop and flet-desktop-light Python packages
393393
shell: bash
394394
working-directory: client
395395
run: |
@@ -427,12 +427,17 @@ jobs:
427427
patch_toml_package_name pyproject.toml "$PACKAGE_NAME"
428428
uv build --wheel
429429
430+
if [[ "$PACKAGE_NAME" == "flet-desktop-light" ]]; then
431+
rm -rf "$FLET_DESKTOP_APP"
432+
uv build --sdist
433+
fi
434+
430435
# Find all universal wheels for the current package
431436
universal=( "${dist}/${PACKAGE_NAME//-/_}-"*"-py3-none-any"*.whl )
432437
433438
if (( ${#universal[@]} == 0 )); then
434439
echo "ERROR: No universal wheels found in ${dist} for ${PACKAGE_NAME}."
435-
ls -la "$dist" || true
440+
ls -laR "$dist" || true
436441
exit 1
437442
fi
438443
@@ -467,6 +472,7 @@ jobs:
467472
path: |
468473
client/flet-linux*.tar.gz
469474
sdk/python/dist/*.whl
475+
sdk/python/dist/*.tar.gz
470476
471477
# =========================
472478
# Build Flet Client for Web
@@ -500,46 +506,54 @@ jobs:
500506
PYODIDE_URL="https://github.com/pyodide/pyodide/releases/download/${PYODIDE_VERSION}/pyodide-core-${PYODIDE_VERSION}.tar.bz2"
501507
PYODIDE_CDN_URL="https://cdn.jsdelivr.net/pyodide/v${PYODIDE_VERSION}/full"
502508
509+
FLET_WEB="${SDK_PYTHON}/packages/flet-web/src/flet_web"
510+
503511
flutter build web --wasm
504-
cp -R build/web "${SDK_PYTHON}/packages/flet-web/src/flet_web"
512+
513+
cp -R "build/web" "${FLET_WEB}"
505514
506515
# Safari mobile workaround: https://github.com/flutter/flutter/issues/145111#issuecomment-2714599139
507516
FLUTTER_JS_DIR="$(dirname "$(command -v flutter)")/cache/flutter_web_sdk/flutter_js"
508-
cp "$FLUTTER_JS_DIR/flutter.js.map" "${SDK_PYTHON}/packages/flet-web/src/flet_web/web"
517+
cp "$FLUTTER_JS_DIR/flutter.js.map" "${FLET_WEB}/web"
509518
510519
# Download the Pyodide tarball and extract its contents into the web build folder
511-
curl -L "$PYODIDE_URL" | tar -xj -C "${SDK_PYTHON}/packages/flet-web/src/flet_web/web"
512-
513-
# Download the prebuilt 'packaging' wheel
514-
curl -L "${PYODIDE_CDN_URL}/packaging-24.2-py3-none-any.whl" -o "${SDK_PYTHON}/packages/flet-web/src/flet_web/web/pyodide/packaging-24.2-py3-none-any.whl"
520+
curl -L "$PYODIDE_URL" | tar -xj -C "${FLET_WEB}/web"
515521
516-
# Download the prebuilt 'micropip' wheel
517-
curl -L "${PYODIDE_CDN_URL}/micropip-0.8.0-py3-none-any.whl" -o "${SDK_PYTHON}/packages/flet-web/src/flet_web/web/pyodide/micropip-0.8.0-py3-none-any.whl"
522+
# Download the prebuilt pyodide wheels
523+
for wheel in "packaging-24.2-py3-none-any.whl" "micropip-0.8.0-py3-none-any.whl"; do
524+
curl -L "${PYODIDE_CDN_URL}/${wheel}" -o "${FLET_WEB}/web/pyodide/${wheel}"
525+
done
518526
519-
# Archive the entire built Flutter web client into a gzipped tarball
520-
tar -czvf build/flet-web.tar.gz -C build/web .
527+
# Archive the web client into a gzipped tarball
528+
tar -czvf "flet-web.tar.gz" -C "build/web" .
521529
522-
- name: Build Python package
530+
- name: Build flet-web Python package
523531
shell: bash
532+
working-directory: ${{ env.SDK_PYTHON }}
524533
run: |
525534
source "$SCRIPTS/common.sh"
526535
patch_python_package_versions
527-
uv build --wheel --package flet-web
536+
uv build --package flet-web --wheel
537+
rm -rf "packages/flet-web/src/flet_web/web"
538+
uv build --package flet-web --sdist
539+
540+
ls -laR dist
528541
529542
- name: Upload artifacts
530543
uses: actions/upload-artifact@v4
531544
with:
532545
name: web-artifacts
533546
if-no-files-found: error
534547
path: |
535-
client/build/flet-web.tar.gz
548+
client/flet-web.tar.gz
536549
sdk/python/dist/*.whl
550+
sdk/python/dist/*.tar.gz
537551
538-
# =======================
539-
# Build flet and flet-cli
540-
# =======================
541-
build_flet_and_cli_wheels:
542-
name: Build flet and flet-cli Python wheels
552+
# =====================================
553+
# Build flet, flet-cli and flet-desktop
554+
# =====================================
555+
build_flet_cli_desktop:
556+
name: Build flet, flet-cli and flet-desktop Python packages
543557
runs-on: ubuntu-latest
544558
env:
545559
PYPI_VER: ${{ needs.build_flet_package.outputs.PYPI_VER }}
@@ -553,32 +567,35 @@ jobs:
553567
- name: Setup uv
554568
uses: astral-sh/setup-uv@v6
555569

556-
- name: Build wheels
570+
- name: Build Python packages
557571
shell: bash
558572
run: |
559573
source "$SCRIPTS/common.sh"
560574
patch_python_package_versions
561-
uv build --wheel --package flet-cli
562-
uv build --wheel --package flet
575+
uv build --package flet-cli
576+
uv build --package flet
577+
uv build --package flet-desktop --sdist
563578
update_flet_wheel_deps dist
564579
565580
- name: Upload artifacts
566581
uses: actions/upload-artifact@v4
567582
with:
568-
name: flet-and-flet-cli-wheels
569-
path: sdk/python/dist/*.whl
583+
name: flet-cli-desktop-python-distribution
584+
path: |
585+
sdk/python/dist/*.whl
586+
sdk/python/dist/*.tar.gz
570587
571588
# ===============================
572589
# Publish Python packages to PyPI
573590
# ===============================
574591
py_publish:
575592
name: Publish Python packages to PyPI
576593
runs-on: ubuntu-latest
577-
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main'
594+
# if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main'
578595
needs:
579596
- python_tests
580597
- build_flet_package
581-
- build_flet_and_cli_wheels
598+
- build_flet_cli_desktop
582599
- build_windows
583600
- build_macos
584601
- build_linux
@@ -593,13 +610,16 @@ jobs:
593610
path: dist
594611
merge-multiple: true
595612

596-
- name: Publish wheels to PyPI
613+
- name: Publish packages to PyPI
597614
run: |
598-
uv publish dist/**/flet-*.whl
599-
uv publish dist/**/flet_cli-*.whl
600-
uv publish dist/**/flet_desktop-*.whl
601-
uv publish dist/**/flet_desktop_light-*.whl
602-
uv publish dist/**/flet_web-*.whl
615+
# remove client to avoid glob conflicts with its contents
616+
rm -rf dist/client
617+
618+
ls -laR
619+
620+
for pkg in flet flet_cli flet_desktop flet_desktop_light flet_web; do
621+
uv publish --dry-run dist/**/${pkg}-*
622+
done
603623
604624
# ==============
605625
# GitHub Release
@@ -614,6 +634,7 @@ jobs:
614634
uses: actions/download-artifact@v4
615635
with:
616636
path: dist
637+
merge-multiple: true
617638

618639
- name: Create/Update GitHub Release
619640
uses: softprops/action-gh-release@v2
@@ -627,4 +648,6 @@ jobs:
627648
overwrite_files: true
628649
fail_on_unmatched_files: true
629650
files: |
630-
dist/**/*.{whl,tar.gz,zip}
651+
dist/**/*.whl
652+
dist/**/*.tar.gz
653+
dist/**/*.zip

.github/workflows/macos-integration-tests.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,20 @@ name: macOS Integration Tests
33
on:
44
push:
55
paths:
6+
- '.github/workflows/macos-integration-tests.yml'
67
- 'sdk/python/packages/flet/src/**'
78
- 'sdk/python/packages/flet/integration_tests/**'
89
- 'packages/flet/**'
910
- 'client/**'
11+
- '.fvmrc'
1012
pull_request:
1113
paths:
14+
- '.github/workflows/macos-integration-tests.yml'
1215
- 'sdk/python/packages/flet/src/**'
1316
- 'sdk/python/packages/flet/integration_tests/**'
1417
- 'packages/flet/**'
1518
- 'client/**'
16-
19+
- '.fvmrc'
1720
workflow_dispatch:
1821

1922
# Ensure only one run per branch (PR or push), cancel older ones

packages/flet/lib/src/controls/switch.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class _SwitchControlState extends State<SwitchControl> {
6262
_value = value;
6363
var props = {"value": value};
6464
widget.control.updateProperties(props, notify: true);
65-
widget.control.triggerEvent("change");
65+
widget.control.triggerEvent("change", value);
6666
}
6767

6868
void _onFocusChange() {

0 commit comments

Comments
 (0)