Skip to content

Change default of inject noise site to "after"#372

Open
joshuasn wants to merge 2 commits into
mainfrom
injection-site-default
Open

Change default of inject noise site to "after"#372
joshuasn wants to merge 2 commits into
mainfrom
injection-site-default

Conversation

@joshuasn

Copy link
Copy Markdown
Collaborator

Summary

Changes the defaults of the boxing pass manager and the AddInjectNoise pass to use "after" as the default.

Details and comments

@ihincks ihincks left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks Josh!

While it is in our rights to make this breaking change, I'd suggest doing it via a deprecation period in this case. So, assign the default values to None for now, have None be coerced into "before" so that this PR doesn't introduce a change, but also have None (but not "before") cause a deprecation warning. Then, in the next release or the one after, we can make the break.

@ihincks ihincks left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should we treat the InjectNoise annotation in the same way as generate_boxing_pass_manager?

if inject_noise_site is None:
warnings.warn(
"The default of the 'inject_noise_site' argument will be changed from "
"`'before'` to after in version 0.21.0.",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"`'before'` to after in version 0.21.0.",
"`'before'` to `"after"` no sooner than version 0.21.0.",

warnings.warn(
"The default of the 'inject_noise_site' argument will be changed from "
"`'before'` to after in version 0.21.0.",
DeprecationWarning,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I wonder if we want a FutureWarning here instead of a DeprecationWarning: the target audience is users and not CI, afaik.

https://docs.python.org/3/library/warnings.html#warning-categories

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