4 Commits

Author SHA1 Message Date
Simone Scarduzio
69ed9056d2 feat: Implement boto3-compatible dict responses (Phase 2)
Changed list_objects() to return boto3-compatible dict instead of custom
ListObjectsResponse dataclass. This makes DeltaGlider a true drop-in replacement
for boto3.client('s3').

Changes:
- list_objects() now returns dict[str, Any] with boto3-compatible structure:
  * Contents: list[S3Object] (dict with Key, Size, LastModified, etc.)
  * CommonPrefixes: list[dict] for folder simulation
  * IsTruncated, NextContinuationToken for pagination
  * DeltaGlider metadata stored in standard Metadata field

- Updated all client methods that use list_objects() to work with dict responses:
  * find_similar_files()
  * get_bucket_stats()
  * CLI ls command

- Updated all tests to use dict access (response['Contents']) instead of
  dataclass access (response.contents)

- Updated examples/boto3_compatible_types.py to demonstrate usage

- DeltaGlider-specific metadata now in Metadata field:
  * deltaglider-is-delta: "true"/"false"
  * deltaglider-original-size: string number
  * deltaglider-compression-ratio: string number or "unknown"
  * deltaglider-reference-key: optional string

Benefits:
- True drop-in replacement for boto3
- No learning curve - if you know boto3, you know DeltaGlider
- Works with any boto3-compatible library
- Type safety through TypedDict (no boto3 import needed)
- Zero runtime overhead (TypedDict compiles to plain dict)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 14:23:50 +02:00
Simone Scarduzio
38134f28f5 feat: Add boto3-compatible TypedDict types (no boto3 import needed)
Add comprehensive TypedDict definitions for all boto3 S3 response types.
This provides full type safety without requiring boto3 imports in user code.

Benefits:
-  Type safety: IDE autocomplete and mypy type checking
-  No boto3 dependency: Just typing module (stdlib)
-  Runtime compatibility: TypedDict compiles to plain dict
-  Drop-in replacement: Exact same structure as boto3 responses

Types added:
- ListObjectsV2Response, S3Object, CommonPrefix
- PutObjectResponse, GetObjectResponse, DeleteObjectResponse
- HeadObjectResponse, DeleteObjectsResponse
- ListBucketsResponse, CreateBucketResponse, CopyObjectResponse
- ResponseMetadata, and more

Next step: Refactor client methods to return these dicts instead of
custom dataclasses (ListObjectsResponse, ObjectInfo, etc.)

Example usage:
```python
from deltaglider import ListObjectsV2Response, create_client

client = create_client()
response: ListObjectsV2Response = client.list_objects(Bucket='my-bucket')

for obj in response['Contents']:
    print(f"{obj['Key']}: {obj['Size']} bytes")  # Full autocomplete!
```

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 14:14:37 +02:00
Simone Scarduzio
2efa760785 feat: Add AWS credential parameters to create_client()
- Add aws_access_key_id, aws_secret_access_key, aws_session_token, and region_name parameters
- Pass credentials through to S3StorageAdapter and boto3.client()
- Enables multi-tenant scenarios with different AWS accounts
- Maintains backward compatibility (uses boto3 default credential chain when omitted)
- Add comprehensive tests for credential handling
- Add examples/credentials_example.py with usage examples

Fixes credential conflicts when multiple SDK instances need different credentials.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 09:07:40 +02:00
Simone Scarduzio
03106b76a8 feat: Add bucket management APIs and improve SDK filtering
This commit adds core bucket management functionality and enhances the SDK's internal file filtering to provide a cleaner abstraction layer.

**Bucket Management**:
- Add create_bucket(), delete_bucket(), list_buckets() to DeltaGliderClient
- Idempotent operations (creating existing bucket or deleting non-existent returns success)
- Complete boto3-compatible API for basic bucket operations
- Eliminates need for boto3 in most use cases

**Enhanced SDK Filtering**:
- SDK now filters .delta suffix and reference.bin from all list_objects() responses
- Simplified CLI to rely on SDK filtering (removed duplicate logic)
- Single source of truth for internal file hiding

**Delete Cleanup Logic**:
- Automatically removes orphaned reference.bin when last delta in DeltaSpace is deleted
- Prevents storage waste from abandoned reference files
- Works for both single delete() and recursive delete_recursive()

**Documentation & Testing**:
- Added BOTO3_COMPATIBILITY.md documenting actual 20% method coverage (21/100+ methods)
- Updated README to reflect accurate boto3 compatibility claims
- New comprehensive test suite for filtering and cleanup features (test_filtering_and_cleanup.py)
- New bucket management test suite (test_bucket_management.py)
- Example code for bucket lifecycle management (examples/bucket_management.py)
- Fixed mypy configuration to eliminate source file found twice errors
- All CI checks passing (lint, format, type check, 18 unit tests, 61 integration tests)

**Cleanup**:
- Removed PYPI_RELEASE.md (redundant with existing docs)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-03 19:07:08 +02:00