kmnhan / kmnhan/erlabpy

Make accessor namespace opt-in

Open
#25 1 comment 0 reactions 1 assignee Claimed by @kmnhan View on GitHub
enhancement
Dominant language
Python
Stars
19
Forks
8
Avg merge
6h 39m
Merged PRs (30d)
44

Description

### Description

It is recommended to provide a single accessor under the package namespace. (See https://github.com/pydata/xarray/issues/1080)

Currently, we have multiple callable accessors in the top level namespace of `xarray.DataArray`, but this is not good practice!

### Possible solutions

The best way is to move all these accessors to a single accessor namespace:

| Current | New |
| ----------------- | -------------------- |
| `da.qplot` | `da.er.qplot` |
| `da.qshow` | `da.er.qshow` |
| `da.qsel` | `da.er.qsel` |
| `da.kspace` | `da.er.kspace` |
| `da.modelfit` | `da.er.modelfit` |
| `da.parallel_fit` | `da.er.parallel_fit` |
| `ds.modelfit` | `ds.er.modelfit` |

However, we lose the convenience of calling these functions directly. As a workaround, we should add an opt-in environment variable to enable the top-level accessors. This way, users can choose to use the old syntax if they prefer!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.