Document the deprecation policy and add the deprecate_parameter decorator to deprecate parameters#1160
Merged
Document the deprecation policy and add the deprecate_parameter decorator to deprecate parameters#1160
Conversation
6ea6150 to
35466a2
Compare
weiji14
reviewed
Apr 4, 2021
pygmt/src/plot.py
Outdated
| ) | ||
| @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") |
Member
There was a problem hiding this comment.
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?
Suggested change
| @deprecate_parameter("sizes", "size", "v0.4.0", "v0.6.0") | |
| @deprecate_parameter("sizes", "size", "v0.4.0", remove_version="v0.6.0") |
Member
Author
There was a problem hiding this comment.
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.
weiji14
reviewed
Apr 4, 2021
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
Member
Author
|
/format |
seisman
commented
Apr 6, 2021
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>
Member
Author
|
Ping @GenericMappingTools/pygmt-contributors for reviews and comments on this PR. |
weiji14
reviewed
Apr 13, 2021
Member
weiji14
left a comment
There was a problem hiding this comment.
Just some proofread edits. No outstanding issues on the @deprecate_parameter function.
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
core-man
reviewed
Apr 13, 2021
core-man
reviewed
Apr 13, 2021
Member
|
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>
core-man
reviewed
Apr 16, 2021
core-man
approved these changes
Apr 16, 2021
weiji14
approved these changes
Apr 18, 2021
9 tasks
sixy6e
pushed a commit
to sixy6e/pygmt
that referenced
this pull request
Dec 21, 2022
…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>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of proposed changes
This is a draft implementation to deprecate a parameter but keep backward compatibility.
For example, the
Figure.plot()function has thesizesparameter, but we want to rename it tosize, and keep backward compatibility. We can add thedeprecate_parameterdecorator to theFigure.plot()method:It means the old parameter name
sizesis 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 formatandmake checkto 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