-
Notifications
You must be signed in to change notification settings - Fork 600
feat: Expose Flutter version in flet.version module (FLUTTER_VERSION ) and cli (--flutter-version)
#5908
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
base: main
Are you sure you want to change the base?
Conversation
…ersion fetching logic
… version retrieval
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've reviewed this pull request using the Sourcery rules engine
Deploying flet-docs with
|
| Latest commit: |
0662abe
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://e4634b7f.flet-docs.pages.dev |
| Branch Preview URL: | https://expose-flutter-version.flet-docs.pages.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR exposes the Flutter SDK version used by Flet through a new FLUTTER_VERSION constant in the flet.version module and a --flutter-version CLI flag. This enables users and CI systems to programmatically determine the required Flutter SDK version for building Flet apps.
Key Changes:
- Added
FLUTTER_VERSIONconstant andget_flutter_version()function toflet.versionmodule with CI patching and.fvmrcfallback - Added
--flutter-versionCLI argument toflet buildcommand to print the required Flutter SDK version - Refactored version detection logic to use dedicated getter functions instead of conditional inline checks
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
sdk/python/packages/flet/src/flet/version.py |
Added FLUTTER_VERSION constant, PYODIDE_VERSION constant, and getter functions for version retrieval with fallback logic |
sdk/python/packages/flet/src/flet/__init__.py |
Exported __version__ following Python package conventions |
sdk/python/packages/flet-web/src/flet_web/__init__.py |
Added get_package_web_dir to __all__ exports |
sdk/python/packages/flet-desktop/src/flet_desktop/__init__.py |
Simplified version retrieval by removing redundant from_git() fallback |
sdk/python/packages/flet-cli/src/flet_cli/commands/serve.py |
Reformatted long string for better readability |
sdk/python/packages/flet-cli/src/flet_cli/commands/publish.py |
Changed route URL strategy to use proper RouteUrlStrategy type instead of string |
sdk/python/packages/flet-cli/src/flet_cli/commands/flutter_base.py |
Refactored to use flet.version.FLUTTER_VERSION and store required version as instance variable |
sdk/python/packages/flet-cli/src/flet_cli/commands/doctor.py |
Simplified Flet version display logic |
sdk/python/packages/flet-cli/src/flet_cli/commands/devices.py |
Removed trailing periods from help messages for consistency |
sdk/python/packages/flet-cli/src/flet_cli/commands/create.py |
Simplified template reference logic using guaranteed non-empty version |
sdk/python/packages/flet-cli/src/flet_cli/commands/build_base.py |
Removed duplicate PYODIDE_ROOT_URL constant and simplified version checks |
sdk/python/packages/flet-cli/src/flet_cli/commands/build.py |
Added --flutter-version CLI argument for version display |
.github/workflows/ci.yml |
Updated Python version to 3.12.7, added Pyodide version extraction from flet.version, and improved working directory consistency |
.github/scripts/read_fvmrc.py |
New utility script to read Flutter version from .fvmrc file |
.github/scripts/common.sh |
Enhanced version patching to include Flutter SDK version from .fvmrc, converted to subshell for safer execution |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Instead of separate Even better, it could be
I suggest we switch to |
|
Re: flet.version.flet_version
flet.version.flutter_version
flet.version.pyodide_versionwhich could be used as: from flet.version import flet_version, flutter_version, pyodide_versioninside right? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New security issues found
| retcode = subprocess.call( | ||
| [ | ||
| sys.executable, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
security (python.lang.security.audit.dangerous-subprocess-use-audit): Detected subprocess function 'call' without a static string. If this data can be controlled by a malicious actor, it may be an instance of command injection. Audit the use of this call to ensure it is not controllable by an external resource. You may consider using 'shlex.escape()'.
Source: opengrep
Copilot summary
This pull request introduces improvements to how the required Flutter SDK version is managed and propagated throughout the Python SDK and CLI, making the build process more robust and consistent. The Flutter version is now dynamically read from the
.fvmrcfile and patched into the Python package, ensuring that all tooling and commands use the correct version. Additionally, there are minor improvements and cleanups in CLI argument handling and code organization.Flutter SDK Version Management:
patch_python_package_versionsfunction in.github/scripts/common.shnow reads the Flutter version from.fvmrcusing a new script (read_fvmrc.py) and injects it intoflet/version.py, ensuring the Python SDK always knows the correct Flutter version.flet-cli) commands now use the patchedFLUTTER_VERSIONfromflet.version, and all Flutter-related logic (installation, validation, prompts) references this dynamically set version instead of a hardcoded value.CI/CD and Build Pipeline Adjustments:
ci.yml) is updated to ensure the environment is prepared with the correct Flutter version before building, and the working directory is set appropriately for each step. Redundant or misplaced version patching is removed from later build steps.CLI and SDK Code Cleanups:
flet.version, removing fallback logic and ensuring version consistency.Examples
In a python file
CLI
GitHub Action
Summary by Sourcery
Expose and centralize version metadata for Flet, Flutter, and Pyodide, and wire it into the CLI, library API, and CI workflows.
New Features:
Bug Fixes:
Enhancements:
Build:
CI:
Documentation: