fsspeckit 0.3.1__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.
- fsspeckit-0.3.1/.factory/docs/2025-10-17-pyarrow-type-promotion-rules-for-unify_schemas.md +53 -0
- fsspeckit-0.3.1/.github/workflows/publish-to-pypi.yml +64 -0
- fsspeckit-0.3.1/.gitignore +9 -0
- fsspeckit-0.3.1/.nojekyll +0 -0
- fsspeckit-0.3.1/LICENSE +21 -0
- fsspeckit-0.3.1/PKG-INFO +330 -0
- fsspeckit-0.3.1/README.md +285 -0
- fsspeckit-0.3.1/docs/advanced.md +759 -0
- fsspeckit-0.3.1/docs/api/fsspeckit.core.base.md +445 -0
- fsspeckit-0.3.1/docs/api/fsspeckit.core.ext.md +822 -0
- fsspeckit-0.3.1/docs/api/fsspeckit.helpers.datetime.md +106 -0
- fsspeckit-0.3.1/docs/api/fsspeckit.helpers.logging.md +51 -0
- fsspeckit-0.3.1/docs/api/fsspeckit.helpers.misc.md +113 -0
- fsspeckit-0.3.1/docs/api/fsspeckit.helpers.polars.md +287 -0
- fsspeckit-0.3.1/docs/api/fsspeckit.helpers.pyarrow.md +167 -0
- fsspeckit-0.3.1/docs/api/fsspeckit.helpers.sql.md +68 -0
- fsspeckit-0.3.1/docs/api/fsspeckit.helpers.types.md +76 -0
- fsspeckit-0.3.1/docs/api/fsspeckit.storage_options.base.md +166 -0
- fsspeckit-0.3.1/docs/api/fsspeckit.storage_options.cloud.md +477 -0
- fsspeckit-0.3.1/docs/api/fsspeckit.storage_options.core.md +462 -0
- fsspeckit-0.3.1/docs/api/fsspeckit.storage_options.git.md +185 -0
- fsspeckit-0.3.1/docs/api/index.md +35 -0
- fsspeckit-0.3.1/docs/api-guide.md +499 -0
- fsspeckit-0.3.1/docs/architecture.md +56 -0
- fsspeckit-0.3.1/docs/contributing.md +83 -0
- fsspeckit-0.3.1/docs/examples.md +308 -0
- fsspeckit-0.3.1/docs/helpers.md +366 -0
- fsspeckit-0.3.1/docs/index.md +24 -0
- fsspeckit-0.3.1/docs/installation.md +72 -0
- fsspeckit-0.3.1/docs/javascripts/mermaid.js +4 -0
- fsspeckit-0.3.1/docs/quickstart.md +68 -0
- fsspeckit-0.3.1/examples/__pydala_dataset/README.md +46 -0
- fsspeckit-0.3.1/examples/__pydala_dataset/pydala_dataset_example.ipynb +196 -0
- fsspeckit-0.3.1/examples/__pydala_dataset/pydala_dataset_example.py +149 -0
- fsspeckit-0.3.1/examples/__pydala_dataset/pydala_dataset_example_mamo.py +217 -0
- fsspeckit-0.3.1/examples/batch_processing/README.md +45 -0
- fsspeckit-0.3.1/examples/batch_processing/batch_processing_example.ipynb +282 -0
- fsspeckit-0.3.1/examples/batch_processing/batch_processing_example.py +187 -0
- fsspeckit-0.3.1/examples/batch_processing/batch_processing_example_mamo.py +223 -0
- fsspeckit-0.3.1/examples/batch_processing/generate_batched_data.py +34 -0
- fsspeckit-0.3.1/examples/caching/README.md +43 -0
- fsspeckit-0.3.1/examples/caching/caching_example.ipynb +281 -0
- fsspeckit-0.3.1/examples/caching/caching_example.py +124 -0
- fsspeckit-0.3.1/examples/caching/caching_example_mamo.py +168 -0
- fsspeckit-0.3.1/examples/caching/setup_data.py +17 -0
- fsspeckit-0.3.1/examples/deltalake_delta_table/README.md +52 -0
- fsspeckit-0.3.1/examples/deltalake_delta_table/deltalake_delta_table_example.ipynb +51 -0
- fsspeckit-0.3.1/examples/deltalake_delta_table/deltalake_delta_table_example.py +13 -0
- fsspeckit-0.3.1/examples/deltalake_delta_table/deltalake_delta_table_example_mamo.py +49 -0
- fsspeckit-0.3.1/examples/dir_file_system/README.md +43 -0
- fsspeckit-0.3.1/examples/dir_file_system/dir_file_system_example.ipynb +114 -0
- fsspeckit-0.3.1/examples/dir_file_system/dir_file_system_example.py +22 -0
- fsspeckit-0.3.1/examples/dir_file_system/dir_file_system_example_mamo.py +22 -0
- fsspeckit-0.3.1/examples/read_folder/README.md +45 -0
- fsspeckit-0.3.1/examples/read_folder/create_dataset.py +30 -0
- fsspeckit-0.3.1/examples/read_folder/read_folder_example.ipynb +285 -0
- fsspeckit-0.3.1/examples/read_folder/read_folder_example.py +183 -0
- fsspeckit-0.3.1/examples/read_folder/read_folder_example_mamo.py +227 -0
- fsspeckit-0.3.1/examples/s3_pyarrow_dataset/README.md +66 -0
- fsspeckit-0.3.1/examples/s3_pyarrow_dataset/s3_pyarrow_dataset.ipynb +250 -0
- fsspeckit-0.3.1/examples/s3_pyarrow_dataset/s3_pyarrow_dataset.py +157 -0
- fsspeckit-0.3.1/examples/s3_pyarrow_dataset/s3_pyarrow_dataset_mamo.py +158 -0
- fsspeckit-0.3.1/examples/storage_options/README.md +43 -0
- fsspeckit-0.3.1/examples/storage_options/storage_options_example.ipynb +260 -0
- fsspeckit-0.3.1/examples/storage_options/storage_options_example.py +194 -0
- fsspeckit-0.3.1/examples/storage_options/storage_options_example_mamo.py +233 -0
- fsspeckit-0.3.1/mkdocs.yml +133 -0
- fsspeckit-0.3.1/pyproject.toml +127 -0
- fsspeckit-0.3.1/src/fsspeckit/__init__.py +41 -0
- fsspeckit-0.3.1/src/fsspeckit/core/__init__.py +24 -0
- fsspeckit-0.3.1/src/fsspeckit/core/base.py +991 -0
- fsspeckit-0.3.1/src/fsspeckit/core/ext.py +2155 -0
- fsspeckit-0.3.1/src/fsspeckit/helpers/__init__.py +25 -0
- fsspeckit-0.3.1/src/fsspeckit/helpers/datetime.py +298 -0
- fsspeckit-0.3.1/src/fsspeckit/helpers/logging.py +79 -0
- fsspeckit-0.3.1/src/fsspeckit/helpers/misc.py +736 -0
- fsspeckit-0.3.1/src/fsspeckit/helpers/polars.py +953 -0
- fsspeckit-0.3.1/src/fsspeckit/helpers/pyarrow.py +1261 -0
- fsspeckit-0.3.1/src/fsspeckit/helpers/sql.py +333 -0
- fsspeckit-0.3.1/src/fsspeckit/helpers/types.py +214 -0
- fsspeckit-0.3.1/src/fsspeckit/storage_options/__init__.py +30 -0
- fsspeckit-0.3.1/src/fsspeckit/storage_options/base.py +133 -0
- fsspeckit-0.3.1/src/fsspeckit/storage_options/cloud.py +748 -0
- fsspeckit-0.3.1/src/fsspeckit/storage_options/core.py +469 -0
- fsspeckit-0.3.1/src/fsspeckit/storage_options/git.py +274 -0
- fsspeckit-0.3.1/tests/__init__.py +1 -0
- fsspeckit-0.3.1/tests/test_basic.py +229 -0
- fsspeckit-0.3.1/tests/test_sql.py +201 -0
- fsspeckit-0.3.1/tests/test_storage_options_cloud.py +126 -0
- fsspeckit-0.3.1/tests/test_utils/__init__.py +3 -0
- fsspeckit-0.3.1/tests/test_utils/conftest.py +278 -0
- fsspeckit-0.3.1/tests/test_utils/test_utils_datetime.py +179 -0
- fsspeckit-0.3.1/tests/test_utils/test_utils_integration.py +402 -0
- fsspeckit-0.3.1/tests/test_utils/test_utils_logging.py +126 -0
- fsspeckit-0.3.1/tests/test_utils/test_utils_misc.py +294 -0
- fsspeckit-0.3.1/tests/test_utils/test_utils_polars.py +423 -0
- fsspeckit-0.3.1/tests/test_utils/test_utils_pyarrow.py +424 -0
- fsspeckit-0.3.1/tests/test_utils/test_utils_sql.py +330 -0
- fsspeckit-0.3.1/tests/test_utils/test_utils_types.py +318 -0
- fsspeckit-0.3.1/uv.lock +3530 -0
- fsspeckit-0.3.1/version.txt +1 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# PyArrow `unify_schemas` Type Promotion Analysis
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
When using `pyarrow.unify_schemas` with `promote_options="permissive"`, PyArrow attempts to promote incompatible types to a common denominator. However, not all type combinations can be unified.
|
|
5
|
+
|
|
6
|
+
## Supported Type Promotions
|
|
7
|
+
|
|
8
|
+
### Numeric Types (Within same category)
|
|
9
|
+
- **Integer promotion**: int8 → int16 → int32 → int64
|
|
10
|
+
- **Unsigned integer promotion**: uint8 → uint16 → uint32 → uint64
|
|
11
|
+
- **Float promotion**: float32 → float64
|
|
12
|
+
- **Mixed numeric**: Integer types can be promoted to float types when necessary
|
|
13
|
+
- int8/int16/int32/int64 → float32/float64
|
|
14
|
+
- uint8/uint16/uint32/uint64 → float32/float64
|
|
15
|
+
|
|
16
|
+
### Temporal Types
|
|
17
|
+
- **Date promotion**: date32 → date64
|
|
18
|
+
- **Time promotion**: time32 → time64
|
|
19
|
+
- **Timestamp promotion**: Different timestamp precisions can be unified to higher precision
|
|
20
|
+
|
|
21
|
+
### Null Type Compatibility
|
|
22
|
+
- **Null with any type**: null type can be promoted to any other type
|
|
23
|
+
|
|
24
|
+
## Unsupported Type Promotions (Incompatible)
|
|
25
|
+
|
|
26
|
+
### Numeric vs String Types
|
|
27
|
+
- **String ↔ Numeric**: Cannot promote between string types and any numeric types (int, uint, float)
|
|
28
|
+
- This is the most common source of `ArrowInvalid` errors
|
|
29
|
+
|
|
30
|
+
### Binary vs Non-Binary Types
|
|
31
|
+
- **Binary ↔ Non-binary**: Binary types cannot be promoted to non-binary types and vice versa
|
|
32
|
+
|
|
33
|
+
### Complex Nested Types
|
|
34
|
+
- **Struct ↔ Struct**: Only if field names and types are compatible
|
|
35
|
+
- **List ↔ List**: Only if element types are compatible
|
|
36
|
+
- **Struct ↔ List**: Never compatible
|
|
37
|
+
|
|
38
|
+
### Logical vs Physical Types
|
|
39
|
+
- **Dictionary ↔ Plain types**: Generally incompatible unless explicitly cast
|
|
40
|
+
|
|
41
|
+
## Error Scenarios
|
|
42
|
+
The function raises `ArrowInvalid` when:
|
|
43
|
+
1. Numeric and string types are mixed
|
|
44
|
+
2. Binary and non-binary types are mixed
|
|
45
|
+
3. Struct fields have incompatible types
|
|
46
|
+
4. List elements have incompatible types
|
|
47
|
+
5. Any other fundamentally incompatible type combinations
|
|
48
|
+
|
|
49
|
+
## Best Practices
|
|
50
|
+
1. Ensure compatible types across schemas for the same field names
|
|
51
|
+
2. Use explicit casting before unification for known incompatible types
|
|
52
|
+
3. Consider null types as universal promotable targets
|
|
53
|
+
4. Test with sample schemas before full dataset processing
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
name: Publish Python 🐍 distribution to PyPI on version bump
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
paths:
|
|
7
|
+
- "pyproject.toml"
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
publish:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout code
|
|
14
|
+
uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- name: Set up Python
|
|
17
|
+
uses: actions/setup-python@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: "3.13"
|
|
20
|
+
|
|
21
|
+
- name: Install uv
|
|
22
|
+
run: |
|
|
23
|
+
pip install uv
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: |
|
|
27
|
+
uv sync --no-dev
|
|
28
|
+
|
|
29
|
+
- name: Get current version from pyproject.toml
|
|
30
|
+
id: get_version
|
|
31
|
+
run: |
|
|
32
|
+
uv run python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])" > version.txt
|
|
33
|
+
echo "version=$(cat version.txt)" >> $GITHUB_OUTPUT
|
|
34
|
+
|
|
35
|
+
- name: Get latest version from PyPI
|
|
36
|
+
id: get_latest
|
|
37
|
+
run: |
|
|
38
|
+
PKG_NAME=$(uv run python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['name'])")
|
|
39
|
+
LATEST_VERSION=$(curl -s https://pypi.org/pypi/$PKG_NAME/json | uv run python -c "import sys, json; data = json.load(sys.stdin); print(data['info']['version']) if 'info' in data else print('0.0.0')" 2>/dev/null || echo "0.0.0")
|
|
40
|
+
echo "latest=$LATEST_VERSION" >> $GITHUB_OUTPUT
|
|
41
|
+
|
|
42
|
+
- name: Compare versions and set publish flag
|
|
43
|
+
id: check_version
|
|
44
|
+
run: |
|
|
45
|
+
SHOULD_PUBLISH=$(uv run python -c "
|
|
46
|
+
from packaging.version import parse
|
|
47
|
+
import os
|
|
48
|
+
current = parse('${{ steps.get_version.outputs.version }}')
|
|
49
|
+
latest = parse('${{ steps.get_latest.outputs.latest }}')
|
|
50
|
+
print('true' if current > latest else 'false')
|
|
51
|
+
")
|
|
52
|
+
echo "publish=$SHOULD_PUBLISH" >> $GITHUB_OUTPUT
|
|
53
|
+
|
|
54
|
+
- name: Build package
|
|
55
|
+
if: steps.check_version.outputs.publish == 'true'
|
|
56
|
+
run: |
|
|
57
|
+
uv build --sdist --wheel
|
|
58
|
+
|
|
59
|
+
- name: Publish to PyPI
|
|
60
|
+
if: steps.check_version.outputs.publish == 'true'
|
|
61
|
+
env:
|
|
62
|
+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
|
|
63
|
+
run: |
|
|
64
|
+
uv publish --token $PYPI_TOKEN
|
|
File without changes
|
fsspeckit-0.3.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 FlowerPower Team
|
|
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.
|
fsspeckit-0.3.1/PKG-INFO
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fsspeckit
|
|
3
|
+
Version: 0.3.1
|
|
4
|
+
Summary: Enhanced utilities and extensions for fsspec, storage_options and obstore with multi-format I/O support.
|
|
5
|
+
Project-URL: Homepage, https://github.com/legout/fsspeckit
|
|
6
|
+
Project-URL: Documentation, https://legout.github.io/fsspeckit
|
|
7
|
+
Project-URL: Repository, https://github.com/legout/fsspeckit.git
|
|
8
|
+
Project-URL: Issues, https://github.com/legout/fsspeckit/issues
|
|
9
|
+
Author-email: legout <ligno.blades@gmail.com>
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: azure,cloud-storage,csv,data-io,filesystem,fsspec,gcs,json,object-storage,obstore,parquet,s3
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Classifier: Topic :: System :: Filesystems
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Requires-Dist: fsspec>=2025.1.0
|
|
25
|
+
Requires-Dist: joblib>=1.5.0
|
|
26
|
+
Requires-Dist: loguru>=0.7.0
|
|
27
|
+
Requires-Dist: msgspec>=0.18.0
|
|
28
|
+
Requires-Dist: obstore>=0.8.2
|
|
29
|
+
Requires-Dist: orjson>=3.11.0
|
|
30
|
+
Requires-Dist: pandas>=2.2.0
|
|
31
|
+
Requires-Dist: polars>=1.30.0
|
|
32
|
+
Requires-Dist: pyarrow>=20.0.0
|
|
33
|
+
Requires-Dist: pyyaml>=6.0
|
|
34
|
+
Requires-Dist: requests>=2.25.0
|
|
35
|
+
Requires-Dist: rich>=14.0.0
|
|
36
|
+
Requires-Dist: sqlglot>=27.16.3
|
|
37
|
+
Provides-Extra: aws
|
|
38
|
+
Requires-Dist: boto3>=1.26.0; extra == 'aws'
|
|
39
|
+
Requires-Dist: s3fs>=2025.1.0; extra == 'aws'
|
|
40
|
+
Provides-Extra: azure
|
|
41
|
+
Requires-Dist: adlfs>=2024.12.0; extra == 'azure'
|
|
42
|
+
Provides-Extra: gcp
|
|
43
|
+
Requires-Dist: gcsfs>=2025.1.0; extra == 'gcp'
|
|
44
|
+
Description-Content-Type: text/markdown
|
|
45
|
+
|
|
46
|
+
# fsspeckit
|
|
47
|
+
|
|
48
|
+
Enhanced utilities and extensions for fsspec filesystems with multi-format I/O support.
|
|
49
|
+
|
|
50
|
+
## Overview
|
|
51
|
+
|
|
52
|
+
`fsspeckit` is a comprehensive toolkit that extends [fsspec](https://filesystem-spec.readthedocs.io/) with:
|
|
53
|
+
|
|
54
|
+
- **Multi-cloud storage configuration** - Easy setup for AWS S3, Google Cloud Storage, Azure Storage, GitHub, and GitLab
|
|
55
|
+
- **Enhanced caching** - Improved caching filesystem with monitoring and path preservation
|
|
56
|
+
- **Extended I/O operations** - Read/write operations for JSON, CSV, Parquet with Polars/PyArrow integration
|
|
57
|
+
- **Utility functions** - Type conversion, parallel processing, and data transformation helpers
|
|
58
|
+
|
|
59
|
+
[](https://deepwiki.com/legout/fsspeckit)
|
|
60
|
+
|
|
61
|
+
## Installation
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Basic installation
|
|
65
|
+
pip install fsspeckit
|
|
66
|
+
|
|
67
|
+
# Specific cloud providers
|
|
68
|
+
pip install "fsspeckit[aws]" # AWS S3 support
|
|
69
|
+
pip install "fsspeckit[gcp]" # Google Cloud Storage
|
|
70
|
+
pip install "fsspeckit[azure]" # Azure Storage
|
|
71
|
+
|
|
72
|
+
# Multiple cloud providers
|
|
73
|
+
pip install "fsspeckit[aws,gcp,azure]"
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Quick Start
|
|
77
|
+
|
|
78
|
+
### Basic Filesystem Operations
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
from fsspeckit import filesystem
|
|
82
|
+
|
|
83
|
+
# Local filesystem
|
|
84
|
+
fs = filesystem("file")
|
|
85
|
+
files = fs.ls("/path/to/data")
|
|
86
|
+
|
|
87
|
+
# S3 with caching
|
|
88
|
+
fs = filesystem("s3://my-bucket/", cached=True)
|
|
89
|
+
data = fs.cat("data/file.txt")
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Storage Configuration
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
from fsspeckit.storage_options import AwsStorageOptions
|
|
96
|
+
|
|
97
|
+
# Configure S3 access
|
|
98
|
+
options = AwsStorageOptions(
|
|
99
|
+
region="us-west-2",
|
|
100
|
+
access_key_id="YOUR_KEY",
|
|
101
|
+
secret_access_key="YOUR_SECRET"
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
fs = filesystem("s3", storage_options=options, cached=True)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Environment-based Configuration
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
from fsspeckit.storage_options import AwsStorageOptions
|
|
111
|
+
|
|
112
|
+
# Load from environment variables
|
|
113
|
+
options = AwsStorageOptions.from_env()
|
|
114
|
+
fs = filesystem("s3", storage_options=options)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Multiple Cloud Providers
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
from fsspeckit.storage_options import (
|
|
121
|
+
AwsStorageOptions,
|
|
122
|
+
GcsStorageOptions,
|
|
123
|
+
GitHubStorageOptions
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
# AWS S3
|
|
127
|
+
s3_fs = filesystem("s3", storage_options=AwsStorageOptions.from_env())
|
|
128
|
+
|
|
129
|
+
# Google Cloud Storage
|
|
130
|
+
gcs_fs = filesystem("gs", storage_options=GcsStorageOptions.from_env())
|
|
131
|
+
|
|
132
|
+
# GitHub repository
|
|
133
|
+
github_fs = filesystem("github", storage_options=GitHubStorageOptions(
|
|
134
|
+
org="microsoft",
|
|
135
|
+
repo="vscode",
|
|
136
|
+
token="ghp_xxxx"
|
|
137
|
+
))
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Storage Options
|
|
141
|
+
|
|
142
|
+
### AWS S3
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
from fsspeckit.storage_options import AwsStorageOptions
|
|
146
|
+
|
|
147
|
+
# Basic credentials
|
|
148
|
+
options = AwsStorageOptions(
|
|
149
|
+
access_key_id="AKIAXXXXXXXX",
|
|
150
|
+
secret_access_key="SECRET",
|
|
151
|
+
region="us-east-1"
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
# From AWS profile
|
|
155
|
+
options = AwsStorageOptions.create(profile="dev")
|
|
156
|
+
|
|
157
|
+
# S3-compatible service (MinIO)
|
|
158
|
+
options = AwsStorageOptions(
|
|
159
|
+
endpoint_url="http://localhost:9000",
|
|
160
|
+
access_key_id="minioadmin",
|
|
161
|
+
secret_access_key="minioadmin",
|
|
162
|
+
allow_http=True
|
|
163
|
+
)
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Google Cloud Storage
|
|
167
|
+
|
|
168
|
+
```python
|
|
169
|
+
from fsspeckit.storage_options import GcsStorageOptions
|
|
170
|
+
|
|
171
|
+
# Service account
|
|
172
|
+
options = GcsStorageOptions(
|
|
173
|
+
token="path/to/service-account.json",
|
|
174
|
+
project="my-project-123"
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
# From environment
|
|
178
|
+
options = GcsStorageOptions.from_env()
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Azure Storage
|
|
182
|
+
|
|
183
|
+
```python
|
|
184
|
+
from fsspeckit.storage_options import AzureStorageOptions
|
|
185
|
+
|
|
186
|
+
# Account key
|
|
187
|
+
options = AzureStorageOptions(
|
|
188
|
+
protocol="az",
|
|
189
|
+
account_name="mystorageacct",
|
|
190
|
+
account_key="key123..."
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
# Connection string
|
|
194
|
+
options = AzureStorageOptions(
|
|
195
|
+
protocol="az",
|
|
196
|
+
connection_string="DefaultEndpoints..."
|
|
197
|
+
)
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### GitHub
|
|
201
|
+
|
|
202
|
+
```python
|
|
203
|
+
from fsspeckit.storage_options import GitHubStorageOptions
|
|
204
|
+
|
|
205
|
+
# Public repository
|
|
206
|
+
options = GitHubStorageOptions(
|
|
207
|
+
org="microsoft",
|
|
208
|
+
repo="vscode",
|
|
209
|
+
ref="main"
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
# Private repository
|
|
213
|
+
options = GitHubStorageOptions(
|
|
214
|
+
org="myorg",
|
|
215
|
+
repo="private-repo",
|
|
216
|
+
token="ghp_xxxx",
|
|
217
|
+
ref="develop"
|
|
218
|
+
)
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### GitLab
|
|
222
|
+
|
|
223
|
+
```python
|
|
224
|
+
from fsspeckit.storage_options import GitLabStorageOptions
|
|
225
|
+
|
|
226
|
+
# Public project
|
|
227
|
+
options = GitLabStorageOptions(
|
|
228
|
+
project_name="group/project",
|
|
229
|
+
ref="main"
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
# Private project with token
|
|
233
|
+
options = GitLabStorageOptions(
|
|
234
|
+
project_id=12345,
|
|
235
|
+
token="glpat_xxxx",
|
|
236
|
+
ref="develop"
|
|
237
|
+
)
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
## Enhanced Caching
|
|
241
|
+
|
|
242
|
+
```python
|
|
243
|
+
from fsspeckit import filesystem
|
|
244
|
+
|
|
245
|
+
# Enable caching with monitoring
|
|
246
|
+
fs = filesystem(
|
|
247
|
+
"s3://my-bucket/",
|
|
248
|
+
cached=True,
|
|
249
|
+
cache_storage="/tmp/my_cache",
|
|
250
|
+
verbose=True
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
# Cache preserves directory structure
|
|
254
|
+
data = fs.cat("deep/nested/path/file.txt")
|
|
255
|
+
# Cached at: /tmp/my_cache/deep/nested/path/file.txt
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
## Utilities
|
|
259
|
+
|
|
260
|
+
### Parallel Processing
|
|
261
|
+
|
|
262
|
+
```python
|
|
263
|
+
from fsspeckit.helpers import run_parallel
|
|
264
|
+
|
|
265
|
+
# Run function in parallel
|
|
266
|
+
def process_file(path, multiplier=1):
|
|
267
|
+
return len(path) * multiplier
|
|
268
|
+
|
|
269
|
+
results = run_parallel(
|
|
270
|
+
process_file,
|
|
271
|
+
["/path1", "/path2", "/path3"],
|
|
272
|
+
multiplier=2,
|
|
273
|
+
n_jobs=4,
|
|
274
|
+
verbose=True
|
|
275
|
+
)
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### Type Conversion
|
|
279
|
+
|
|
280
|
+
```python
|
|
281
|
+
from fsspeckit.helpers import dict_to_dataframe, to_pyarrow_table
|
|
282
|
+
|
|
283
|
+
# Convert dict to DataFrame
|
|
284
|
+
data = {"col1": [1, 2, 3], "col2": [4, 5, 6]}
|
|
285
|
+
df = dict_to_dataframe(data)
|
|
286
|
+
|
|
287
|
+
# Convert to PyArrow table
|
|
288
|
+
table = to_pyarrow_table(df)
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### Logging
|
|
292
|
+
|
|
293
|
+
```python
|
|
294
|
+
from fsspeckit.helpers import setup_logging
|
|
295
|
+
|
|
296
|
+
# Configure logging
|
|
297
|
+
setup_logging(level="DEBUG", format_string="{time} | {level} | {message}")
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
## Dependencies
|
|
301
|
+
|
|
302
|
+
### Core Dependencies
|
|
303
|
+
- `fsspec>=2023.1.0` - Filesystem interface
|
|
304
|
+
- `msgspec>=0.18.0` - Serialization
|
|
305
|
+
- `pyyaml>=6.0` - YAML support
|
|
306
|
+
- `requests>=2.25.0` - HTTP requests
|
|
307
|
+
- `loguru>=0.7.0` - Logging
|
|
308
|
+
|
|
309
|
+
### Optional Dependencies
|
|
310
|
+
- `orjson>=3.8.0` - Fast JSON processing
|
|
311
|
+
- `polars>=0.19.0` - Fast DataFrames
|
|
312
|
+
- `pyarrow>=10.0.0` - Columnar data
|
|
313
|
+
- `pandas>=1.5.0` - Data analysis
|
|
314
|
+
- `joblib>=1.3.0` - Parallel processing
|
|
315
|
+
- `rich>=13.0.0` - Progress bars
|
|
316
|
+
|
|
317
|
+
### Cloud Provider Dependencies
|
|
318
|
+
- `boto3>=1.26.0`, `s3fs>=2023.1.0` - AWS S3
|
|
319
|
+
- `gcsfs>=2023.1.0` - Google Cloud Storage
|
|
320
|
+
- `adlfs>=2023.1.0` - Azure Storage
|
|
321
|
+
|
|
322
|
+
## Contributing
|
|
323
|
+
|
|
324
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
325
|
+
|
|
326
|
+
## License
|
|
327
|
+
|
|
328
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
|
329
|
+
|
|
330
|
+
|