Skip to content

refactor: keyword-only booleans on the applications functions - #535

Merged
gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:refactor/keyword-only-booleans
Aug 27, 2026
Merged

gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:refactor/keyword-only-booleans

Conversation

@gaborbernat

@gaborbernat gaborbernat commented Aug 27, 2026 •

Copy link
Copy Markdown
Member

Follow-up to the question on #531 about the FBT suppressions. They are only needed because the booleans are positional, which is the thing the rule objects to, and a * fixes the finding rather than silencing it.

Scoped to arguments that have never shipped, so nothing breaks. user_applications_dir and user_applications_path took no arguments in 4.11.4; the ensure_exists and use_site_for_root that #534 gave them are still unreleased, so no caller can be passing them positionally. Making them keyword-only now costs nothing and removes the four suppressions.

Released signatures are untouched. site_applications_dir and site_applications_path keep multipath and ensure_exists positional, as they have been since 4.9.0, and their suppressions stay. I checked every public function in __init__.py against the 4.11.4 tag: no released parameter changes name, position or kind.

I first wrote this as a sweep over all 55 functions and PlatformDirs, which would have taken the suppressions from 88 down to 17. That is not worth breaking every caller who passes a boolean positionally, so it is out. If you ever cut a major, the diff is easy to reproduce.

appname, appauthor and version stay positional throughout. A test pins the new shape so it does not quietly regress.

Testing: tox -e fix, -e type, -e docs clean, full suite passes. The four test_comp_with_appdirs[site_data_dir-*] failures reproduce on a clean origin/main worktree from a local XDG_DATA_DIRS.

@gaborbernat
gaborbernat requested a review from ofek as a code owner August 27, 2026 20:55
user_applications_dir and user_applications_path took no arguments in
4.11.4, so the ensure_exists and use_site_for_root that tox-dev#534 gave them
have never shipped and nothing can be passing them positionally. Making
them keyword-only there is free, and drops the FBT suppressions that only
existed because they were positional.

Released signatures are untouched. site_applications_dir keeps multipath
and ensure_exists positional as it has had them since 4.9.0.
@gaborbernat
gaborbernat force-pushed the refactor/keyword-only-booleans branch from 368640e to 626e873 Compare August 27, 2026 21:12
@gaborbernat gaborbernat added the skip news No news fragment needed label Aug 27, 2026
@gaborbernat gaborbernat changed the title refactor!: make the boolean options keyword-only refactor: keyword-only booleans on the applications functions Aug 27, 2026
@gaborbernat
gaborbernat merged commit 56a9bc7 into tox-dev:main Aug 27, 2026
36 checks passed
@gaborbernat
gaborbernat deleted the refactor/keyword-only-booleans branch October 3, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news No news fragment needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant