diff --git a/README.md b/README.md index 290982e..d75e4d2 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ is not evidence that the missing VPN data path works. ```bash uv sync -uv run flet run app/main.py +uv run flet run uv run pytest ``` diff --git a/docs/building.md b/docs/building.md index bf0a308..4dc5715 100644 --- a/docs/building.md +++ b/docs/building.md @@ -5,7 +5,7 @@ ```bash uv sync uv run pytest -uv run flet run app/main.py +uv run flet run ``` `uv` уже был установлен в рабочем окружении. Flet current build creates a Flutter diff --git a/main.py b/main.py new file mode 100644 index 0000000..278f2e3 --- /dev/null +++ b/main.py @@ -0,0 +1,13 @@ +"""Flet packaging entry point. + +The application code lives in the ``app`` package. Keeping this tiny launcher at the +configured Flet app root ensures that Android packages the package itself, rather than +only its contents. +""" + +import flet as ft + +from app.main import main + +if __name__ == "__main__": + ft.run(main) diff --git a/pyproject.toml b/pyproject.toml index 9e13333..94b67f4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,8 +33,18 @@ copyright = "Copyright (C) 2026 SNW" platforms = ["android", "linux", "windows"] [tool.flet.app] -path = "app" +path = "." module = "main" +exclude = [ + ".git", + ".venv", + "backend", + "build", + "docs", + "native", + "scripts", + "tests", +] [tool.flet.android] min_sdk_version = 26 diff --git a/tests/test_packaging.py b/tests/test_packaging.py new file mode 100644 index 0000000..8f5606b --- /dev/null +++ b/tests/test_packaging.py @@ -0,0 +1,11 @@ +import importlib +import tomllib +from pathlib import Path + + +def test_flet_entry_point_keeps_app_as_a_package() -> None: + config = tomllib.loads(Path("pyproject.toml").read_text()) + assert config["tool"]["flet"]["app"]["path"] == "." + assert config["tool"]["flet"]["app"]["module"] == "main" + entry = importlib.import_module("main") + assert callable(entry.main)