Skip to content

Deprecate inplace methods #1756

Closed
Closed

Description

@shoyer

The following methods have an inplace argument:
DataArray.reset_coords
DataArray.set_index
DataArray.reset_index
DataArray.reorder_levels
Dataset.set_coords
Dataset.reset_coords
Dataset.rename
Dataset.swap_dims
Dataset.set_index
Dataset.reset_index
Dataset.reorder_levels
Dataset.update
Dataset.merge

As proposed in #1755 (comment), let's deprecate all of these at the next major release (v0.11). They add unnecessary complexity to methods and promote confusing about xarray's data model.

Practically, we would change all of the default values to inplace=None and issue either a DeprecationWarning or FutureWarning (see PEP 565 for more details on that choice).

Activity

  1. added this to the 0.11 milestone on Dec 3, 2017
  2. st-bender commented on Jan 24, 2019

    @st-bender
    Contributor

    Hi,
    Sorry for the late comment about a closed bug. But I find changing the API a bit irritating to say the least, and this is a serious change. Although apparently not many people use it, some actually may (myself included). And so far there has been only one bug report, so what problem are you trying to fix?
    I can fix my own code but there may be others out there that cannot keep pace with the development and including their packages may then break software. For my taste the deprecation warning is a bit short if you are going to remove such a feature already in the next version. A few more cycles would be appreciated.

    At the very least put a big warning sign to the documentation that xarray is still beta and the API is still subject to change.

  3. jhamman commented on Jan 25, 2019

    @jhamman
    Member

    @st-bender - sorry to hear this change has caught you by surprise. We're a ways off from 0.12 so you should have time to work in any necessary changes before the feature if fully removed. If you have questions about how to adjust our use these methods, let us know.

  4. shoyer commented on Jan 25, 2019

    @shoyer
    MemberAuthor

    We will probably actually wait longer than until 0.12 for removing this argument, depending on the timing for that release.

    Unfortunately our API is indeed not entirely stable yet -- that's why the version number is still 0.X, not 1.X.

  5. st-bender commented on Jan 25, 2019

    @st-bender
    Contributor

    Hi,
    Thanks for the replies, I was indeed caught by surprise and given that the version number is 0.11.x, I had the impression that 0.12.x would be the next major minor release (and coming soon).

    @shoyer In that case I would take it back and vote for a change as soon as possible to stabilize the API. Although xarray is still considered beta, I guess some people already use it productively.

    @jhamman Thanks for the offer, I think the changes were simple enough. I merely wanted to point out that some more people use(d) that feature.

  6. nathanlyons commented on Mar 25, 2019

    @nathanlyons

    Is there a recommendation for merging a dataset without inplacewhen the dataset is a subclass of xr.Dataset, other than through composition? Perhaps lower level functions to merge?

  7. shoyer commented on Mar 25, 2019

    @shoyer
    MemberAuthor
  8. added a commit that references this issue on Apr 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions