-
Notifications
You must be signed in to change notification settings - Fork 219
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
Document the deprecation policy and add the deprecate_parameter decorator to deprecate parameters #1160
Conversation
6ea6150
to
35466a2
Compare
pygmt/src/plot.py
Outdated
@@ -43,7 +44,8 @@ | |||
t="transparency", | |||
) | |||
@kwargs_to_strings(R="sequence", c="sequence_comma", i="sequence_comma", p="sequence") | |||
def plot(self, x=None, y=None, data=None, sizes=None, direction=None, **kwargs): | |||
@deprecate_parameter("sizes", "size", "v0.4.0", "v0.6.0") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use the keyword name here, make it easier to regex match when the time comes to deprecate something. Also, do we want to deprecate this at v0.6.0 or v0.5.0?
@deprecate_parameter("sizes", "size", "v0.4.0", "v0.6.0") | |
@deprecate_parameter("sizes", "size", "v0.4.0", remove_version="v0.6.0") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, do we want to deprecate this at v0.6.0 or v0.5.0?
As sizes
is heavily used, I'd like to give users more time to change the old names to new names.
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
/format |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I would add a note about our deprecation policy (and how to use @deprecate_parameter
) in the maintainer docs, maybe after #1185 is completed.
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
Bumps [conda-incubator/setup-miniconda](https://github.com/conda-incubator/setup-miniconda) from v2.1.0 to v2.1.1. - [Release notes](https://github.com/conda-incubator/setup-miniconda/releases) - [Changelog](https://github.com/conda-incubator/setup-miniconda/blob/master/CHANGELOG.md) - [Commits](conda-incubator/setup-miniconda@v2.1.0...35d1405) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from v1.3.1 to v1.3.2. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md) - [Commits](codecov/codecov-action@v1.3.1...9b0b9bb) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Ping @GenericMappingTools/pygmt-contributors for reviews and comments on this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some proofread edits. No outstanding issues on the @deprecate_parameter
function.
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
Woow~ Looks great 😄 Only some minor suggestions. |
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> Co-authored-by: Yao Jiayuan <coreman.seism@gmail.com>
…rator to deprecate parameters (GenericMappingTools#1160) * Add the deprecate_parameter decorator to deprecate parameters * Use FutureWarning instead of DeprecationWarning * Document the deprecation policy Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> Co-authored-by: Meghan Jones <meghanj@hawaii.edu> Co-authored-by: Yao Jiayuan <coreman.seism@gmail.com>
Description of proposed changes
This is a draft implementation to deprecate a parameter but keep backward compatibility.
For example, the
Figure.plot()
function has thesizes
parameter, but we want to rename it tosize
, and keep backward compatibility. We can add thedeprecate_parameter
decorator to theFigure.plot()
method:It means the old parameter name
sizes
is deprecated since v0.4.0, and will be removed in v0.6.0.The new parameter name is
size
.When users use
sizes
, a warning will be raised.References:
Related to #1120.
Reminders
make format
andmake check
to make sure the code follows the style guide.doc/api/index.rst
.Slash Commands
You can write slash commands (
/command
) in the first line of a comment to performspecific operations. Supported slash commands are:
/format
: automatically format and lint the code/test-gmt-dev
: run full tests on the latest GMT development version