Skip to content

fix(task): rename Task.get_param_names parameter to include_insignificant - #3478

Open
reginaldalfret wants to merge 1 commit into
spotify:masterfrom
reginaldalfret:fix/issue-3167-get-param-names-include-insignificant
Open

reginaldalfret wants to merge 1 commit into
spotify:masterfrom
reginaldalfret:fix/issue-3167-get-param-names-include-insignificant

Conversation

@reginaldalfret

Copy link
Copy Markdown

Summary

Fixes #3167

\Task.get_param_names\ had a confusing parameter named \include_significant=False. By default, only significant parameters were returned. Setting \include_significant=True\ caused insignificant parameters to be included in the output as well (\if include_significant or p.significant), making the parameter name opposite to its actual behavior.

This change:

  • Renames the parameter to \include_insignificant=False\ to clearly reflect that setting it to \True\ includes insignificant parameters.
  • Maintains backwards compatibility by supporting \include_significant\ with a \DeprecationWarning.\
  • Adds regression unit tests in \ est/task_test.py.\

Testing

  • Ran \pytest test/task_test.py\ with 42/42 tests passing.

…cant

Signed-off-by: reginaldalfret <reginaldalfret@gmail.com>

@Manishram-ai Manishram-ai left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice, keeping the old keyword working with a warning is a good call. Positional calls like get_param_names(True) still behave the same, and nothing in luigi itself passes the old keyword.

Two small things, both optional:

  • The deprecated argument can also be passed positionally now, so get_param_names(False, True) returns the insignificant params too. Making it keyword-only would avoid that: def get_param_names(cls, include_insignificant=False, *, include_significant=None).
  • If both are passed, the old one wins, so include_insignificant=True, include_significant=False returns only the significant ones. A TypeError when both are given could be clearer.

Also, #3168 does the same rename without the deprecation path, so one of the two can probably be closed.

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.

Misnamed parameter "include_significant" on method Task.get_param_names

2 participants