open (mode='rb', ensure_dir=None)

This opens the artifact for reading or writing. The default behavior is that if the artifact is opened for reading, the directory it's contained within automatically is created. This can be disabled or enabled with the ensure_dir parameter.

If the artifact is opened for writing, a copy will be created and only committed when the entire build process goes through smoothly and the changes are committed by the builder.


ctx = get_ctx()
def build_stylesheet(artifact):
    with'w') as f:
        f.write('Hello World!\n')