pydata / pydata/xarray

Add thread-safe `copy()`

Open
#10,385 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
4.2k
Forks
1.4k
Avg merge
2d 15h
Merged PRs (30d)
14

Description

Is your feature request related to a problem?

A new option for Dataset and DataArray .copy() function. Something between deep=True and deep=False.
https://github.com/pydata/xarray/issues/9836 here it was identified that everything in xarray is threadsafe, but the PandasIndex is not.

A shallow copy of the data, variables, coordinates + deep copy of the index is required for the fastest and most efficient thread-safe copy

Describe the solution you'd like

Add .copy(deep='threadsafe') or similar.

Describe alternatives you've considered

No response

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing Dataset and DataArray copy APIs and the PandasIndex thread-safety discussion linked in the issue. The work is done when a copy mode provides shallow data, variables, and coordinates while deep-copying the index, with the chosen option and its behavior documented and tested.

Written by the indexing model from the issue text.

Assessment

Tech stack
pandas, python
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.