Getting Data from a Package

The examples in this section use the aleksey/hurdat demo package:

# import quilt3
# p = quilt3.Package.browse('aleksey/hurdat', 's3://quilt-example')
(remote Package)
 └─.gitignore
 └─.quiltignore
 └─notebooks/
   └─QuickStart.ipynb
 └─quilt_summarize.json
 └─requirements.txt
 └─scripts/
   └─build.py

Slicing through a package

Use dict key selection to slice into a package tree:

p["requirements.txt"]
# returns PackageEntry("requirements.txt")

p["notebooks"]
# returns:
# (remote Package)
# └─QuickStart.ipynb

Slicing into a Package directory returns another Package rooted at that subdirectory. Slicing into a package entry returns an individual PackageEntry.

Downloading package data to disk

To download a subset of files from a package directory to a dest, use fetch:

fetch will default to downloading the files to the current directory, but you can also specify an alternative path:

Downloading package data into memory

Alternatively, you can download data directly into memory:

To apply a custom deserializer to your data, pass the function as a parameter to the function. For example, to load a hypothetical yaml file using yaml.safe_load:

The deserializer should accept a byte stream as input.

Getting entry locations

You can get the path to a package entry or directory using get:

Getting metadata

Metadata is available using the meta property.

Last updated

Was this helpful?