The Pythonic Bridge Between S3 and the Local Filesystem. Use S3 objects like local files with automatic sync.
Project description
Why s3lync?
Most S3 libraries focus on object operations. s3lync focuses on developer experience.
- You open a file → it syncs
- You write to a file → it uploads
- You don't think about S3 until you need to
Features
🚀 Pythonic API • 🔄 Auto Sync • ✅ Hash Verification • 💾 Smart Caching • ⚡ Parallel Transfers • 🔁 Auto Retry
Installation
pip install s3lync
# With async support
pip install s3lync[async]
Quick Start
from s3lync import S3Object
obj = S3Object("s3://my-bucket/path/to/file.txt")
# Context manager (recommended) - auto sync on read/write
with obj.open("w") as f:
f.write("Hello, S3!")
with obj.open("r") as f:
print(f.read())
# Or manual control
obj.download()
obj.upload()
Async
from s3lync import AsyncS3Object
async def main():
obj = AsyncS3Object("s3://my-bucket/file.txt")
await obj.download()
await obj.upload()
With boto3 Client
import boto3
from s3lync import S3Object
session = boto3.Session(profile_name="dev")
obj = S3Object("s3://bucket/key", boto3_client=session.client("s3"))
S3 URI Formats
s3://bucket/key
s3://endpoint@bucket/key
s3://secret:access@endpoint/bucket/key
Directory Sync
obj = S3Object("s3://bucket/path/to/dir")
obj.download() # Download entire directory
obj.upload() # Upload entire directory
# Mirror mode: delete files not in source
obj.download(mirror=True)
obj.upload(mirror=True)
Exclude Patterns
# Default excludes: hidden files, __pycache__, .egg-info
obj = S3Object("s3://bucket/path", excludes=[r".*\.tmp$"])
# Or add to defaults at method call
obj.upload(excludes=[r"node_modules/.*"])
Configuration
Environment Variables
| Variable | Description |
|---|---|
S3LYNC_MAX_WORKERS |
Max concurrent transfers (default: 8) |
AWS_PROFILE |
AWS profile name |
Progress Modes
obj = S3Object("s3://bucket/key", progress_mode="compact")
# "progress" (default), "compact", "disabled"
Logging
from s3lync import configure_logging
import logging
configure_logging(level=logging.DEBUG)
License
MIT License — see LICENSE
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file s3lync-0.4.2.tar.gz.
File metadata
- Download URL: s3lync-0.4.2.tar.gz
- Upload date:
- Size: 33.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3176cc134b7fce7d64aab41d52cac4f7e4adc417e2e1ed3d33662f185918d023
|
|
| MD5 |
125c5e8bc3bfdd0411b82ba3256377eb
|
|
| BLAKE2b-256 |
e326123223bc70588c430a1dfb9156217dadcc67e4fe6022f5e4d5b038272ed2
|
File details
Details for the file s3lync-0.4.2-py3-none-any.whl.
File metadata
- Download URL: s3lync-0.4.2-py3-none-any.whl
- Upload date:
- Size: 29.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a8ceb9579e50c1f1f25d2126a137f9947a6d418b5b73e71bbafbf1101f7fe6b
|
|
| MD5 |
d845b24fc0808e31d452b3127d33ab37
|
|
| BLAKE2b-256 |
0775aeea057f66cd7d4ab9987609bcf51cec7b57c69fc513215232f2257b8336
|