From dad897049e11092e7e56427e4a3c391d5d80e24f Mon Sep 17 00:00:00 2001 From: Feodor Fitsner Date: Fri, 6 Dec 2024 10:29:41 -0800 Subject: [PATCH] Add `flet` if no dependencies provided for `flet publish` command Fix #4493 --- sdk/python/packages/flet-cli/src/flet_cli/commands/publish.py | 4 ++++ sdk/python/packages/flet/src/flet/cli.py | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sdk/python/packages/flet-cli/src/flet_cli/commands/publish.py b/sdk/python/packages/flet-cli/src/flet_cli/commands/publish.py index 6a575e81f..1f8d95f17 100644 --- a/sdk/python/packages/flet-cli/src/flet_cli/commands/publish.py +++ b/sdk/python/packages/flet-cli/src/flet_cli/commands/publish.py @@ -113,6 +113,7 @@ def add_arguments(self, parser: argparse.ArgumentParser) -> None: ) def handle(self, options: argparse.Namespace) -> None: + import flet.version from flet.utils.pip import ensure_flet_web_package_installed ensure_flet_web_package_installed() @@ -197,6 +198,9 @@ def handle(self, options: argparse.Namespace) -> None: ) print(f"{reqs_filename} dependencies: {deps}") + if len(deps) == 0: + deps = [f"flet=={flet.version.version}"] + temp_reqs_txt = Path(tempfile.gettempdir()).joinpath(random_string(10)) with open(temp_reqs_txt, "w") as f: f.writelines(dep + "\n" for dep in deps) diff --git a/sdk/python/packages/flet/src/flet/cli.py b/sdk/python/packages/flet/src/flet/cli.py index 8e9ec2c1c..2bc8eac4e 100644 --- a/sdk/python/packages/flet/src/flet/cli.py +++ b/sdk/python/packages/flet/src/flet/cli.py @@ -1,7 +1,6 @@ import subprocess import sys -import flet.version from flet.utils.pip import ensure_flet_cli_package_installed