flet-cli 0.85.1__tar.gz → 0.85.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. {flet_cli-0.85.1 → flet_cli-0.85.3}/PKG-INFO +2 -2
  2. {flet_cli-0.85.1 → flet_cli-0.85.3}/pyproject.toml +2 -2
  3. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/commands/build_base.py +115 -3
  4. flet_cli-0.85.3/src/flet_cli/utils/template_cache.py +48 -0
  5. flet_cli-0.85.3/src/flet_cli/version.py +1 -0
  6. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli.egg-info/PKG-INFO +2 -2
  7. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli.egg-info/SOURCES.txt +1 -0
  8. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli.egg-info/requires.txt +1 -1
  9. flet_cli-0.85.1/src/flet_cli/version.py +0 -1
  10. {flet_cli-0.85.1 → flet_cli-0.85.3}/README.md +0 -0
  11. {flet_cli-0.85.1 → flet_cli-0.85.3}/setup.cfg +0 -0
  12. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/__pyinstaller/__init__.py +0 -0
  13. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/__pyinstaller/config.py +0 -0
  14. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/__pyinstaller/hook-flet.py +0 -0
  15. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/__pyinstaller/macos_utils.py +0 -0
  16. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/__pyinstaller/rthooks/pyi_rth_localhost_fletd.py +0 -0
  17. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/__pyinstaller/utils.py +0 -0
  18. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/__pyinstaller/win_utils.py +0 -0
  19. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/cli.py +0 -0
  20. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/commands/base.py +0 -0
  21. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/commands/build.py +0 -0
  22. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/commands/create.py +0 -0
  23. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/commands/debug.py +0 -0
  24. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/commands/devices.py +0 -0
  25. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/commands/doctor.py +0 -0
  26. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/commands/emulators.py +0 -0
  27. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/commands/flutter_base.py +0 -0
  28. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/commands/options.py +0 -0
  29. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/commands/pack.py +0 -0
  30. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/commands/publish.py +0 -0
  31. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/commands/run.py +0 -0
  32. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/commands/serve.py +0 -0
  33. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/utils/android_sdk.py +0 -0
  34. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/utils/cli.py +0 -0
  35. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/utils/distros.py +0 -0
  36. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/utils/flutter.py +0 -0
  37. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/utils/hash_stamp.py +0 -0
  38. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/utils/jdk.py +0 -0
  39. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/utils/merge.py +0 -0
  40. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/utils/plist.py +0 -0
  41. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/utils/processes.py +0 -0
  42. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/utils/project_dependencies.py +0 -0
  43. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli/utils/pyproject_toml.py +0 -0
  44. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli.egg-info/dependency_links.txt +0 -0
  45. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli.egg-info/entry_points.txt +0 -0
  46. {flet_cli-0.85.1 → flet_cli-0.85.3}/src/flet_cli.egg-info/top_level.txt +0 -0
  47. {flet_cli-0.85.1 → flet_cli-0.85.3}/tests/test_plist.py +0 -0
  48. {flet_cli-0.85.1 → flet_cli-0.85.3}/tests/test_project_dependencies.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flet-cli
3
- Version: 0.85.1
3
+ Version: 0.85.3
4
4
  Summary: Flet CLI
5
5
  Author-email: "Appveyor Systems Inc." <hello@flet.dev>
6
6
  License-Expression: Apache-2.0
@@ -9,7 +9,7 @@ Project-URL: Repository, https://github.com/flet-dev/flet
9
9
  Project-URL: Documentation, https://flet.dev/docs
10
10
  Requires-Python: >=3.10
11
11
  Description-Content-Type: text/markdown
12
- Requires-Dist: flet==0.85.1
12
+ Requires-Dist: flet==0.85.3
13
13
  Requires-Dist: watchdog>=4.0.0
14
14
  Requires-Dist: packaging>=25.0
15
15
  Requires-Dist: qrcode>=7.4.2
@@ -1,13 +1,13 @@
1
1
  [project]
2
2
  name = "flet-cli"
3
- version = "0.85.1"
3
+ version = "0.85.3"
4
4
  description = "Flet CLI"
5
5
  authors = [{ name = "Appveyor Systems Inc.", email = "hello@flet.dev" }]
6
6
  license = "Apache-2.0"
7
7
  readme = "README.md"
8
8
  requires-python = ">=3.10"
9
9
  dependencies = [
10
- "flet==0.85.1",
10
+ "flet==0.85.3",
11
11
  "watchdog >=4.0.0",
12
12
  "packaging >=25.0",
13
13
  "qrcode >=7.4.2",
@@ -826,6 +826,7 @@ class BaseBuildCommand(BaseFlutterCommand):
826
826
  "android.hardware.touchscreen": False,
827
827
  }
828
828
  android_meta_data = {}
829
+ android_providers = {}
829
830
 
830
831
  # merge values from "--permissions" arg:
831
832
  for p in (
@@ -922,6 +923,25 @@ class BaseBuildCommand(BaseFlutterCommand):
922
923
  else:
923
924
  self.cleanup(1, f"Invalid Android permission option: {p}")
924
925
 
926
+ for key, value in android_permissions.items():
927
+ if isinstance(value, bool):
928
+ continue
929
+ if isinstance(value, dict):
930
+ for ak, av in value.items():
931
+ if not isinstance(av, (str, bool, int, float)):
932
+ self.cleanup(
933
+ 1,
934
+ f"Invalid Android permission attribute value for "
935
+ f"{key}.{ak}: {type(av).__name__}. "
936
+ "Expected string, boolean, or number.",
937
+ )
938
+ continue
939
+ self.cleanup(
940
+ 1,
941
+ f"Invalid Android permission value for {key}: "
942
+ f"{type(value).__name__}. Expected boolean or inline table.",
943
+ )
944
+
925
945
  android_features = merge_dict(
926
946
  android_features,
927
947
  self.get_pyproject("tool.flet.android.feature") or {},
@@ -955,6 +975,88 @@ class BaseBuildCommand(BaseFlutterCommand):
955
975
  else:
956
976
  self.cleanup(1, f"Invalid Android meta-data option: {p}")
957
977
 
978
+ android_providers = merge_dict(
979
+ android_providers,
980
+ self.get_pyproject("tool.flet.android.provider") or {},
981
+ )
982
+
983
+ def _xml_attr_value(v):
984
+ # Android XML expects lowercase booleans.
985
+ if isinstance(v, bool):
986
+ return "true" if v else "false"
987
+ return v
988
+
989
+ normalized_providers = {}
990
+ for key, value in android_providers.items():
991
+ if value is False or value == {}:
992
+ continue
993
+ if value is True:
994
+ self.cleanup(
995
+ 1,
996
+ f"Invalid Android provider value for {key}: 'true' is not "
997
+ "supported. Use an inline table of attributes, or 'false' "
998
+ "to skip.",
999
+ )
1000
+ if not isinstance(value, dict):
1001
+ self.cleanup(
1002
+ 1,
1003
+ f"Invalid Android provider value for {key}: "
1004
+ f"{type(value).__name__}. Expected boolean or inline table.",
1005
+ )
1006
+ normalized = {}
1007
+ for ak, av in value.items():
1008
+ if ak == "name":
1009
+ self.cleanup(
1010
+ 1,
1011
+ f"Invalid Android provider attribute for {key}: "
1012
+ "'name' is reserved and is taken from the table key.",
1013
+ )
1014
+ if ak == "meta_data":
1015
+ if not isinstance(av, dict):
1016
+ self.cleanup(
1017
+ 1,
1018
+ f"Invalid Android provider meta_data for {key}: "
1019
+ f"{type(av).__name__}. Expected inline table.",
1020
+ )
1021
+ normalized_meta = {}
1022
+ for mk, mv in av.items():
1023
+ if isinstance(mv, (str, bool, int, float)):
1024
+ normalized_meta[mk] = _xml_attr_value(mv)
1025
+ continue
1026
+ if isinstance(mv, dict):
1027
+ normalized_attrs = {}
1028
+ for attr_key, attr_value in mv.items():
1029
+ if not isinstance(attr_value, (str, bool, int, float)):
1030
+ self.cleanup(
1031
+ 1,
1032
+ f"Invalid Android provider meta-data "
1033
+ f"attribute value for "
1034
+ f"{key}.meta_data.{mk}.{attr_key}: "
1035
+ f"{type(attr_value).__name__}. "
1036
+ "Expected string, boolean, or number.",
1037
+ )
1038
+ normalized_attrs[attr_key] = _xml_attr_value(attr_value)
1039
+ normalized_meta[mk] = normalized_attrs
1040
+ continue
1041
+ self.cleanup(
1042
+ 1,
1043
+ f"Invalid Android provider meta-data value for "
1044
+ f"{key}.meta_data.{mk}: {type(mv).__name__}. "
1045
+ "Expected string, boolean, number, or inline table.",
1046
+ )
1047
+ normalized["meta_data"] = normalized_meta
1048
+ continue
1049
+ if not isinstance(av, (str, bool, int, float)):
1050
+ self.cleanup(
1051
+ 1,
1052
+ f"Invalid Android provider attribute value for "
1053
+ f"{key}.{ak}: {type(av).__name__}. "
1054
+ "Expected string, boolean, or number.",
1055
+ )
1056
+ normalized[ak] = _xml_attr_value(av)
1057
+ normalized_providers[key] = normalized
1058
+ android_providers = normalized_providers
1059
+
958
1060
  deep_linking_scheme = (
959
1061
  self.get_pyproject("tool.flet.ios.deep_linking.scheme")
960
1062
  if self.package_platform == "iOS"
@@ -1107,6 +1209,7 @@ class BaseBuildCommand(BaseFlutterCommand):
1107
1209
  "android_permissions": android_permissions,
1108
1210
  "android_features": android_features,
1109
1211
  "android_meta_data": android_meta_data,
1212
+ "android_providers": android_providers,
1110
1213
  "deep_linking": {
1111
1214
  "scheme": deep_linking_scheme,
1112
1215
  "host": deep_linking_host,
@@ -1155,6 +1258,9 @@ class BaseBuildCommand(BaseFlutterCommand):
1155
1258
  template_ref = flet.version.flet_version
1156
1259
 
1157
1260
  is_local_dev = False
1261
+ # Identity printed in status / hashed for invalidation; may differ from
1262
+ # the path cookiecutter actually reads when caching kicks in below.
1263
+ template_source = template_url
1158
1264
  if template_url:
1159
1265
  # User-provided template (git repo or local path) — use checkout
1160
1266
  checkout = template_ref
@@ -1163,13 +1269,19 @@ class BaseBuildCommand(BaseFlutterCommand):
1163
1269
  local_tpl = Path(__file__).resolve().parents[5] / "templates" / "build"
1164
1270
  if local_tpl.is_dir():
1165
1271
  template_url = str(local_tpl)
1272
+ template_source = template_url
1166
1273
  checkout = None
1167
1274
  is_local_dev = True
1168
1275
  else:
1169
- template_url = DEFAULT_TEMPLATE_URL.format(version=template_ref)
1276
+ from flet_cli.utils.template_cache import get_cached_template_zip
1277
+
1278
+ template_source = DEFAULT_TEMPLATE_URL.format(version=template_ref)
1279
+ template_url = str(
1280
+ get_cached_template_zip(template_source, template_ref)
1281
+ )
1170
1282
  checkout = None
1171
1283
 
1172
- hash.update(template_url)
1284
+ hash.update(template_source)
1173
1285
  hash.update(template_ref)
1174
1286
 
1175
1287
  template_dir = self.options.template_dir or self.get_pyproject(
@@ -1195,7 +1307,7 @@ class BaseBuildCommand(BaseFlutterCommand):
1195
1307
  # create a new Flutter bootstrap project directory, if non-existent
1196
1308
  if not second_pass:
1197
1309
  self.flutter_dir.mkdir(parents=True, exist_ok=True)
1198
- status = f"[bold blue]Creating app shell from {template_url}"
1310
+ status = f"[bold blue]Creating app shell from {template_source}"
1199
1311
  if checkout:
1200
1312
  status += f' with ref "{template_ref}"'
1201
1313
  status += "..."
@@ -0,0 +1,48 @@
1
+ import os
2
+ import shutil
3
+ import urllib.request
4
+ from pathlib import Path
5
+
6
+
7
+ def get_cache_root() -> Path:
8
+ """Resolve the Flet on-disk cache root.
9
+
10
+ Uses `$FLET_CACHE_DIR` if set, otherwise `~/.flet/cache`. The resolved
11
+ path is exported back into the process environment so child processes
12
+ (notably the Gradle build of `serious_python_android`) share the same
13
+ cache root by default.
14
+ """
15
+ root = os.environ.get("FLET_CACHE_DIR")
16
+ cache_root = Path(root).expanduser() if root else Path.home() / ".flet" / "cache"
17
+ os.environ["FLET_CACHE_DIR"] = str(cache_root)
18
+ return cache_root
19
+
20
+
21
+ def get_cached_template_zip(url: str, version: str) -> Path:
22
+ """Return a local path to `flet-build-template.zip` for `version`.
23
+
24
+ The build template at a versioned release URL is immutable, so caching
25
+ is a simple "use if present, else download once" — no revalidation.
26
+ """
27
+ cache_path = (
28
+ get_cache_root() / "build-template" / f"v{version}" / "flet-build-template.zip"
29
+ )
30
+
31
+ if cache_path.exists() and cache_path.stat().st_size > 0:
32
+ return cache_path
33
+
34
+ cache_path.parent.mkdir(parents=True, exist_ok=True)
35
+ tmp_path = cache_path.with_suffix(cache_path.suffix + ".tmp")
36
+
37
+ try:
38
+ with urllib.request.urlopen(url) as resp, open(tmp_path, "wb") as out:
39
+ shutil.copyfileobj(resp, out)
40
+ out.flush()
41
+ os.fsync(out.fileno())
42
+ os.replace(tmp_path, cache_path)
43
+ except BaseException:
44
+ if tmp_path.exists():
45
+ tmp_path.unlink(missing_ok=True)
46
+ raise
47
+
48
+ return cache_path
@@ -0,0 +1 @@
1
+ version = "0.85.3"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flet-cli
3
- Version: 0.85.1
3
+ Version: 0.85.3
4
4
  Summary: Flet CLI
5
5
  Author-email: "Appveyor Systems Inc." <hello@flet.dev>
6
6
  License-Expression: Apache-2.0
@@ -9,7 +9,7 @@ Project-URL: Repository, https://github.com/flet-dev/flet
9
9
  Project-URL: Documentation, https://flet.dev/docs
10
10
  Requires-Python: >=3.10
11
11
  Description-Content-Type: text/markdown
12
- Requires-Dist: flet==0.85.1
12
+ Requires-Dist: flet==0.85.3
13
13
  Requires-Dist: watchdog>=4.0.0
14
14
  Requires-Dist: packaging>=25.0
15
15
  Requires-Dist: qrcode>=7.4.2
@@ -40,5 +40,6 @@ src/flet_cli/utils/plist.py
40
40
  src/flet_cli/utils/processes.py
41
41
  src/flet_cli/utils/project_dependencies.py
42
42
  src/flet_cli/utils/pyproject_toml.py
43
+ src/flet_cli/utils/template_cache.py
43
44
  tests/test_plist.py
44
45
  tests/test_project_dependencies.py
@@ -1,4 +1,4 @@
1
- flet==0.85.1
1
+ flet==0.85.3
2
2
  watchdog>=4.0.0
3
3
  packaging>=25.0
4
4
  qrcode>=7.4.2
@@ -1 +0,0 @@
1
- version = "0.85.1"
File without changes
File without changes
File without changes
File without changes