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
|
```bash
|
||||||
uv sync
|
uv sync
|
||||||
uv run flet run app/main.py
|
uv run flet run
|
||||||
uv run pytest
|
uv run pytest
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
```bash
|
```bash
|
||||||
uv sync
|
uv sync
|
||||||
uv run pytest
|
uv run pytest
|
||||||
uv run flet run app/main.py
|
uv run flet run
|
||||||
```
|
```
|
||||||
|
|
||||||
`uv` уже был установлен в рабочем окружении. Flet current build creates a Flutter
|
`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"]
|
platforms = ["android", "linux", "windows"]
|
||||||
|
|
||||||
[tool.flet.app]
|
[tool.flet.app]
|
||||||
path = "app"
|
path = "."
|
||||||
module = "main"
|
module = "main"
|
||||||
|
exclude = [
|
||||||
|
".git",
|
||||||
|
".venv",
|
||||||
|
"backend",
|
||||||
|
"build",
|
||||||
|
"docs",
|
||||||
|
"native",
|
||||||
|
"scripts",
|
||||||
|
"tests",
|
||||||
|
]
|
||||||
|
|
||||||
[tool.flet.android]
|
[tool.flet.android]
|
||||||
min_sdk_version = 26
|
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