panpath 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,256 @@
1
+ Metadata-Version: 2.4
2
+ Name: panpath
3
+ Version: 0.1.0
4
+ Summary: Universal sync/async local/cloud path library with pathlib-compatible interface
5
+ License: MIT
6
+ License-File: LICENSE
7
+ Keywords: path,pathlib,s3,gcs,azure,cloud,async,asyncio
8
+ Author: panpath contributors
9
+ Requires-Python: >=3.9,<4.0
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Classifier: Topic :: System :: Filesystems
22
+ Provides-Extra: all
23
+ Provides-Extra: all-async
24
+ Provides-Extra: all-sync
25
+ Provides-Extra: async-azure
26
+ Provides-Extra: async-gs
27
+ Provides-Extra: async-s3
28
+ Provides-Extra: azure
29
+ Provides-Extra: gs
30
+ Provides-Extra: s3
31
+ Requires-Dist: aioboto3 (>=11.0.0) ; extra == "async-s3" or extra == "all-async" or extra == "all"
32
+ Requires-Dist: aiofiles (>=23.0.0) ; extra == "async-s3" or extra == "async-gs" or extra == "async-azure" or extra == "all-async" or extra == "all"
33
+ Requires-Dist: azure-storage-blob (>=12.0.0) ; extra == "azure" or extra == "async-azure" or extra == "all-sync" or extra == "all-async" or extra == "all"
34
+ Requires-Dist: boto3 (>=1.20.0) ; extra == "s3" or extra == "all-sync" or extra == "all"
35
+ Requires-Dist: gcloud-aio-storage (>=8.0.0) ; extra == "async-gs" or extra == "all-async" or extra == "all"
36
+ Requires-Dist: google-cloud-storage (>=2.0.0) ; extra == "gs" or extra == "all-sync" or extra == "all"
37
+ Requires-Dist: typing-extensions (>=4.0.0)
38
+ Project-URL: Documentation, https://github.com/pwwang/panpath#readme
39
+ Project-URL: Homepage, https://github.com/pwwang/panpath
40
+ Project-URL: Repository, https://github.com/pwwang/panpath
41
+ Description-Content-Type: text/markdown
42
+
43
+ # PanPath
44
+
45
+ Universal sync/async local/cloud path library with pathlib-compatible interface for Python.
46
+
47
+ ## Features
48
+
49
+ - ๐Ÿ”„ **Unified Interface**: Single API for local and cloud storage (S3, Google Cloud Storage, Azure Blob Storage)
50
+ - โšก **Sync & Async**: Choose synchronous or asynchronous operations based on your needs
51
+ - ๐ŸŽฏ **Pathlib Compatible**: Drop-in replacement for `pathlib.Path` for local files
52
+ - ๐Ÿ”Œ **Lazy Loading**: Cloud clients instantiated only when needed
53
+ - ๐ŸŒ **Cross-Storage Operations**: Copy/move files between different storage backends seamlessly
54
+ - ๐Ÿ“ **Bulk Operations**: Efficient `rmtree`, `copy`, `copytree` for directories
55
+ - ๐Ÿงช **Testable**: Local mock infrastructure for testing without cloud resources
56
+ - ๐Ÿ“ฆ **Optional Dependencies**: Install only what you need
57
+
58
+ ## Installation
59
+
60
+ ```bash
61
+ # Core library (local paths only)
62
+ pip install panpath
63
+
64
+ # With sync S3 support
65
+ pip install panpath[s3]
66
+
67
+ # With async S3 support
68
+ pip install panpath[async-s3]
69
+
70
+ # With all sync backends
71
+ pip install panpath[all-sync]
72
+
73
+ # With all async backends
74
+ pip install panpath[all-async]
75
+
76
+ # With everything
77
+ pip install panpath[all]
78
+ ```
79
+
80
+ ## Quick Start
81
+
82
+ ### Synchronous Usage
83
+
84
+ ```python
85
+ from panpath import PanPath
86
+
87
+ # Local files (pathlib.Path compatible)
88
+ local = PanPath("/path/to/file.txt")
89
+ content = local.read_text()
90
+
91
+ # S3 (synchronous)
92
+ s3_file = PanPath("s3://bucket/key/file.txt")
93
+ content = s3_file.read_text()
94
+
95
+ # Google Cloud Storage (synchronous)
96
+ gs_file = PanPath("gs://bucket/path/file.txt")
97
+ content = gs_file.read_text()
98
+
99
+ # Azure Blob Storage (synchronous)
100
+ azure_file = PanPath("az://container/path/file.txt")
101
+ content = azure_file.read_text()
102
+ ```
103
+
104
+ ### Asynchronous Usage
105
+
106
+ ```python
107
+ from panpath import PanPath, AsyncPanPath
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()
112
+
113
+ # Option 2: Using AsyncPanPath (always async)
114
+ async_gs = AsyncPanPath("gs://bucket/path/file.txt")
115
+ content = await async_gs.read_text()
116
+
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()
121
+ ```
122
+
123
+ ### Path Operations
124
+
125
+ ```python
126
+ from panpath import PanPath
127
+
128
+ # Path operations preserve type and mode
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)
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
137
+ ```
138
+
139
+ ### Bulk Operations and Cross-Storage Transfers
140
+
141
+ ```python
142
+ from panpath import PanPath
143
+
144
+ # Copy between different cloud providers
145
+ s3_file = PanPath("s3://my-bucket/data.csv")
146
+ s3_file.copy("gs://other-bucket/data.csv") # S3 โ†’ GCS
147
+
148
+ # Download entire directory from cloud
149
+ cloud_dir = PanPath("s3://bucket/dataset/")
150
+ cloud_dir.copytree("/tmp/dataset/") # Downloads all files
151
+
152
+ # Upload local directory to cloud
153
+ local_dir = PanPath("/home/user/project/")
154
+ local_dir.copytree("az://container/project/") # Uploads to Azure
155
+
156
+ # Remove directory recursively
157
+ temp_dir = PanPath("gs://bucket/temp/")
158
+ temp_dir.rmtree() # Deletes all files in temp/
159
+
160
+ # Move between cloud providers (copy + delete)
161
+ s3_data = PanPath("s3://old-bucket/data/")
162
+ s3_data.rename("gs://new-bucket/data/") # Migrates to GCS
163
+ ```
164
+
165
+ See [bulk-operations.md](docs/guide/bulk-operations.md) for detailed documentation and examples.
166
+
167
+ ## URI Schemes
168
+
169
+ - `file://` or no prefix โ†’ Local filesystem
170
+ - `s3://` โ†’ Amazon S3
171
+ - `gs://` โ†’ Google Cloud Storage
172
+ - `az://` or `azure://` โ†’ Azure Blob Storage
173
+
174
+ ## Architecture
175
+
176
+ PanPath uses a metaclass factory pattern to dispatch path creation based on URI scheme and mode parameter:
177
+
178
+ - **Sync Mode**: Returns `LocalPath`, `S3Path`, `GSPath`, or `AzureBlobPath`
179
+ - **Async Mode**: Returns `AsyncLocalPath`, `AsyncS3Path`, `AsyncGSPath`, or `AsyncAzureBlobPath`
180
+
181
+ Cloud paths use lazy client instantiation - SDK clients are only created on first I/O operation.
182
+
183
+ ## Type Hints
184
+
185
+ PanPath provides comprehensive type hints with `@overload` decorators:
186
+
187
+ ```python
188
+ from panpath import PanPath
189
+ from typing import Literal
190
+
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")
194
+ ```
195
+
196
+ ## Testing
197
+
198
+ Use local mock infrastructure for testing without cloud credentials:
199
+
200
+ ```python
201
+ import pytest
202
+ from panpath.testing import use_local_mocks
203
+
204
+ @use_local_mocks()
205
+ def test_s3_operations():
206
+ path = PanPath("s3://test-bucket/file.txt")
207
+ path.write_text("test content")
208
+ assert path.read_text() == "test content"
209
+ ```
210
+
211
+ ## Migration Guide
212
+
213
+ ### From pathlib
214
+
215
+ ```python
216
+ # Before
217
+ from pathlib import Path
218
+ path = Path("/local/file.txt")
219
+
220
+ # After (drop-in replacement)
221
+ from panpath import PanPath
222
+ path = PanPath("/local/file.txt")
223
+ ```
224
+
225
+ ### From cloudpathlib
226
+
227
+ ```python
228
+ # Before
229
+ from cloudpathlib import S3Path
230
+ path = S3Path("s3://bucket/key")
231
+
232
+ # After
233
+ from panpath import PanPath
234
+ path = PanPath("s3://bucket/key")
235
+ ```
236
+
237
+ ### From aiopath
238
+
239
+ ```python
240
+ # Before
241
+ from aiopath import AsyncPath
242
+ path = AsyncPath("/local/file.txt")
243
+
244
+ # After
245
+ from panpath import AsyncPanPath
246
+ path = AsyncPanPath("/local/file.txt")
247
+ ```
248
+
249
+ ## License
250
+
251
+ MIT License - see LICENSE file for details.
252
+
253
+ ## Contributing
254
+
255
+ Contributions welcome! Please see CONTRIBUTING.md for guidelines.
256
+
@@ -0,0 +1,25 @@
1
+ panpath/__init__.py,sha256=WtoR2lZVfwJ33_80YGvNoUzTQHEl4nA3fxzz9HlhWOw,2214
2
+ panpath/azure_async.py,sha256=4-6pAb0riysxiU9zz173NwV3jqQkEt4E2F_86-S8Bcs,641
3
+ panpath/azure_async_client.py,sha256=5qIUcyfKb27q4WTg4AwtHUVvwJ6yWbshdYeG2z-e4CM,21030
4
+ panpath/azure_client.py,sha256=HRT5TdC8GOIohdcQT7bhj46dBHOwBF1VLBgzt4bKL-4,20725
5
+ panpath/azure_sync.py,sha256=9Drfi5H38CcAaB2UXYmdmfnIUZV-2l5sI1qTZbaPj1A,577
6
+ panpath/base.py,sha256=MdHRlPaUwG8lOX1GvEbctEhn2_QAACY9zo4srxWAgJ8,34929
7
+ panpath/clients.py,sha256=Gs5fpT2_WT9WdVlzwd6s5epVPfFGvjLdCvR_pb8MGj4,7486
8
+ panpath/exceptions.py,sha256=tugfvK6FZ45DcscvLoT27NRQBBV8wCTPYAc5JaXemhM,911
9
+ panpath/gs_async.py,sha256=WsFlJ89gP3uPG-sqIHkZi6D0KdKOyjiGXMCiT3qz4KE,600
10
+ panpath/gs_async_client.py,sha256=tQlo48jCsWTG9OllwBRWMPz6KgpYhz1xkEXXc3T5-CM,19553
11
+ panpath/gs_client.py,sha256=kdCS_SpeiJ3_9wGgXpQPT5pp_Rw4BuNgK8p8gDvN6A8,18302
12
+ panpath/gs_sync.py,sha256=fu3C1rTmmlO2oPW8fjFsaY17idOVJQ6ziRb65gXT2PY,536
13
+ panpath/local_async.py,sha256=2acOut7ruDhXrXnCmN-HSHt34FWQ-di2rq1aLRDB77w,5157
14
+ panpath/local_sync.py,sha256=h_8jpnnImew-Nq4QAYWqCRrD9Fn1iIU-Vb2hiWfABu8,828
15
+ panpath/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ panpath/registry.py,sha256=0dsiZAoVHOoELpOUAnSKi9pqhSvEUJddYV6oHA7Y4G0,2015
17
+ panpath/router.py,sha256=EN7a0WOaGc3NRllF6tR_5eh5ck_S-cSWcgU_6lwayJk,5161
18
+ panpath/s3_async.py,sha256=21TrMH7-2UAwi0wQ5A6NFenJHyFMKVnqhOZeok1x-Wk,563
19
+ panpath/s3_async_client.py,sha256=ggdLbZQlk7Dyeq_FNqggMAOUT54l-bUygC13YIQ7ihk,22229
20
+ panpath/s3_client.py,sha256=52pOCwmfn8INn9-7yGtx9XGHRj7LF3bZV9guOIChgcg,20095
21
+ panpath/s3_sync.py,sha256=vyz1_EABqctrpPwLVvN0WA4o3eol4SUsO3gOL9N6HDU,588
22
+ panpath-0.1.0.dist-info/METADATA,sha256=jR8iiMeZnD6_jDHXHqGLuKF4evpqP_wgAGNn0NshmYI,7554
23
+ panpath-0.1.0.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
24
+ panpath-0.1.0.dist-info/licenses/LICENSE,sha256=O4inIoOOO4bQCPQm6q0nc_onF8acvTPe3nCCmev2TWs,1077
25
+ panpath-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 2.2.1
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 panpath contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.