Description:
- A pathlib-compatible Zipfile object wrapper
Resources:
Environment variables
Section titled “Environment variables”This notebook reads its settings from environment variables. Set them before starting Jupyter:
S3_BUCKET: name of an S3 bucket you can access
The cells read ganymede-demo/example.zip from that bucket; upload any zip archive there first.
from fsspec import filesystemfrom zipp import Pathfrom zipfile import ZipFileimport os
from fsspec import filesystem
# Get the remote archive object and download locallylibarchive_fs = filesystem("libarchive", fo=f"s3://{os.environ['S3_BUCKET']}/ganymede-demo/example.zip")libarchive_fs.ls("", detail=False)libarchive_fs.info("")import os
s3 = filesystem("s3")
tmp = "/tmp/ganymede_demo"os.makedirs(tmp, exist_ok=True)
local_fp = f"{tmp}/example.zip"s3.get(rpath=f"s3://{os.environ['S3_BUCKET']}/ganymede-demo/example.zip", lpath=local_fp)from zipp import Path
p = Path(local_fp)p.stemganymede is made by Eugo