flet icon indicating copy to clipboard operation
flet copied to clipboard

bug: Dependicies not packing fully on flet build apk

Open amogus-gggy opened this issue 3 months ago • 1 comments

Duplicate Check

  • [x] I have searched the opened issues and there are no duplicates

Describe the bug

Flet cli doesn't pack dependency "python-access-modifiers" even when i put it in pyproject.toml Its pure python package.

Code sample

Code
import flet as ft
from python_access_modifiers import private, protected, constant, field_access_modifiers, Protected

@field_access_modifiers
class Person:
    name: str           # по умолчанию public
    age: Protected[int] # объявим как protected поле

    def __init__(self, name: str, age: int):
        self.name = name
        self.age = age
        self._private_note = "secret"  # обычное имя

    @protected
    def get_age(self) -> int:
        return self.age

    @private
    def _private_method(self) -> str:
        return f"Private note: {self._private_note}"

    @constant
    def constant_method(self) -> str:
        return "I can't be overridden"

    def public_method(self) -> str:
        # внутри класса мы имеем доступ к protected и private
        age = self.get_age()
        pr = self._private_method()
        return f"Name: {self.name}, Age: {age}, {pr}"


def main(page: ft.Page):
    p = Person("Bob", 25)

    txt = ft.Text(f"Public method output: {p.public_method()}")
    page.add(txt)

    # Попытка вызвать защищённый метод напрямую — должно выдать ошибку
    try:
        res = p.get_age()
    except RuntimeError as e:
        res = f"RuntimeError: {e}"
    page.add(ft.Text(f"Direct get_age(): {res}"))

    # Попытка вызвать приватный метод напрямую — должно выдать ошибку
    try:
        res2 = p._private_method()
    except RuntimeError as e:
        res2 = f"RuntimeError: {e}"
    page.add(ft.Text(f"Direct _private_method(): {res2}"))

    page.update()

ft.app(main)

To reproduce

Build apk with python-access-modifiers in dependicies and use it in app.

Expected behavior

Just work with lib

Screenshots / Videos

Captures

[Upload media here]

Operating System

Windows

Operating system details

10

Flet version

0.28.3

Regression

I'm not sure / I don't know

Suggestions

Force adding packages to sitepackages for android

Logs

Logs
[Paste your logs here]

Additional details

No response

amogus-gggy avatar Oct 03 '25 17:10 amogus-gggy

I gave it a try on the latest pre-release and it works:

import flet as ft
from python_access_modifiers import (
    Protected,
    constant,
    field_access_modifiers,
    private,
    protected,
)


@field_access_modifiers
class Person:
    name: str  # by default public
    age: Protected[int]  # declare as protected field

    def __init__(self, name: str, age: int):
        self.name = name
        self.age = age
        self._private_note = "secret"  # обычное имя

    @protected
    def get_age(self) -> int:
        return self.age

    @private
    def _private_method(self) -> str:
        return f"Private note: {self._private_note}"

    @constant
    def constant_method(self) -> str:
        return "I can't be overridden"

    def public_method(self) -> str:
        # внутри класса мы имеем доступ к protected и private
        age = self.get_age()
        pr = self._private_method()
        return f"Name: {self.name}, Age: {age}, {pr}"


def main(page: ft.Page):
    p = Person("Bob", 25)

    page.add(ft.Text(f"Public method output: {p.public_method()}"))

    # Attempt to call the protected method directly - should raise an error
    try:
        res = p.get_age()
    except RuntimeError as e:
        res = f"RuntimeError: {e}"
    page.add(ft.Text(f"Direct get_age(): {res}"))

    # Attempt to call the protected method directly - should raise an error
    try:
        res2 = p._private_method()
    except RuntimeError as e:
        res2 = f"RuntimeError: {e}"

    page.add(ft.Text(f"Direct _private_method(): {res2}"))


ft.run(main)
Image

Give it a try and let know.

You can use the normal flet build apk or the new flet debug.

ndonkoHenri avatar Dec 12 '25 13:12 ndonkoHenri