Repository navigation
Fix flet build not reinstalling packages after requirements.txt changes - #6996
Open
ndonkoHenri wants to merge 4 commits into
Open
ndonkoHenri wants to merge 4 commits into
ndonkoHenri wants to merge 4 commits into
Conversation
…gone `flet build` skips reinstalling the app's packages when a hash of the package arguments is unchanged. For requirements.txt those arguments hold only the file's path, and its contents entered the hash only with -vv, so adding or changing a dependency kept the previous build's packages. The check also never looked at site-packages, so deleting it while build/.hash stayed produced an app without its packages. Always hash the text of requirements.txt and of the files it includes with -r/-c, and skip installing only when site-packages exists and isn't empty. Fixes #6994
ndonkoHenri
requested review from
FeodorFitsner
and
a balanced review from Copilot
October 23, 2026 23:28
1 task done
Deploying flet-website-v2 with
|
| Latest commit: |
629b2db
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://a143a2ce.flet-website-v2.pages.dev |
| Branch Preview URL: | https://fix-requirements-txt-rebuild.flet-website-v2.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6994.
flet buildskips reinstalling the app's packages (--skip-site-packages) when a hash of the package arguments hasn't changed since the last build. Two holes in that check made builds silently ship the wrong packages:requirements.txtedits were invisible. Only the file's path is in the package arguments (pip reads the file itself), and its contents were added to the hash only under-vv. Adding or changing a dependency kept the previous build's packages. Projects with dependencies inpyproject.tomlweren't affected, since each dependency is its own argument.site-packageswas never checked. Ifbuild/site-packageswas deleted whilebuild/.hashstayed (for example a CI cache restoring one but not the other), pip was still skipped and the app shipped without any third-party packages, failing at import.Changes:
read_requirements_file_text()(flet_cli/utils/project_dependencies.py) returns the text ofrequirements.txtplus the files it includes with-r/--requirementor-c/--constraint, resolved relative to the including file. URLs and missing files are skipped, and files that include each other are read once. Its output always goes into the hash;-vvnow only controls logging it._site_packages_missing()(build_base.py): pip is skipped only when the directory serious_python installs into exists and isn't empty:build/site-packageson native platforms,build/flutter/build/site-packageson web.Testing
Three consecutive builds of a
requirements.txtapp (fletonly), unmodifiedflet-1.1.0CLI vs this branch:flet-1.1.0(web)tabulatetorequirements.txt, rebuildtabulatemissingtabulateinstalledsite-packages, rebuildNew unit tests cover
read_requirements_file_text()(include spellings, nesting, cycles, URLs/missing files, editing only an included file). The flet-cli suite passes.Summary by Sourcery
Make
flet buildreliably refresh application packages when dependency files or cached package artifacts change.Bug Fixes:
flet buildreinstalls packages whenrequirements.txtor its included files change.Enhancements:
Tests: