Coverage for src/polystore/__init__.py: 100%

15 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2025-11-03 06:58 +0000

1""" 

2Polystore - Framework-agnostic multi-backend storage abstraction. 

3 

4Provides pluggable storage backends with multi-framework I/O support for 

5NumPy, PyTorch, JAX, TensorFlow, CuPy, and Zarr. 

6""" 

7 

8__version__ = "0.1.2" 

9 

10# Core abstractions 

11from .base import ( 

12 DataSink, 

13 DataSource, 

14 StorageBackend, 

15 VirtualBackend, 

16 ReadOnlyBackend, 

17) 

18 

19# Concrete backends 

20from .memory import MemoryBackend 

21from .disk import DiskBackend 

22 

23# Optional backends 

24# Zarr is a required backend for this project. Import it directly so 

25# missing dependency errors surface loudly during test/setup. 

26from .zarr import ZarrBackend 

27 

28# File manager 

29from .filemanager import FileManager 

30 

31# Registry 

32from .backend_registry import BackendRegistry, create_storage_registry 

33 

34# Atomic operations 

35from .atomic import atomic_write, atomic_write_json 

36 

37# Exceptions 

38from .exceptions import ( 

39 StorageError, 

40 StorageResolutionError, 

41 BackendNotFoundError, 

42 UnsupportedFormatError, 

43) 

44 

45# Streaming (optional and lazy) 

46# Don't import at module level - streaming is heavy and optional 

47# Users can import manually if needed: from polystore.streaming import StreamingBackend 

48try: 

49 from .streaming import StreamingBackend 

50except ImportError: 

51 StreamingBackend = None 

52# Streaming (optional and lazy) 

53# Don't import at module level - streaming is heavy and optional 

54# Users can import manually if needed: from polystore.streaming import StreamingBackend 

55StreamingBackend = None 

56 

57__all__ = [ 

58 # Version 

59 "__version__", 

60 # Core abstractions 

61 "DataSink", 

62 "DataSource", 

63 "StorageBackend", 

64 "VirtualBackend", 

65 "ReadOnlyBackend", 

66 # Backends 

67 "MemoryBackend", 

68 "DiskBackend", 

69 "ZarrBackend", 

70 # File manager 

71 "FileManager", 

72 # Registry 

73 "BackendRegistry", 

74 # Atomic operations 

75 "atomic_write", 

76 "atomic_write_json", 

77 # Exceptions 

78 "StorageError", 

79 "StorageResolutionError", 

80 "BackendNotFoundError", 

81 "UnsupportedFormatError", 

82 # Streaming (optional) 

83 "StreamingBackend", 

84] 

85