LogoLogo
HomeGitHub RepoBook Demo
version-3.4.x
version-3.4.x
  • Introduction
  • Installation
  • Quick start
  • Mental model
  • 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
    • Workflows
    • Enterprise install
    • S3 Events, EventBridge
  • API Reference
    • quilt3
    • quilt3.Package
    • quilt3.Bucket
    • CLI, environment
  • More
    • Frequently Asked Questions
    • Troubleshooting
    • Contributing
    • Changelog
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 3 years ago

Was this helpful?