Skip to content

API: Add a decorator to deprecate positional args - #6905

Merged
rossbar merged 2 commits into
networkx:mainfrom
MridulS:subgraphview_keyword_only
Sep 12, 2023
Merged

rossbar merged 2 commits into
networkx:mainfrom
MridulS:subgraphview_keyword_only

Conversation

@MridulS

@MridulS MridulS commented Sep 5, 2023

Copy link
Copy Markdown
Member

Scikit-learn has a decorator which took care of the deprecation cycle for moving to keyword args from positional args. I have vendored that in as a networkx decorator.

This should resolve #4845.

@MridulS
MridulS requested a review from dschult September 5, 2023 20:54

@rossbar rossbar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1 for the sklearn deprecator - that's a really nice dev feature and something that we've talked about in the past wrt. SLEP 9.

You might consider adding the deprecator in a separate PR, but the only reason to do so is on the off-chance that we want to revert the kwarg-only-ness of the filter_ params in the future. I don't think this is very likely, so +1 for having everything lumped together in 1 PR.

Thanks for pushing this forward @MridulS !

@dschult dschult left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Wow -- very nice!
Luv the input parameter revamp that python inspection allows. :}

I think subgraph_view is a good testcase to use it on too.
I approve this PR.

@MridulS MridulS added this to the 3.2 milestone Sep 6, 2023
@rossbar
rossbar merged commit 766e3af into networkx:main Sep 12, 2023
Alex-Markham pushed a commit to Alex-Markham/networkx that referenced this pull request Oct 13, 2023
* MAINT: Add a decorator to deprecate positional args

* update our codebase with keyword only
dschult pushed a commit to BrunoBaldissera/networkx that referenced this pull request Oct 23, 2023
* MAINT: Add a decorator to deprecate positional args

* update our codebase with keyword only
cvanelteren pushed a commit to cvanelteren/networkx that referenced this pull request Apr 22, 2024
* MAINT: Add a decorator to deprecate positional args

* update our codebase with keyword only
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

show_edges() based on show_nodes() fails

3 participants