-
Notifications
You must be signed in to change notification settings - Fork 224
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
Figure.plot: Deprecate parameter "columns" to "incols" (remove in v0.6.0) #1298
Conversation
…6.0) As discussed in #764, this PR replaces the **columns** parameter by **incols** for plot.py and adds the deprecation .
The alias name and description for |
Sounds great! |
Any idea why the newly added test fails here @seisman ? |
I think I misunderstood the order Python executes decorators. I thought the execution order is bottom-to-top, but the actual execution order is top-to-bottom (see https://gist.github.com/kirsle/bf24622fc5f255256c6e for detailed explanations). If the top-to-bottom execution order is correct, the Edit: After trying the examples in https://gist.github.com/kirsle/bf24622fc5f255256c6e and https://stackoverflow.com/questions/27342149/, I'm more confused about the order. The former example supports top-to-bottom order, but the latter example supports bottom-to-top order. Am I still misunderstanding it? |
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.
Python decorators are applied top-down according to https://realpython.com/primer-on-python-decorators/#nesting-decorators. The implementation of @deprecate_parameter
is correct-ish, but we need to move the @deprecate_parameter
decorator to be after @fmt_docstring
and before @use_alias
.
pygmt/src/plot.py
Outdated
@deprecate_parameter("sizes", "size", "v0.4.0", remove_version="v0.6.0") | ||
@deprecate_parameter("columns", "incols", "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.
The problem is that test_plot_deprecate_columns_to_incols
uses a list instead of str for the columns
parameter. The correct order should be:
- Rename 'columns' to 'incols' via
@deprecate_parameter
- Convert long alias 'incols' to GMT short alias 'i' via
@use_alias
- Let the list type argument
[0, 1]
be converted to str type0,1
via@kwargs_to_strings
- Pass in
-i0,1
tolib.call_module("plot", ...)
So you'll need to move these 2 @deprecate_parameter
lines to between L17 and L18.
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.
Now the description for |
…6.0) (GenericMappingTools#1298) * Figure.plot: Deprecate parameter "columns" to "incols" (remove in v0.6.0) * add new test * add shortcut to use incols description from COMMON_OPTIONS
Description of proposed changes
As discussed in #764, this PR replaces the columns parameter by incols for Figure.plot().
columns
toincols
in Figure.plot()Reminders
make format
andmake check
to make sure the code follows the style guide.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