feat: replace s3fs/aiobotocore with boto3-based fsspec backend - #81
Open
acere wants to merge 3 commits into
Open
feat: replace s3fs/aiobotocore with boto3-based fsspec backend#81acere wants to merge 3 commits into
acere wants to merge 3 commits into
Conversation
Replace the problematic s3fs/aiobotocore dependency chain with a self-contained AsyncFileSystem implementation using boto3 directly. This eliminates the well-known version conflicts between s3fs's pinned aiobotocore and boto3 (GitHub issue awslabs#77). Key changes: - Add llmeter/s3fs.py: Boto3S3FileSystem (AsyncFileSystem subclass) wrapping synchronous boto3 calls in asyncio.to_thread() - Add registration in llmeter/__init__.py with fallback to s3fs/obstore - Change pyproject.toml: fsspec[http,s3] -> fsspec[http], add entry point - Add tests/test_s3fs.py: 47 unit tests using moto mock_aws - Add tests/integ/test_s3fs_integ.py: 23 integration tests against real S3 - Add S3 fixtures to tests/integ/conftest.py
- Add docs/user_guide/s3_storage.md covering usage, credentials, custom config, fallback behavior, limitations, and async support - Add docs/reference/s3fs.md for auto-generated API docs - Update installation guide with S3 storage section - Add both pages to mkdocs.yml navigation
- Extract _translate_error() helper to replace repeated error code checks - Remove unnecessary boto3 ImportError guard (it's a core dependency) - Remove head_object pre-check in _rm_file (S3 delete is idempotent) - Let _put_file propagate boto3 errors directly (no wrapping needed) - Remove unused `import fsspec` (only fsspec.spec is needed) - Raise ValueError on bare bucket delete instead of silent return - Update tests to reflect idempotent delete semantics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace the
s3fs/aiobotocoredependency chain with a self-containedAsyncFileSystemimplementation usingboto3directly. This eliminates the version conflicts between s3fs's pinned aiobotocore and boto3 (resolves #77).Changes
llmeter/s3fs.py: NewBoto3S3FileSystemclass (fsspecAsyncFileSystemsubclass) wrapping synchronous boto3 calls inasyncio.to_thread()llmeter/__init__.py: Auto-registration with fallback — defers to s3fs/obstore if installedpyproject.toml:fsspec[http,s3]→fsspec[http], added fsspec entry pointtests/test_s3fs.py: 47 unit tests using mototests/integ/test_s3fs_integ.py: 23 integration tests against real S3docs/: User guide and API reference pagesDesign Decisions
asyncio.to_thread()for non-blocking I/O (boto3 clients are thread-safe, GIL released during socket I/O)rm_file(matches S3 nativedelete_objectsemantics — no pre-check)_translate_error()helper for consistent ClientError → Python exception mappingTesting
ruff checkandruff formatclean