Repository navigation
feat(operations.flatpak): add purge option to remove application data - #2114
samuelmalpin wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Purging skips residual data for already-uninstalled Flatpak applications because cleanup is limited to installed packages; independent cleanup and absent-application test coverage are needed.
1 open issue
What changed in this PR
Adds an opt-in purge parameter to pyinfra’s Flatpak package operation, allowing uninstall commands to request application-data deletion.
Changes:
- Adds
purge=Falseand documents the parameter. - Appends Flatpak’s
--delete-dataflag when purging packages selected for removal. - Adds command-generation fixtures for default and user installations.
| File | Description |
|---|---|
tests/operations/flatpak.packages/purge_packages.json |
Tests purge command generation for the default installation. |
tests/operations/flatpak.packages/purge_packages_user.json |
Tests purge command generation with --user. |
src/pyinfra/operations/flatpak.py |
Adds and documents the purge parameter and uninstall flag. |
Review effort: Balanced
| if remove_packages: | ||
| yield StringCommand( | ||
| f"flatpak uninstall --noninteractive{' --user' if user else ''}", | ||
| f"flatpak uninstall --noninteractive{' --user' if user else ''}{' --delete-data' if purge else ''}", |
Adding --purge flag to remove application data
dc02322 to
096186a
Compare
Fizzadar
left a comment
There was a problem hiding this comment.
Just the docs example inline, otherwise good!
| + remote: Source from which to install the application or runtime | ||
| + present: whether the package should be installed | ||
| + user: use the current user's installation instead of Flatpak's default | ||
| + purge: delete application data |
There was a problem hiding this comment.
Nit: worth saying this only applies when present=False?
There was a problem hiding this comment.
Yes you're right i will precise it
Co-authored-by: Nick Mills-Barrett <nick@fizzadar.com>
be060f4 to
7298499
Compare
wowi42
left a comment
There was a problem hiding this comment.
The code looks good to me. purge=True maps to Flatpak's --delete-data, with system and user fixtures. Please fill in the PR body and test checklist before merge.

This adds a
purgeoption toflatpak.packages. If you remove a package withpresent=Falseandpurge=True, it runsflatpak uninstallwith--delete-data,so the app's data gets deleted too.
It works for both system and user installs, and it's
Falseby default.I added tests for both install modes.
3.xat this time)scripts/dev-test.sh)scripts/dev-lint.sh)conventional commits format