Fix Flet Android package entry point
This commit is contained in:
parent
d021fa9981
commit
5eb38dcf5e
5 changed files with 37 additions and 3 deletions
|
|
@ -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
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
13
main.py
Normal file
13
main.py
Normal file
|
|
@ -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)
|
||||
|
|
@ -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
|
||||
|
|
|
|||
11
tests/test_packaging.py
Normal file
11
tests/test_packaging.py
Normal file
|
|
@ -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)
|
||||
Loading…
Add table
Reference in a new issue