Skip to content

Rename flet.app() to flet.run() + improve code and docs in some files #5287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

bleudev
Copy link
Contributor

@bleudev bleudev commented May 7, 2025

Description

I made task to rename flet.app() to flet.run() in issue #5238. Also i renamed app_async() to run_async(). I did annotations for these methods, but i need help with host parameter in app() and app_async(). I don't know its type. Also i simplified some code in app.py. Maybe i will do some extra fixes in another files.

Fixed that things from #5238:

  • SegmentedButton: selected: List[str] instead of Optional[Set]. Example: selected=["1", "4"] instead of selected={"1", "4"}. TODO: support sets in flet V1
  • ft.app(target=main) should be changed to ft.run(main) or ft.run(main=main)

Test Code

# Test code for the review of this PR

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist

  • I signed the CLA.
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • New and existing tests pass locally with my changes
  • I have made corresponding changes to the documentation (if applicable)*

*i can do it. I suggest to add documentation for flet.run() and flet.run_async() (i didn't find it), i can help with it.

Screenshots

Additional details

Summary by Sourcery

Rename flet.app() and flet.app_async() to flet.run() and flet.run_async() respectively, introducing improved type annotations and deprecation handling.

New Features:

  • Added type annotations to app/run methods

Bug Fixes:

  • Updated SegmentedButton to use List[str] instead of Optional[Set]

Enhancements:

  • Simplified conditional logic in functions
  • Improved deprecation warning mechanism
  • Enhanced type safety for method parameters

Chores:

  • Refactored deprecated method handling
  • Updated utility functions with type hints

@bleudev
Copy link
Contributor Author

bleudev commented May 7, 2025

Maybe i will rename target param to main (i saw that in #5238)?

@bleudev bleudev changed the title Rename flet.app() to flet.run() Rename flet.app() to flet.run() + improve code and docs in some files May 7, 2025
@bleudev
Copy link
Contributor Author

bleudev commented May 7, 2025

@sourcery-ai summary

@bleudev
Copy link
Contributor Author

bleudev commented May 7, 2025

@sourcery-ai review

@FeodorFitsner
Copy link
Contributor

We are currently working hard on releasing "v1" which, actually, has ft.app() renamed to ft.run(). I'm not sure we need to touch that in 0.2x releases though?

@bleudev
Copy link
Contributor Author

bleudev commented May 7, 2025

We are currently working hard on releasing "v1" which, actually, has ft.app() renamed to ft.run(). I'm not sure we need to touch that in 0.2x releases though?

Maybe we can add, but without deletion of deprecations in 0.x versions. Maybe we'll delete deprecations in 1.0?

@bleudev
Copy link
Contributor Author

bleudev commented May 7, 2025

@sourcery-ai summary

@bleudev
Copy link
Contributor Author

bleudev commented May 8, 2025

@FeodorFitsner Can you review my PR? I wants to help with easy for me things, how before)

@FeodorFitsner
Copy link
Contributor

Well, thanks for your help. However, our goal is to avoid pushing any changes (except bug fixes) to 0.2x releases and focus on 0.70 (which is pre "v1"). I'd like to leave ft.app() for the current 0.2x and make ft.run() in 0.70. We don't have resources to migrate "v1" functionality to 0.2x. Don't spend your time on 0.2x but rather get familiar with "v1" branch. I'm afraid I'll close this PR later any way.

@FeodorFitsner
Copy link
Contributor

Some small fixes, polishing for 0.2x - YES, changing/adding/removing functionality - NO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants