Repository navigation
Revert breaking change to node_link_* link defaults - #7652
Merged
Merged
Conversation
Member
|
I like the noisy-warning-with-fix approach. |
dschult
approved these changes
Sep 27, 2024
jarrodmillman
approved these changes
Sep 29, 2024
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.
Follow-up to #7565
One of the changes in #7565 was to change the default value for the
edges(cf.link) parameter from"links"to the more networkx-y"edges". At the time of the discussion, this was recognized as a breaking change, but the consensus (including my own opinion) was that it was better to get all of the changes in now rather than have multiple deprecation cycles.However, this change did lead to a break downstream in
nx-guides, which can be interpreted as a proxy for how disruptive any change might be in user-code. Essentially, changing the default without warning will affect any user attempting to read saved graphs saved innode_linkformat with the default edge values. Given this, I do now think a deprecation cycle is a good idea - not only does it avoid breakage in all existing code that relies on default values, but there's also a way to provide users with a "fixable" warning; i.e. a recommended change that will make the code more explicit and be forward-compatible. Here's a quick example of what this proposal looks like:The downside here is that this warning is a lot more noisy than the DeprecationWarning, as it is emitted whenever the function is called with the default value for
link. However, I think this noisiness is just a consequence of changing a default in the API - in other words I don't see a good way around it. We can either raise a noisy warning (with a proposed fix that will make the warning go away) or we just break user code.The only other alternative I could think of was to continue with the current plan (i.e. don't warn) and add special-casing logic for certain values of
edges/linksto raise specific exceptions that clearly state what the issue is (right now, users get a generic KeyError). IMO though, if you're going to raise special exceptions for the same special cases, you might as well warn instead and give users an opportunity to avoid the exception.