flet-cli 0.70.0.dev6281__tar.gz → 0.81.0.dev7173__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 (44) hide show
  1. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/PKG-INFO +2 -2
  2. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/pyproject.toml +2 -2
  3. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli/__pyinstaller/hook-flet.py +0 -2
  4. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli/cli.py +27 -8
  5. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli/commands/base.py +39 -5
  6. flet_cli-0.81.0.dev7173/src/flet_cli/commands/build.py +136 -0
  7. flet_cli-0.70.0.dev6281/src/flet_cli/commands/build.py → flet_cli-0.81.0.dev7173/src/flet_cli/commands/build_base.py +141 -462
  8. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli/commands/create.py +24 -14
  9. flet_cli-0.81.0.dev7173/src/flet_cli/commands/debug.py +156 -0
  10. flet_cli-0.81.0.dev7173/src/flet_cli/commands/devices.py +190 -0
  11. flet_cli-0.81.0.dev7173/src/flet_cli/commands/doctor.py +39 -0
  12. flet_cli-0.81.0.dev7173/src/flet_cli/commands/emulators.py +321 -0
  13. flet_cli-0.81.0.dev7173/src/flet_cli/commands/flutter_base.py +394 -0
  14. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli/commands/options.py +2 -1
  15. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli/commands/pack.py +45 -29
  16. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli/commands/publish.py +30 -19
  17. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli/commands/run.py +22 -15
  18. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli/commands/serve.py +10 -6
  19. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli/utils/android_sdk.py +47 -5
  20. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli/utils/flutter.py +8 -2
  21. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli/utils/project_dependencies.py +3 -4
  22. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli/utils/pyproject_toml.py +6 -2
  23. flet_cli-0.81.0.dev7173/src/flet_cli/version.py +1 -0
  24. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli.egg-info/PKG-INFO +2 -2
  25. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli.egg-info/SOURCES.txt +5 -0
  26. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli.egg-info/requires.txt +3 -1
  27. flet_cli-0.70.0.dev6281/src/flet_cli/commands/doctor.py +0 -68
  28. flet_cli-0.70.0.dev6281/src/flet_cli/version.py +0 -1
  29. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/README.md +0 -0
  30. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/setup.cfg +0 -0
  31. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli/__pyinstaller/__init__.py +0 -0
  32. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli/__pyinstaller/config.py +0 -0
  33. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli/__pyinstaller/macos_utils.py +0 -0
  34. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli/__pyinstaller/rthooks/pyi_rth_localhost_fletd.py +0 -0
  35. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli/__pyinstaller/utils.py +0 -0
  36. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli/__pyinstaller/win_utils.py +0 -0
  37. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli/utils/distros.py +0 -0
  38. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli/utils/hash_stamp.py +0 -0
  39. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli/utils/jdk.py +0 -0
  40. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli/utils/merge.py +0 -0
  41. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli/utils/processes.py +0 -0
  42. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli.egg-info/dependency_links.txt +0 -0
  43. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli.egg-info/entry_points.txt +0 -0
  44. {flet_cli-0.70.0.dev6281 → flet_cli-0.81.0.dev7173}/src/flet_cli.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flet-cli
3
- Version: 0.70.0.dev6281
3
+ Version: 0.81.0.dev7173
4
4
  Summary: Flet CLI
5
5
  Author-email: "Appveyor Systems Inc." <hello@flet.dev>
6
6
  License-Expression: Apache-2.0
@@ -13,7 +13,7 @@ Requires-Dist: flet
13
13
  Requires-Dist: watchdog>=4.0.0
14
14
  Requires-Dist: packaging>=25.0
15
15
  Requires-Dist: qrcode>=7.4.2
16
- Requires-Dist: toml>=0.10.2
16
+ Requires-Dist: tomli>=1.1.0; python_version < "3.11"
17
17
  Requires-Dist: cookiecutter>=2.6.0
18
18
 
19
19
  # Flet CLI
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "flet-cli"
3
- version = "0.70.0.dev6281"
3
+ version = "0.81.0.dev7173"
4
4
  description = "Flet CLI"
5
5
  authors = [{ name = "Appveyor Systems Inc.", email = "hello@flet.dev" }]
6
6
  license = "Apache-2.0"
@@ -11,7 +11,7 @@ dependencies = [
11
11
  "watchdog >=4.0.0",
12
12
  "packaging >=25.0",
13
13
  "qrcode >=7.4.2",
14
- "toml >=0.10.2",
14
+ "tomli >= 1.1.0 ; python_version < '3.11'",
15
15
  "cookiecutter >=2.6.0"
16
16
  ]
17
17
 
@@ -1,5 +1,3 @@
1
- import os
2
-
3
1
  import flet_cli.__pyinstaller.config as hook_config
4
2
  from flet_cli.__pyinstaller.utils import get_flet_bin_path
5
3
 
@@ -4,12 +4,14 @@ import sys
4
4
  import flet.version
5
5
  import flet_cli.commands.build
6
6
  import flet_cli.commands.create
7
- import flet_cli.commands.doctor # Adding the doctor command
7
+ import flet_cli.commands.debug
8
+ import flet_cli.commands.devices
9
+ import flet_cli.commands.doctor
10
+ import flet_cli.commands.emulators
8
11
  import flet_cli.commands.pack
9
12
  import flet_cli.commands.publish
10
13
  import flet_cli.commands.run
11
14
  import flet_cli.commands.serve
12
- from flet.version import update_version
13
15
 
14
16
 
15
17
  # Source https://stackoverflow.com/a/26379693
@@ -60,30 +62,47 @@ def set_default_subparser(
60
62
  args.insert(index, name)
61
63
 
62
64
 
63
- def main():
64
- parser = argparse.ArgumentParser()
65
+ def get_parser() -> argparse.ArgumentParser:
66
+ """Construct and return the CLI argument parser."""
67
+ parser = argparse.ArgumentParser(
68
+ formatter_class=argparse.RawDescriptionHelpFormatter
69
+ )
70
+
71
+ # add version flag
65
72
  parser.add_argument(
66
73
  "--version",
67
74
  "-V",
68
75
  action="version",
69
- version=flet.version.version if flet.version.version else update_version(),
76
+ version=(
77
+ f"Flet: {flet.version.flet_version}\n"
78
+ f"Flutter: {flet.version.flutter_version}\n"
79
+ f"Pyodide: {flet.version.pyodide_version}"
80
+ ),
70
81
  )
71
82
 
72
83
  sp = parser.add_subparsers(dest="command")
73
84
 
85
+ # register subcommands
74
86
  flet_cli.commands.create.Command.register_to(sp, "create")
75
87
  flet_cli.commands.run.Command.register_to(sp, "run")
76
88
  flet_cli.commands.build.Command.register_to(sp, "build")
89
+ flet_cli.commands.debug.Command.register_to(sp, "debug")
77
90
  flet_cli.commands.pack.Command.register_to(sp, "pack")
78
91
  flet_cli.commands.publish.Command.register_to(sp, "publish")
79
92
  flet_cli.commands.serve.Command.register_to(sp, "serve")
80
- flet_cli.commands.doctor.Command.register_to(
81
- sp, "doctor"
82
- ) # Register the doctor command
93
+ flet_cli.commands.emulators.Command.register_to(sp, "emulators")
94
+ flet_cli.commands.devices.Command.register_to(sp, "devices")
95
+ flet_cli.commands.doctor.Command.register_to(sp, "doctor")
83
96
 
84
97
  # set "run" as the default subparser
85
98
  set_default_subparser(parser, name="run", index=1)
86
99
 
100
+ return parser
101
+
102
+
103
+ def main():
104
+ parser = get_parser()
105
+
87
106
  # print usage/help if called without arguments
88
107
  if len(sys.argv) == 1:
89
108
  parser.print_help(sys.stdout)
@@ -1,9 +1,42 @@
1
1
  import argparse
2
- from typing import Any, List, Optional
2
+ from typing import Any, Optional
3
3
 
4
4
  from flet_cli.commands.options import Option, verbose_option
5
5
 
6
6
 
7
+ class CustomArgumentDefaultsHelpFormatter(argparse.HelpFormatter):
8
+ """
9
+ An argparse help formatter that appends default values to help text
10
+ selectively.
11
+
12
+ Defaults are added only when they are informative and not already
13
+ present in the help string. Noisy or redundant defaults (such as
14
+ None, empty lists, booleans for flag arguments, or suppressed values)
15
+ are omitted.
16
+ """
17
+
18
+ def _get_help_string(self, action: argparse.Action) -> str:
19
+ help_text = action.help or ""
20
+ default = action.default
21
+
22
+ # skip appending a default
23
+ if (
24
+ default is None
25
+ or default == []
26
+ or isinstance(default, bool) # store_true / store_false flags
27
+ or default is argparse.SUPPRESS
28
+ or any(token in help_text for token in ("%(default)", "(default:"))
29
+ ):
30
+ return help_text
31
+
32
+ # only add defaults for optionals or for nargs implying optional values
33
+ defaulting_nargs = (argparse.OPTIONAL, argparse.ZERO_OR_MORE)
34
+ if action.option_strings or action.nargs in defaulting_nargs:
35
+ help_text += " (default: %(default)s)"
36
+
37
+ return help_text
38
+
39
+
7
40
  class BaseCommand:
8
41
  """A CLI subcommand"""
9
42
 
@@ -13,7 +46,7 @@ class BaseCommand:
13
46
  description: Optional[str] = None
14
47
  # A list of pre-defined options which will be loaded on initializing
15
48
  # Rewrite this if you don't want the default ones
16
- arguments: List[Option] = [verbose_option]
49
+ arguments: list[Option] = [verbose_option]
17
50
 
18
51
  def __init__(self, parser: argparse.ArgumentParser) -> None:
19
52
  for arg in self.arguments:
@@ -25,14 +58,15 @@ class BaseCommand:
25
58
  cls,
26
59
  subparsers: argparse._SubParsersAction,
27
60
  name: Optional[str] = None,
28
- **kwargs: Any
61
+ **kwargs: Any,
29
62
  ) -> None:
30
63
  """Register a subcommand to the subparsers,
31
64
  with an optional name of the subcommand.
32
65
  """
33
66
  help_text = cls.description or cls.__doc__
34
67
  name = name or cls.name or ""
35
- # Remove the existing subparser as it will raises an error on Python 3.11+
68
+
69
+ # Remove the existing subparser as it will raise an error on Python 3.11+
36
70
  subparsers._name_parser_map.pop(name, None)
37
71
  subactions = subparsers._get_subactions()
38
72
  subactions[:] = [action for action in subactions if action.dest != name]
@@ -40,7 +74,7 @@ class BaseCommand:
40
74
  name,
41
75
  description=help_text,
42
76
  help=help_text,
43
- # formatter_class=PdmFormatter,
77
+ formatter_class=CustomArgumentDefaultsHelpFormatter,
44
78
  **kwargs,
45
79
  )
46
80
  command = cls(parser)
@@ -0,0 +1,136 @@
1
+ import argparse
2
+
3
+ from rich.console import Group
4
+ from rich.live import Live
5
+
6
+ from flet_cli.commands.build_base import BaseBuildCommand, console
7
+
8
+
9
+ class Command(BaseBuildCommand):
10
+ """
11
+ Build a Flet Python app into a platform-specific executable or
12
+ installable bundle. It supports building for desktop (macOS, Linux, Windows), web,
13
+ Android (APK/AAB), and iOS (IPA), with a wide range of customization options for
14
+ metadata, assets, splash screens, and signing.
15
+ """
16
+
17
+ def __init__(self, parser: argparse.ArgumentParser) -> None:
18
+ super().__init__(parser)
19
+
20
+ def add_arguments(self, parser: argparse.ArgumentParser) -> None:
21
+ parser.add_argument(
22
+ "target_platform",
23
+ type=str.lower,
24
+ choices=["macos", "linux", "windows", "web", "apk", "aab", "ipa"],
25
+ help="The target platform or type of package to build",
26
+ )
27
+ parser.add_argument(
28
+ "-o",
29
+ "--output",
30
+ dest="output_dir",
31
+ required=False,
32
+ help="Output directory for the final executable/bundle "
33
+ "(default: <python_app_path>/build/<target_platform>)",
34
+ )
35
+ super().add_arguments(parser)
36
+
37
+ def handle(self, options: argparse.Namespace) -> None:
38
+ super().handle(options)
39
+ assert self.target_platform
40
+ self.status = console.status(
41
+ f"[bold blue]Initializing {self.target_platform} build...",
42
+ spinner="bouncingBall",
43
+ )
44
+ with Live(Group(self.status, self.progress), console=console) as self.live:
45
+ self.initialize_command()
46
+ self.validate_target_platform()
47
+ self.validate_entry_point()
48
+ self.setup_template_data()
49
+ self.create_flutter_project()
50
+ self.package_python_app()
51
+ self.register_flutter_extensions()
52
+ if self.create_flutter_project(second_pass=True):
53
+ self.update_flutter_dependencies()
54
+ self.customize_icons()
55
+ self.customize_splash_images()
56
+ self.run_flutter()
57
+ self.copy_build_output()
58
+
59
+ self.cleanup(
60
+ 0,
61
+ message=(
62
+ f"Successfully built your [cyan]"
63
+ f"{self.platforms[self.target_platform]['status_text']}"
64
+ f"[/cyan]! {self.emojis['success']} "
65
+ f"Find it in [cyan]{self.rel_out_dir}[/cyan] directory. "
66
+ f"{self.emojis['directory']}"
67
+ + (
68
+ "\nRun [cyan]flet serve[/cyan] command to "
69
+ "start a web server with your app. "
70
+ if self.target_platform == "web"
71
+ else ""
72
+ )
73
+ ),
74
+ )
75
+
76
+ def add_flutter_command_args(self, args: list[str]):
77
+ assert self.options
78
+ assert self.build_dir
79
+ assert self.get_pyproject
80
+ assert self.template_data
81
+ assert self.target_platform
82
+
83
+ args.extend(
84
+ ["build", self.platforms[self.target_platform]["flutter_build_command"]]
85
+ )
86
+
87
+ if self.target_platform in "apk" and self.template_data["split_per_abi"]:
88
+ args.append("--split-per-abi")
89
+
90
+ if self.target_platform in ["ipa"]:
91
+ if self.template_data["ios_provisioning_profile"]:
92
+ args.extend(
93
+ [
94
+ "--export-options-plist",
95
+ "ios/exportOptions.plist",
96
+ ]
97
+ )
98
+ else:
99
+ args.append("--no-codesign")
100
+
101
+ build_number = self.options.build_number or self.get_pyproject(
102
+ "tool.flet.build_number"
103
+ )
104
+ if build_number:
105
+ args.extend(["--build-number", str(build_number)])
106
+
107
+ build_version = (
108
+ self.options.build_version
109
+ or self.get_pyproject("project.version")
110
+ or self.get_pyproject("tool.poetry.version")
111
+ )
112
+ if build_version:
113
+ args.extend(["--build-name", build_version])
114
+
115
+ for arg in (
116
+ self.get_pyproject(f"tool.flet.{self.config_platform}.flutter.build_args")
117
+ or self.get_pyproject("tool.flet.flutter.build_args")
118
+ or []
119
+ ):
120
+ args.append(arg)
121
+
122
+ def run_flutter(self):
123
+ assert self.platforms
124
+ assert self.target_platform
125
+
126
+ self.update_status(
127
+ f"[bold blue]Building [cyan]"
128
+ f"{self.platforms[self.target_platform]['status_text']}[/cyan]..."
129
+ )
130
+
131
+ self._run_flutter_command()
132
+
133
+ console.log(
134
+ f"Built [cyan]{self.platforms[self.target_platform]['status_text']}"
135
+ f"[/cyan] {self.emojis['checkmark']}",
136
+ )