Skip to content
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

Automatically reload settings profile if it's redefined #4153

Merged
merged 3 commits into from
Nov 7, 2024

Conversation

DRMacIver
Copy link
Member

This is me following up on my note for later.

Previously if you reregistered a profile you'd need to then load it again before it came into use. This changes the logic so that's not the case.

The main motivation for this is is that if a user registers a CI profile this now ensure it will automatically be used on CI.

@Zac-HD
Copy link
Member

Zac-HD commented Nov 5, 2024

I'm overall -1 on this change, because it adds yet another complication to the already complicated behavior of our settings, and it's easy enough to get the same effect by typing settings.load_profile(whatever_you_registered) (and maybe if "CI" in os.environ:).

I'd even like to warn users about profile name collisions someday, and explicitly encouraging overrides feels counterproductive for that.

@DRMacIver
Copy link
Member Author

Hmm I think it actually decreases how complicated the system is by removing things it's possible to get wrong. It means that there's a coherent concept of "the current profile" which you can never be out of sync with.

I think if we didn't want profiles to be redefinable (which I'm not convinced of as a goal) we shouldn't have added a "ci" profile, and we can't add any other profiles in future.

@Zac-HD
Copy link
Member

Zac-HD commented Nov 6, 2024

Right, thinking about it as ".register_profile() reloads the current profile, to ensure that stays in sync" makes sense.

With that in mind I'd move most of the new docs to the docstring of .register_profile(), describe this as a general feature illustrated by the CI profile as one example, and just include a short reference to that from the current location.

Comment on lines 771 to 774
if is_in_ci(): # pragma: no cover
if is_in_ci(): # pragma: no
Copy link
Member

Choose a reason for hiding this comment

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

typo?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. Also apparently unneeded given that coverage tests aren't failing!

@Zac-HD Zac-HD merged commit 1ce7770 into master Nov 7, 2024
48 checks passed
@Zac-HD Zac-HD deleted the DRMacIver/reload-on-register branch November 7, 2024 16:22
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