s3local
Cache the object in s3 to localhost.
Create a cache corresponding to s3 and automatically create a path for localhost and return it.
Once downloaded files remain in localhost as cache, the second migration download will be skipped
works on python3.6 or higher
Settings
aws auth support following.
- environment variables
- profile(use --aws-profile option.)
- instance profile
Examples
download object and list object
$ s3local download -u s3://mybucket/artifacts/ --debug
2021-05-14 11:27:13,367 DEBUG - Copying: s3://mybucket/artifacts/main.log > /Users/hiroshi.toyama/.s3local/s3/mybucket/artifacts/main.log
2021-05-14 11:27:13,367 DEBUG - Copying: s3://mybucket/artifacts/main2.log > /Users/hiroshi.toyama/.s3local/s3/mybucket/artifacts/main2.log
2021-05-14 11:27:13,367 DEBUG - Copying: s3://mybucket/artifacts/main3.log > /Users/hiroshi.toyama/.s3local/s3/mybucket/artifacts/main3.log
# next download is skip
$ s3local download -u s3://mybucket/artifacts/ --debug
2021-05-14 14:08:02,970 DEBUG - skip already exists in local: s3://mybucket/artifacts/main.log
2021-05-14 14:08:02,970 DEBUG - skip already exists in local: s3://mybucket/artifacts/main2.log
2021-05-14 14:08:02,970 DEBUG - skip already exists in local: s3://mybucket/artifacts/main3.log
# overwrite download. (not skip)
$ s3local download -u s3://mybucket/artifacts/ --debug --no-skip-exist
2021-05-14 11:27:13,367 DEBUG - Copying: s3://mybucket/artifacts/main.log > /Users/hiroshi.toyama/.s3local/s3/mybucket/artifacts/main.log
2021-05-14 11:27:13,367 DEBUG - Copying: s3://mybucket/artifacts/main2.log > /Users/hiroshi.toyama/.s3local/s3/mybucket/artifacts/main2.log
2021-05-14 11:27:13,367 DEBUG - Copying: s3://mybucket/artifacts/main3.log > /Users/hiroshi.toyama/.s3local/s3/mybucket/artifacts/main3.log
By default $HOME/.s3local is the root directory.
The format of path in local is as follows:
$HOME/.s3local/s3/${bucket}/${key}
You can change root by setting an environment variable S3LOCAL_ROOT.
$ s3local list-local -u s3://mybucket/artifacts/
/Users/hiroshi.toyama/.s3local/s3/mybucket/artifacts/main.log
/Users/hiroshi.toyama/.s3local/s3/mybucket/artifacts/main2.log
/Users/hiroshi.toyama/.s3local/s3/mybucket/artifacts/main3.log
upload object
$ s3local upload -s tox.ini -u s3://mybucket/test/
2023-05-31 10:44:08,474 INFO - Copying to s3: tox.ini => s3://mybucket/test/tox.ini
Python API
download
from s3local import Downloader
s3local = Downloader("s3://mybucket/artifacts/")
list = s3local.list_local_path(download=True)
print(list)
#=> [
# "/Users/hiroshi.toyama/.s3local/s3/mybucket/artifacts/main.log",
# "/Users/hiroshi.toyama/.s3local/s3/mybucket/artifacts/main2.log",
# "/Users/hiroshi.toyama/.s3local/s3/mybucket/artifacts/main3.log",
# ]
upload
from s3local import Uploader
s3local = Uploader("s3://mybucket/artifacts/")
uploader.upload("output/hoge.txt")
#=> s3://mybucket/artifacts/hoge.txt
uploader.upload("output")
#=> s3://mybucket/artifacts/output/hoge.txt
Installation
pip install s3local
CI
install test package
$ ./scripts/ci.sh install
test
$ ./scripts/ci.sh run-test
flake8 and black and pytest.
release pypi
$ ./scripts/ci.sh release
git tag and pypi release.
Metadata
Release files for s3local 0.4.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 | |
|---|---|---|---|---|
| s3local-0.4.2.tar.gz | 7.4 kB | Without provenance | Details |
Release files / s3local-0.4.2.tar.gz
| Download URL | s3local-0.4.2.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
162ccc329e575023aba33a8dadadbca73a154c6c872dfcd19c69ef42a0b4e6f7
|
|
BLAKE2b-256 checksum How to use checksums |
c6f93aad74633ee19f7b1433e5fc63924729a447dbce133d0b68d169f8daba0b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.8
|
Security for s3local 0.4.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.