Skip to content

Commit 2f36115

Browse files
committed
platform-specific notes
1 parent 3038674 commit 2f36115

8 files changed

Lines changed: 256 additions & 144 deletions

File tree

.github/workflows/build-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ concurrency:
2727
env:
2828
UV_PYTHON: 3.12
2929
PYTHONUTF8: 1
30+
FLET_BUILD_TEMPLATE_REF: 0.80.5
3031

3132
# https://docs.flet.dev/publish/
3233
BUILD_NUMBER: 1
3334
BUILD_VERSION: 1.0.0
34-
TEMPLATE_REF: 0.81.0
3535

3636
# https://docs.flet.dev/reference/environment-variables
3737
FLET_CLI_NO_RICH_OUTPUT: 1
@@ -61,7 +61,7 @@ jobs:
6161

6262
- name: windows
6363
runner: windows-latest
64-
build_cmd: "flet build windows --yes --verbose --no-rich-output --build-number=$BUILD_NUMBER --build-version=$BUILD_VERSION"
64+
build_cmd: "flet build windows --yes --verbose --build-number=$BUILD_NUMBER --build-version=$BUILD_VERSION"
6565
artifact_name: windows-build-artifact
6666
artifact_path: build/windows
6767
needs_linux_deps: false
@@ -189,7 +189,7 @@ jobs:
189189
shell: bash
190190
working-directory: sdk/python/examples/apps/flet_build_test
191191
run: |
192-
uv run ${{ matrix.build_cmd }} --template-ref 0.80.5
192+
uv run ${{ matrix.build_cmd }} --template-ref $FLET_BUILD_TEMPLATE_REF
193193
194194
- name: Upload Artifact
195195
uses: actions/upload-artifact@v5.0.0

sdk/python/packages/flet/docs/datatable2/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pip install flet-datatable2 # (1)!
4646
--8<-- "{{ examples }}/example_2.py"
4747
```
4848

49-
![DataTable2 example]({{ examples }}/media/example_2.gif)
49+
{{ image(examples + "/media/example_2.gif", width="80%") }}
5050

5151
## Description
5252

sdk/python/packages/flet/docs/extras/macros/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from .cli_to_md import render_flet_cli_as_markdown
66
from .controls_overview import render_nav_overview, render_sub_nav_overview
7+
from .cross_platform_permissions import cross_platform_permissions_list
78
from .pypi_index import render_pypi_index
89

910

@@ -158,3 +159,7 @@ def cookbook_overview():
158159
base_dir="cookbook",
159160
skip_paths={"cookbook/index.md"},
160161
)
162+
163+
@env.macro
164+
def cross_platform_permissions():
165+
return cross_platform_permissions_list()
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import argparse
2+
3+
4+
def _indent_block(text: str, indent: int) -> str:
5+
prefix = " " * indent
6+
return "\n".join(f"{prefix}{line}" for line in text.splitlines())
7+
8+
9+
def _toml_key(key: str) -> str:
10+
if key.replace("-", "").replace("_", "").isalnum():
11+
return key
12+
escaped = key.replace("\\", "\\\\").replace('"', '\\"')
13+
return f'"{escaped}"'
14+
15+
16+
def _toml_value(value) -> str:
17+
if isinstance(value, bool):
18+
return "true" if value else "false"
19+
if value is None:
20+
return "null"
21+
escaped = str(value).replace("\\", "\\\\").replace('"', '\\"')
22+
return f'"{escaped}"'
23+
24+
25+
def _load_cross_platform_permissions() -> dict:
26+
from flet_cli.commands.build_base import BaseBuildCommand
27+
28+
parser = argparse.ArgumentParser(add_help=False)
29+
command = BaseBuildCommand(parser)
30+
return command.cross_platform_permissions
31+
32+
33+
def _render_toml_block(config: dict) -> str:
34+
info_plist = config.get("info_plist") or {}
35+
macos_entitlements = config.get("macos_entitlements") or {}
36+
android_permissions = config.get("android_permissions") or {}
37+
android_features = config.get("android_features") or {}
38+
39+
sections = []
40+
41+
if info_plist:
42+
lines = ["# iOS", "[tool.flet.ios.info]"]
43+
for key, value in info_plist.items():
44+
lines.append(f"{_toml_key(key)} = {_toml_value(value)}")
45+
sections.append("\n".join(lines))
46+
47+
lines = ["# macOS", "[tool.flet.macos.info]"]
48+
for key, value in info_plist.items():
49+
lines.append(f"{_toml_key(key)} = {_toml_value(value)}")
50+
if macos_entitlements:
51+
lines.extend(["", "[tool.flet.macos.entitlement]"])
52+
for key, value in macos_entitlements.items():
53+
lines.append(f"{_toml_key(key)} = {_toml_value(value)}")
54+
sections.append("\n".join(lines))
55+
56+
if android_permissions:
57+
lines = ["# Android", "[tool.flet.android.permission]"]
58+
for key, value in android_permissions.items():
59+
lines.append(f"{_toml_key(key)} = {_toml_value(value)}")
60+
if android_features:
61+
lines.extend(["", "[tool.flet.android.feature]"])
62+
for key, value in android_features.items():
63+
lines.append(f"{_toml_key(key)} = {_toml_value(value)}")
64+
sections.append("\n".join(lines))
65+
66+
return "\n\n".join(sections)
67+
68+
69+
def cross_platform_permissions_list() -> str:
70+
permissions = _load_cross_platform_permissions()
71+
items = []
72+
for name, config in permissions.items():
73+
toml_block = _indent_block(_render_toml_block(config), 4)
74+
items.append(
75+
"\n".join(
76+
[
77+
f"- `{name}`",
78+
"",
79+
" /// details | `pyproject.toml` equivalent",
80+
" type: example",
81+
" ```toml",
82+
toml_block,
83+
" ```",
84+
" ///",
85+
]
86+
)
87+
)
88+
89+
return "\n\n".join(items) + "\n"
90+
91+
92+
if __name__ == "__main__":
93+
print(cross_platform_permissions_list())

sdk/python/packages/flet/docs/publish/android.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ If not, create one using one of the following methods:
169169
```
170170
You will be prompted for several details, such as a keystore password,
171171
a key alias, your names, and location. Remember the password and alias
172-
for use in the [configuration](#configuration) step below.
172+
for use in the configuration steps below.
173173

174174
A file named `upload-keystore.jks` will be created in your home directory.
175175
If you want to store it elsewhere, change the argument passed to the `-keystore` parameter.

0 commit comments

Comments
 (0)