panpath 0.1.0__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. {panpath-0.1.0 → panpath-0.3.0}/PKG-INFO +31 -33
  2. {panpath-0.1.0 → panpath-0.3.0}/README.md +30 -32
  3. panpath-0.3.0/panpath/__init__.py +82 -0
  4. panpath-0.3.0/panpath/azure_async_client.py +824 -0
  5. panpath-0.3.0/panpath/azure_client.py +674 -0
  6. panpath-0.3.0/panpath/azure_path.py +27 -0
  7. panpath-0.3.0/panpath/base.py +379 -0
  8. panpath-0.3.0/panpath/clients.py +1115 -0
  9. panpath-0.1.0/panpath/base.py → panpath-0.3.0/panpath/cloud.py +274 -371
  10. {panpath-0.1.0 → panpath-0.3.0}/panpath/exceptions.py +2 -8
  11. panpath-0.3.0/panpath/gs_async_client.py +793 -0
  12. {panpath-0.1.0 → panpath-0.3.0}/panpath/gs_client.py +269 -162
  13. panpath-0.3.0/panpath/gs_path.py +28 -0
  14. panpath-0.3.0/panpath/local_path.py +314 -0
  15. panpath-0.3.0/panpath/registry.py +76 -0
  16. panpath-0.3.0/panpath/s3_async_client.py +789 -0
  17. {panpath-0.1.0 → panpath-0.3.0}/panpath/s3_client.py +264 -183
  18. panpath-0.3.0/panpath/s3_path.py +27 -0
  19. {panpath-0.1.0 → panpath-0.3.0}/pyproject.toml +6 -4
  20. panpath-0.1.0/panpath/__init__.py +0 -86
  21. panpath-0.1.0/panpath/azure_async.py +0 -20
  22. panpath-0.1.0/panpath/azure_async_client.py +0 -551
  23. panpath-0.1.0/panpath/azure_client.py +0 -542
  24. panpath-0.1.0/panpath/azure_sync.py +0 -20
  25. panpath-0.1.0/panpath/clients.py +0 -273
  26. panpath-0.1.0/panpath/gs_async.py +0 -20
  27. panpath-0.1.0/panpath/gs_async_client.py +0 -552
  28. panpath-0.1.0/panpath/gs_sync.py +0 -20
  29. panpath-0.1.0/panpath/local_async.py +0 -160
  30. panpath-0.1.0/panpath/local_sync.py +0 -29
  31. panpath-0.1.0/panpath/registry.py +0 -71
  32. panpath-0.1.0/panpath/router.py +0 -174
  33. panpath-0.1.0/panpath/s3_async.py +0 -20
  34. panpath-0.1.0/panpath/s3_async_client.py +0 -590
  35. panpath-0.1.0/panpath/s3_sync.py +0 -23
  36. {panpath-0.1.0 → panpath-0.3.0}/LICENSE +0 -0
  37. {panpath-0.1.0 → panpath-0.3.0}/panpath/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: panpath
3
- Version: 0.1.0
3
+ Version: 0.3.0
4
4
  Summary: Universal sync/async local/cloud path library with pathlib-compatible interface
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -104,20 +104,20 @@ content = azure_file.read_text()
104
104
  ### Asynchronous Usage
105
105
 
106
106
  ```python
107
- from panpath import PanPath, AsyncPanPath
107
+ from panpath import PanPath
108
108
 
109
- # Option 1: Using mode parameter
110
- async_s3 = PanPath("s3://bucket/key/file.txt", mode="async")
111
- content = await async_s3.read_text()
109
+ # All path classes support async methods with a_ prefix
110
+ s3_path = PanPath("s3://bucket/key/file.txt")
111
+ content = await s3_path.a_read_text()
112
112
 
113
- # Option 2: Using AsyncPanPath (always async)
114
- async_gs = AsyncPanPath("gs://bucket/path/file.txt")
115
- content = await async_gs.read_text()
113
+ # Works for all cloud storage providers
114
+ gs_path = PanPath("gs://bucket/path/file.txt")
115
+ content = await gs_path.a_read_text()
116
116
 
117
117
  # Async local files
118
- async_local = AsyncPanPath("/path/to/file.txt")
119
- async with async_local.open("r") as f:
120
- content = await f.read()
118
+ local_path = PanPath("/path/to/file.txt")
119
+ async with local_path.a_open("r") as f:
120
+ content = await f.a_read()
121
121
  ```
122
122
 
123
123
  ### Path Operations
@@ -125,15 +125,14 @@ async with async_local.open("r") as f:
125
125
  ```python
126
126
  from panpath import PanPath
127
127
 
128
- # Path operations preserve type and mode
128
+ # Path operations preserve type
129
129
  s3_path = PanPath("s3://bucket/data/file.txt")
130
- parent = s3_path.parent # Returns S3Path (sync)
131
- sibling = s3_path.parent / "other.txt" # Returns S3Path (sync)
130
+ parent = s3_path.parent # Returns S3Path
131
+ sibling = s3_path.parent / "other.txt" # Returns S3Path
132
132
 
133
- # Async paths preserve async mode
134
- async_path = PanPath("s3://bucket/data/file.txt", mode="async")
135
- async_parent = async_path.parent # Returns AsyncS3Path
136
- async_sibling = async_parent / "other.txt" # Returns AsyncS3Path
133
+ # Each path supports both sync and async methods
134
+ content = s3_path.read_text() # Synchronous
135
+ content = await s3_path.a_read_text() # Asynchronous
137
136
  ```
138
137
 
139
138
  ### Bulk Operations and Cross-Storage Transfers
@@ -173,24 +172,25 @@ See [bulk-operations.md](docs/guide/bulk-operations.md) for detailed documentati
173
172
 
174
173
  ## Architecture
175
174
 
176
- PanPath uses a metaclass factory pattern to dispatch path creation based on URI scheme and mode parameter:
175
+ PanPath uses a factory pattern to dispatch path creation based on URI scheme:
177
176
 
178
- - **Sync Mode**: Returns `LocalPath`, `S3Path`, `GSPath`, or `AzureBlobPath`
179
- - **Async Mode**: Returns `AsyncLocalPath`, `AsyncS3Path`, `AsyncGSPath`, or `AsyncAzureBlobPath`
177
+ - `PanPath(pathlib.Path)` - Root factory and base class
178
+ - `LocalPath(PanPath)` - Local filesystem paths
179
+ - `CloudPath(PanPath)` - Base for all cloud storage paths
180
+ - `GSPath(CloudPath)`, `S3Path(CloudPath)`, `AzurePath(CloudPath)` - Cloud-specific implementations
180
181
 
181
- Cloud paths use lazy client instantiation - SDK clients are only created on first I/O operation.
182
+ Each path class provides both synchronous methods and asynchronous methods (prefixed with `a_`). Cloud paths use lazy client instantiation - SDK clients are only created on first I/O operation.
182
183
 
183
184
  ## Type Hints
184
185
 
185
- PanPath provides comprehensive type hints with `@overload` decorators:
186
+ PanPath provides comprehensive type hints:
186
187
 
187
188
  ```python
188
189
  from panpath import PanPath
189
- from typing import Literal
190
+ from panpath.s3_path import S3Path
190
191
 
191
- # Type checker knows return type based on mode
192
- sync_path: S3Path = PanPath("s3://bucket/key")
193
- async_path: AsyncS3Path = PanPath("s3://bucket/key", mode="async")
192
+ # Type checker knows return type based on URI scheme
193
+ path: S3Path = PanPath("s3://bucket/key")
194
194
  ```
195
195
 
196
196
  ## Testing
@@ -240,17 +240,15 @@ path = PanPath("s3://bucket/key")
240
240
  # Before
241
241
  from aiopath import AsyncPath
242
242
  path = AsyncPath("/local/file.txt")
243
+ # await path.read_text()
243
244
 
244
245
  # After
245
- from panpath import AsyncPanPath
246
- path = AsyncPanPath("/local/file.txt")
246
+ from panpath import PanPath
247
+ path = PanPath("/local/file.txt")
248
+ # await path.a_read_text()
247
249
  ```
248
250
 
249
251
  ## License
250
252
 
251
253
  MIT License - see LICENSE file for details.
252
254
 
253
- ## Contributing
254
-
255
- Contributions welcome! Please see CONTRIBUTING.md for guidelines.
256
-
@@ -62,20 +62,20 @@ content = azure_file.read_text()
62
62
  ### Asynchronous Usage
63
63
 
64
64
  ```python
65
- from panpath import PanPath, AsyncPanPath
65
+ from panpath import PanPath
66
66
 
67
- # Option 1: Using mode parameter
68
- async_s3 = PanPath("s3://bucket/key/file.txt", mode="async")
69
- content = await async_s3.read_text()
67
+ # All path classes support async methods with a_ prefix
68
+ s3_path = PanPath("s3://bucket/key/file.txt")
69
+ content = await s3_path.a_read_text()
70
70
 
71
- # Option 2: Using AsyncPanPath (always async)
72
- async_gs = AsyncPanPath("gs://bucket/path/file.txt")
73
- content = await async_gs.read_text()
71
+ # Works for all cloud storage providers
72
+ gs_path = PanPath("gs://bucket/path/file.txt")
73
+ content = await gs_path.a_read_text()
74
74
 
75
75
  # Async local files
76
- async_local = AsyncPanPath("/path/to/file.txt")
77
- async with async_local.open("r") as f:
78
- content = await f.read()
76
+ local_path = PanPath("/path/to/file.txt")
77
+ async with local_path.a_open("r") as f:
78
+ content = await f.a_read()
79
79
  ```
80
80
 
81
81
  ### Path Operations
@@ -83,15 +83,14 @@ async with async_local.open("r") as f:
83
83
  ```python
84
84
  from panpath import PanPath
85
85
 
86
- # Path operations preserve type and mode
86
+ # Path operations preserve type
87
87
  s3_path = PanPath("s3://bucket/data/file.txt")
88
- parent = s3_path.parent # Returns S3Path (sync)
89
- sibling = s3_path.parent / "other.txt" # Returns S3Path (sync)
88
+ parent = s3_path.parent # Returns S3Path
89
+ sibling = s3_path.parent / "other.txt" # Returns S3Path
90
90
 
91
- # Async paths preserve async mode
92
- async_path = PanPath("s3://bucket/data/file.txt", mode="async")
93
- async_parent = async_path.parent # Returns AsyncS3Path
94
- async_sibling = async_parent / "other.txt" # Returns AsyncS3Path
91
+ # Each path supports both sync and async methods
92
+ content = s3_path.read_text() # Synchronous
93
+ content = await s3_path.a_read_text() # Asynchronous
95
94
  ```
96
95
 
97
96
  ### Bulk Operations and Cross-Storage Transfers
@@ -131,24 +130,25 @@ See [bulk-operations.md](docs/guide/bulk-operations.md) for detailed documentati
131
130
 
132
131
  ## Architecture
133
132
 
134
- PanPath uses a metaclass factory pattern to dispatch path creation based on URI scheme and mode parameter:
133
+ PanPath uses a factory pattern to dispatch path creation based on URI scheme:
135
134
 
136
- - **Sync Mode**: Returns `LocalPath`, `S3Path`, `GSPath`, or `AzureBlobPath`
137
- - **Async Mode**: Returns `AsyncLocalPath`, `AsyncS3Path`, `AsyncGSPath`, or `AsyncAzureBlobPath`
135
+ - `PanPath(pathlib.Path)` - Root factory and base class
136
+ - `LocalPath(PanPath)` - Local filesystem paths
137
+ - `CloudPath(PanPath)` - Base for all cloud storage paths
138
+ - `GSPath(CloudPath)`, `S3Path(CloudPath)`, `AzurePath(CloudPath)` - Cloud-specific implementations
138
139
 
139
- Cloud paths use lazy client instantiation - SDK clients are only created on first I/O operation.
140
+ Each path class provides both synchronous methods and asynchronous methods (prefixed with `a_`). Cloud paths use lazy client instantiation - SDK clients are only created on first I/O operation.
140
141
 
141
142
  ## Type Hints
142
143
 
143
- PanPath provides comprehensive type hints with `@overload` decorators:
144
+ PanPath provides comprehensive type hints:
144
145
 
145
146
  ```python
146
147
  from panpath import PanPath
147
- from typing import Literal
148
+ from panpath.s3_path import S3Path
148
149
 
149
- # Type checker knows return type based on mode
150
- sync_path: S3Path = PanPath("s3://bucket/key")
151
- async_path: AsyncS3Path = PanPath("s3://bucket/key", mode="async")
150
+ # Type checker knows return type based on URI scheme
151
+ path: S3Path = PanPath("s3://bucket/key")
152
152
  ```
153
153
 
154
154
  ## Testing
@@ -198,16 +198,14 @@ path = PanPath("s3://bucket/key")
198
198
  # Before
199
199
  from aiopath import AsyncPath
200
200
  path = AsyncPath("/local/file.txt")
201
+ # await path.read_text()
201
202
 
202
203
  # After
203
- from panpath import AsyncPanPath
204
- path = AsyncPanPath("/local/file.txt")
204
+ from panpath import PanPath
205
+ path = PanPath("/local/file.txt")
206
+ # await path.a_read_text()
205
207
  ```
206
208
 
207
209
  ## License
208
210
 
209
211
  MIT License - see LICENSE file for details.
210
-
211
- ## Contributing
212
-
213
- Contributions welcome! Please see CONTRIBUTING.md for guidelines.
@@ -0,0 +1,82 @@
1
+ """PanPath - Universal sync/async local/cloud path library.
2
+
3
+ Examples:
4
+ >>> from panpath import PanPath
5
+ >>>
6
+ >>> # Local path (sync methods)
7
+ >>> path = PanPath("/path/to/file.txt")
8
+ >>> content = path.read_text()
9
+ >>>
10
+ >>> # Local path (async methods with a_ prefix)
11
+ >>> content = await path.a_read_text()
12
+ >>>
13
+ >>> # S3 path (sync methods)
14
+ >>> s3_path = PanPath("s3://bucket/key.txt")
15
+ >>> content = s3_path.read_text()
16
+ >>>
17
+ >>> # S3 path (async methods with a_ prefix)
18
+ >>> content = await s3_path.a_read_text()
19
+ >>>
20
+ >>> # Check if object is a PanPath instance
21
+ >>> isinstance(path, PanPath) # True for any path created by this package
22
+ """
23
+
24
+ from panpath.base import PanPath
25
+ from panpath.cloud import CloudPath
26
+ from panpath.local_path import LocalPath
27
+
28
+ # Import path classes and register them
29
+ from panpath.registry import register_path_class
30
+
31
+ # Register S3
32
+ try:
33
+ from panpath.s3_path import S3Path
34
+
35
+ register_path_class("s3", S3Path)
36
+ except ImportError:
37
+ # S3 dependencies not installed
38
+ raise
39
+
40
+ # Register Google Cloud Storage
41
+ try:
42
+ from panpath.gs_path import GSPath
43
+
44
+ register_path_class("gs", GSPath)
45
+ except ImportError:
46
+ # GCS dependencies not installed
47
+ pass
48
+
49
+ # Register Azure Blob Storage
50
+ try:
51
+ from panpath.azure_path import AzurePath
52
+
53
+ register_path_class("az", AzurePath)
54
+ register_path_class("azure", AzurePath) # Support both schemes
55
+ except ImportError:
56
+ # Azure dependencies not installed
57
+ pass
58
+
59
+ __version__ = "0.3.0"
60
+
61
+ __all__ = [
62
+ "PanPath",
63
+ "CloudPath",
64
+ "LocalPath",
65
+ # Export cloud paths if available
66
+ ]
67
+
68
+ # Add cloud path classes to __all__ if they're available
69
+ try:
70
+ __all__.extend(["S3Path"])
71
+ except NameError:
72
+ pass
73
+
74
+ try:
75
+ __all__.extend(["GSPath"])
76
+ except NameError:
77
+ pass
78
+
79
+ try:
80
+ __all__.extend(["AzurePath"])
81
+ except NameError:
82
+ pass