Skip to content

Commit 95c609a

Browse files
authored
Merge pull request #45 from scientificcomputing/finsberg/list-builtin-backends
Add function to list builtin backends
2 parents 02e3e24 + ba5a970 commit 95c609a

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

src/io4dolfinx/backends/__init__.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,3 +439,22 @@ def get_backend(backend: str) -> IOBackend:
439439
return EXODUSInterface
440440
else:
441441
return import_module(backend)
442+
443+
444+
BUILTIN_BAKENDS = ("h5py", "adios2", "pyvista", "xdmf", "vtkhdf", "exodus")
445+
446+
447+
def list_builtin_backends() -> list[str]:
448+
"""List available builtin backends.
449+
450+
Returns:
451+
List of available backends
452+
"""
453+
lst = []
454+
for backend in BUILTIN_BAKENDS:
455+
try:
456+
get_backend(backend)
457+
except ImportError:
458+
continue
459+
lst.append(backend)
460+
return lst

0 commit comments

Comments
 (0)