S3 Incremental File Processor
A Python package that allows users to fetch new files from an S3 bucket in an incremental fashion. It supports checkpointing, ensuring that only new files are accessed in the next run. The package also provides a method to reset the checkpoint, enabling the reprocessing of all data if needed.
Features
- Incremental File Processing: Fetch only new or modified files from an S3 bucket.
- Checkpointing: Keeps track of processed files to prevent duplicate processing.
- Batch Processing: Process files in configurable batch sizes.
- Storage Class Filtering: Fetch files based on their storage class (e.g.,
STANDARD). - Reset Checkpoint: Delete the checkpoint to reprocess all files.
- Handles Edge Cases: Ensures correct file ordering when timestamps are identical.
Installation
pip install S3IncrementalProcessor
Usage
from S3IncrementalProcessor import S3IncrementalProcessor
# Initialize the processor with S3 paths
processor = S3IncrementalProcessor(
"s3://your-bucket/path/to/files/",
"s3://your-bucket/checkpoints/checkpoint.json"
)
# Fetch new files in batches
new_files = processor.get_new_files(batch_size=5)
if new_files:
print(f"Processing {len(new_files)} files:")
for file in new_files:
print(f"- {file}")
# Add your processing logic here
# Commit the checkpoint after processing
processor.commit_checkpoint()
else:
print("No new or modified files found.")
# To reset checkpoint and reprocess all files
# processor.reset_checkpoint()
Test Cases
This package has been tested with the following scenarios:
1. 10 Files, Batch Size 5
- Expected: Two runs to process all files. A third run should return no new files.
2. 10 Files, Batch Size 100
- Expected: One run should process all 10 files.
3. Files with Identical Timestamps
- Ensures: Files uploaded simultaneously using threading are correctly ordered, and only new files are processed.
Contributing
Contributions are welcome! Please open an issue or submit a pull request. License
Metadata
Release files for S3IncrementalProcessor 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| s3incrementalprocessor-0.1.2.tar.gz | 3.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| S3IncrementalProcessor-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.1 kB
Release files / s3incrementalprocessor-0.1.2.tar.gz
| Download URL | s3incrementalprocessor-0.1.2.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bad95b3045fc88f29d1b168779860ff86389a27d4155d5458e642887a7f29ed8
|
|
BLAKE2b-256 checksum How to use checksums |
0c7f3fec79b233482416e4728094d9c70542841cc84b446fcf24f6159cb6040c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.7
|
Release files / S3IncrementalProcessor-0.1.2-py3-none-any.whl
| Download URL | S3IncrementalProcessor-0.1.2-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
845d0e212c4168629a7c88c9115068eb54de193273b3526d851d6c304fbea52f
|
|
BLAKE2b-256 checksum How to use checksums |
56f57726b419ff38bdfd713d6c19273ee8ff1344583b8f81a01ef22329055fd7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.7
|
Security for S3IncrementalProcessor 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.