Skip to content

Clarify position of deprecate_parameter decorator to be above use_alias #1302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions doc/maintenance.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,21 +173,21 @@ When making incompatible changes, we should follow the process:
3-12 months.
- Remove the old usage and warning when reaching the declared version.

To rename a function parameter, add the `@deprecated_parameter` decorator
before the function definition (but after the `@use_alias` decorator if it exists).
Here is an example:
To rename a function parameter, add the `@deprecate_parameter` decorator near
the top after the `@fmt_docstring` decorator but before the `@use_alias`
decorator (if those two exists). Here is an example:

```
@fmt_docstring
@use_alias(J="projection", R="region", V="verbose")
@kwargs_to_strings(R="sequence")
@deprecate_parameter("sizes", "size", "v0.4.0", remove_version="v0.6.0")
@deprecate_parameter("columns", "incols", "v0.4.0", remove_version="v0.6.0")
@use_alias(J="projection", R="region", V="verbose", i="incols")
@kwargs_to_strings(R="sequence", i='sequence_comma')
def plot(self, x=None, y=None, data=None, size=None, direction=None, **kwargs):
pass
```

In this case, the old parameter name `sizes` is deprecated since v0.4.0, and will be
fully removed in v0.6.0. The new parameter name is `size`.
In this case, the old parameter name `columns` is deprecated since v0.4.0, and
will be fully removed in v0.6.0. The new parameter name is `incols`.


## Making a Release
Expand Down
2 changes: 1 addition & 1 deletion pygmt/helpers/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ def deprecate_parameter(oldname, newname, deprecate_version, remove_version):
name, and users will receive a FutureWarning to inform them of the pending
deprecation.

Use this decorator below the ``use_alias`` decorator.
Use this decorator above the ``use_alias`` decorator.

Parameters
----------
Expand Down