Skip to content

DEP: deprecate positional arguments for signatures being changed in 1.17 cycle #18703

@h-vetinari

Description

@h-vetinari

Following https://docs.scipy.org/doc/scipy/dev/missing-bits.html#required-keyword-names, we should use the removal of keywords as an opportunity to turn relevant arguments in the signature into keyword-only arguments.

This needs a separate deprecation from the one that just warns about removing a given kwarg (although if the kwarg being deprecated is early in the signature, it might end up being equivalent), to warn users that feed kwargs positionally that they need to pass them as keywords going forward.

The mechanism for emitting a good deprecation warning on this is not so straight-forward, but scikit-learn came up with a good helper for their own effort in this direction that we can vendor here.

This is aimed particularly at the functions being touched in #18624, but is in force for all function signatures where kwargs are being scheduled for removal (or otherwise changed).

More context: #14714

TODO: follow-ups to

  • <PRs that introduce signature changes during 1.15>

Metadata

Metadata

Assignees

No one assigned

    Labels

    deprecatedItems related to behavior that has been deprecated

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions