-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
make more args kw only (except 'dim') #6403
Conversation
Sounds good - I'll add a deprecation. We might also want to do this for https://github.com/pydata/xarray/blob/main/xarray/core/_reductions.py |
1 similar comment
Sounds good - I'll add a deprecation. We might also want to do this for https://github.com/pydata/xarray/blob/main/xarray/core/_reductions.py |
👍 I lost track of it given that PR was open for so long. IIRC one issue is that the order of args was different forr Dataset.reduce vs DatasetGroupBy.reduce (cc @Illviljan) |
From #5950 (comment)
|
Yes, mypy found some issues with the ordering so moving to kwargs-only was my preferred solution. |
I would vote to resurrect this! Deprecations are nice but I would vote to merge this without them given that it seems that we won't merge it with them... (We can do it on a minor release and announce it) What do folks think? |
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'm ok with merging this.
Maybe relax it a bit for the diff method, I remember using n
as a positional argument in the past (coming from Matlab).
Should get an entry in breaking changes in the what's new though.
Happy to revive this PR. We do have a |
I think the failure is a fluke. Open/ close |
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.
Thanks @mathause
Let's add a whats-new note and merge.
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 now, thanks!
* upstream/main: (46 commits) xfail flaky test (pydata#8299) Most of mypy 1.6.0 passing (pydata#8296) Rename `reset_encoding` to `drop_encoding` (pydata#8287) Enable `.rolling_exp` to work on dask arrays (pydata#8284) Fix `GroupBy` import (pydata#8286) Ask bug reporters to confirm they're using a recent version of xarray (pydata#8283) Add pyright type checker (pydata#8279) Improved typing of align & broadcast (pydata#8234) Update ci-additional.yaml (pydata#8280) Fix time encoding regression (pydata#8272) Allow a function in `.sortby` method (pydata#8273) make more args kw only (except 'dim') (pydata#6403) Use duck array ops in more places (pydata#8267) Don't raise rename warning if it is a no operation (pydata#8266) Mandate kwargs on `to_zarr` (pydata#8257) copy the `dtypes` module to the `namedarray` package. (pydata#8250) Add xarray-regrid to ecosystem.rst (pydata#8270) Use strict type hinting for namedarray (pydata#8241) Update type annotation for center argument of dataaray_plot methods (pydata#8261) [pre-commit.ci] pre-commit autoupdate (pydata#8262) ...
whats-new.rst
api.rst
This makes many arguments keyword-only, except for
dim
to avoidda.weighted(...).mean("lat", "lon")
(i.e.da.weighted(...).mean(dim="lat", skipna="lon")
) which silently does the wrong thing. I am sure I forgot some and for some I was unsure so I left them as is.Question: do we want an deprecation cycle? Currently it just errors for
da.weighted(...).mean("dim", True)
. Might be nice to do it, however, @dcherian if I am not mistaken you did this without a deprecation in #5950, e.g. forda.mean
etc.?