Skip to content

Add --checkup mode to check user configuration#1509

Open
rolandwalker wants to merge 1 commit intomainfrom
RW/add-configuration-checkup-feature
Open

Add --checkup mode to check user configuration#1509
rolandwalker wants to merge 1 commit intomainfrom
RW/add-configuration-checkup-feature

Conversation

@rolandwalker
Copy link
Contributor

Description

This helps the user who has upgraded see which new features are silently being set to the package defaults.

last image

Checklist

  • I added this contribution to the changelog.md file.
  • I added my name to the AUTHORS file (or it's already there).
  • To lint and format the code, I ran
    uv run ruff check && uv run ruff format && uv run mypy --install-types .

@rolandwalker rolandwalker self-assigned this Feb 4, 2026
@rolandwalker rolandwalker force-pushed the RW/add-configuration-checkup-feature branch from ad6d66c to 7dc6f45 Compare February 4, 2026 11:28
This helps the user who has upgraded see which new features are silently
being set to the package defaults.
@rolandwalker rolandwalker force-pushed the RW/add-configuration-checkup-feature branch from 7dc6f45 to 3fd95b0 Compare February 5, 2026 09:21
if section_name not in mycli.config_without_package_defaults:
if not did_output:
print('\nMissing in user ~/.myclirc:\n')
print(f'The entire section:\n\n [{section_name}]\n')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to:

for toplevel in ['main', 'connection']:

This won't ever fire for the [main] or [connection] sections (will just output every option in the section). Likely wouldn't happen for [main] when upgrading, but possible for [connection] since that is newer. Not a big deal, but wanted to point it out in case it matters.

def do_config_checkup(mycli: MyCli) -> None:
did_output = False
for section_name in mycli.config.keys():
if section_name not in mycli.config_without_package_defaults:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If no user .myclirc exists, it will output every option as missing. Similar vein to the below comment that this may not matter for an upgrade situation, but might be worth adding a check to do nothing if no file exists.

Copy link
Contributor

@scottnemes scottnemes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified overall functionality works as expected. Tested by removing an option as well as entire sections, and it output as expected.

Approving as-is, but see comments in case you want to change anything.

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