-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
add_deprecation_to_docstring
for docsite deprecation support (#…
…9685) * Add deprecations to function docstring * Work around issue with multiline strings * Better variable name * Jake's review feedback * Make Napoleon check case-insensitive * Promote add_deprecation_to_docstring to be public It may be useful for Applications/Ecosystem, when they want this functionality but want to keep using their own deprecation decorators * Properly error when metadata line is the first line * Tests feedback: don't use helper function and simplify instructions to generate tests * Don't use the function with @deprecate_function and @deprecate_arguments yet This makes the PR a smaller diff, so easier to review and also less risk when we land that it breaks something. Now, this PR only adds new functionality, the public `add_deprecation_to_docstring` function * Update qiskit/utils/deprecation.py Co-authored-by: Luciano Bello <bel@zurich.ibm.com> * Update qiskit/utils/deprecation.py Co-authored-by: Luciano Bello <bel@zurich.ibm.com> * Add release note --------- Co-authored-by: Luciano Bello <bel@zurich.ibm.com>
- Loading branch information
1 parent
c2affb1
commit 3005806
Showing
3 changed files
with
498 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
8 changes: 8 additions & 0 deletions
8
releasenotes/notes/new-deprecation-utilities-066aff05e221d7b1.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
features: | ||
- | | ||
Added the function ``qiskit.util.deprecation.add_deprecation_to_docstring()``. | ||
It will rewrite the function's docstring to include a Sphinx ``.. deprecated::` directive | ||
so that the deprecation shows up in docs and with ``help()``. The deprecation decorators | ||
from ``qiskit.util.deprecation`` call ``add_deprecation_to_docstring()`` already for you; | ||
but you can call it directly if you are using different mechanisms for deprecations. |
Oops, something went wrong.