LogoLogo
HomeGitHub RepoBook Demo
version-3.1.13
version-3.1.13
  • Introduction
  • Installation
  • Quickstart
  • Walkthrough
    • Editing a Package
    • Uploading a Package
    • Installing a Package
    • Getting Data from a Package
    • Working with the Catalog
    • Working with a Bucket
  • Advanced Usage
    • Filtering a Package
    • .quiltignore
    • Materialization
    • Working with Manifests
    • S3 Select
  • API Reference
    • quilt3
    • quilt3.Package
    • quilt3.Bucket
    • quilt3 CLI
  • References
    • Frequently Asked Questions
    • Technical Reference
    • Contributing
    • Further Reading
Powered by GitBook
On this page

Was this helpful?

  1. Advanced Usage

Filtering a Package

quilt3 provides a handful of functions for operating on the contents of a package in an entry-by-entry manner. These are helpful for performing more complicated parsing operations on the package:

import quilt3

# create a package
p = (quilt3.Package()
        .set_dir("foo/", "foo/")
        .set("bar", "bar"))

# element-wise transform entries, outputting a list
# here "lk" is shorthand for "logical_key"
# and "entry" is the package entry
p.map(lambda lk, entry: entry)

# filter out entries not meeting certain criteria
p.filter(lambda lk, entry: 'cool' not in lk)

Notice that these functions operate over (logical_key, entry) tuples. Each logical_key is a string. Each entry is PackageEntry object, as would be returned if you slice to a leaf node of the package (e.g. p['bar']).

PreviousWorking with a BucketNext.quiltignore

Last updated 5 years ago

Was this helpful?