Skip to content
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

list available backends and basic descriptors #7000

Merged
merged 42 commits into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
b48dc55
add backend desc and docs properties to BackendEntrypoint
JessicaS11 Sep 6, 2022
ea0af7f
add avail_engines function to api
JessicaS11 Sep 6, 2022
88fcd7d
Merge branch 'pydata:main' into listbackends
JessicaS11 Sep 6, 2022
f9e61d1
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 6, 2022
7aa2d70
convert engine list to pandas dataframe
JessicaS11 Sep 8, 2022
c8dfb2f
alphabetize (loosely) input/output functions in api.rst
JessicaS11 Sep 8, 2022
e2fc425
add new function to api docs
JessicaS11 Sep 8, 2022
a0fc0c2
add new properties to docstring
JessicaS11 Sep 8, 2022
d405717
add new available backend properties to docs
JessicaS11 Sep 8, 2022
73580dc
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 8, 2022
6af2891
remove redundant 'backend' from attribute names
JessicaS11 Sep 8, 2022
897c204
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 8, 2022
623bb31
turn properties into attributes as per PR review
JessicaS11 Sep 8, 2022
33412c4
fix docstring formatting for attributes
JessicaS11 Sep 8, 2022
06861fa
add str to BackendEntrypoint class
JessicaS11 Sep 8, 2022
1dd69ac
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 8, 2022
14fa13d
Merge branch 'main' into listbackends
JessicaS11 Sep 9, 2022
4fdfad1
update output type for avail_engines function
JessicaS11 Sep 9, 2022
a6b6f55
Merge branch 'main' into listbackends
JessicaS11 Sep 12, 2022
02de430
update docs and code based on PR review
JessicaS11 Sep 12, 2022
b410eec
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 12, 2022
0a48f20
commit unsaved changes for last commit
JessicaS11 Sep 12, 2022
d076fba
Merge branch 'main' into listbackends
JessicaS11 Sep 13, 2022
c3c157f
remove api function and update docs post dev discussion to just retur…
JessicaS11 Sep 15, 2022
3d37077
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 15, 2022
f40660e
remove missed imports
JessicaS11 Sep 15, 2022
1d78879
Apply suggestions from code review - move comment
JessicaS11 Sep 19, 2022
089393f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 19, 2022
331acf5
add list engines typing
JessicaS11 Sep 20, 2022
98b85dc
change str to repr and improve layout
JessicaS11 Sep 20, 2022
fc4c93a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 20, 2022
b6e6a23
Merge branch 'main' into listbackends
JessicaS11 Sep 22, 2022
db9c422
Merge branch 'main' into listbackends
dcherian Oct 3, 2022
1a7707d
Merge branch 'main' into listbackends
dcherian Oct 13, 2022
b978583
deal with issues from changes on main
JessicaS11 Oct 13, 2022
0fdff0c
actually put release notes in right place
JessicaS11 Oct 13, 2022
28a0799
Merge branch 'main' into listbackends
JessicaS11 Oct 13, 2022
3b7fece
Merge branch 'main' into listbackends
JessicaS11 Oct 13, 2022
988af43
Merge branch 'main' into listbackends
dcherian Oct 17, 2022
6f88789
Fix whats-new
dcherian Oct 17, 2022
fdd1346
Apply suggestions from code review
dcherian Oct 17, 2022
bf5ad18
Revert "Apply suggestions from code review"
dcherian Oct 17, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions xarray/backends/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,28 @@
}


def avail_engines() -> List:
JessicaS11 marked this conversation as resolved.
Show resolved Hide resolved
"""
Return a list of available engines with metadata.

For any registered backend that is available, get the backend name,
short text description, and link to the backend's documentation.

Returns
-------
List of lists
"""
engines = plugins.list_engines()

eng_list = []
for eng in engines:
eng_list.append(
[eng, engines[eng].backend_description, engines[eng].backend_docs]
)

return eng_list


def _get_default_engine_remote_uri() -> Literal["netcdf4", "pydap"]:
engine: Literal["netcdf4", "pydap"]
try:
Expand Down
14 changes: 14 additions & 0 deletions xarray/backends/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,20 @@ class BackendEntrypoint:
open_dataset_parameters: tuple | None = None
dcherian marked this conversation as resolved.
Show resolved Hide resolved
"""list of ``open_dataset`` method parameters"""

@property
def backend_description(description: str | None):
JessicaS11 marked this conversation as resolved.
Show resolved Hide resolved
"""
Brief text description of backend
"""
return ""

@property
def backend_docs(docs: str | os.PathLike):
JessicaS11 marked this conversation as resolved.
Show resolved Hide resolved
"""
URL to backend's documentation
"""
return ""

def open_dataset(
self,
filename_or_obj: str | os.PathLike,
Expand Down