Distributing a Package

Once your package is ready it's time to save and distribute it.

Building a package locally

To save a package to your local disk use build.

import t4
p = t4.Package()
top_hash = p.build("username/packagename")

Building a package requires providing it with a name. Packages names must follow the $"{namespace}/${packagename}" format. For small teams, we recommend using the package author's name as the namespace.

Pushing a package to a remote registry

To share a package with others via a remote registry, push it:

import t4
p = t4.Package()
message="Updated version my package"

s3://your-bucket is the registry—the storage backend that the package is available from.

If you omit a registry entirely, the default remote registry will be used:

import t4
# this now 'just works'

The default remote registry, if set, persists between sessions.

Note that by default, the contents of the package will be written into the s3://your-bucket/username/packagename/ path. If you want the files to land someplace else, pass a more specific path:

# object will land in "/foo/bar/"
# instead of "/username/packagename/"

For even more fine-grained control of object landing paths see Materialization.

Distributing a package version

Once you build build or push a package, it has a top_hash:

import t4
p = t4.Package()

A top hash is a persistent, immutable reference to a specific version of a package. To ensure that you always download this specific version of this package in the future, provide its top hash.

Delete a package from a registry

To delete a package from a registry:

import t4
# delete a package in the local registry
# delete a package in a remote registry
t4.delete_package("username/packagename", "s3://your-bucket")

Only do this if you really need to as this will break the package for anyone relying on it.