Use app artifacts#

Goal#

Pass a model file, dataset, or other file that ships with an app — for example, DeepSite’s trained model — as an argument to that app.

Minimal example#

from playmolecule.apps import deepsite

print(deepsite.artifacts)         # show what's bundled with this app

deepsite(
    outdir="out",
    pdbid="3ptb",
    model=deepsite.artifacts.default,
).run()

deepsite.artifacts.default is a file handle bundled with the app. You pass it where the app expects a file path; PlayMolecule resolves it to the right location in the container.

How artifacts work#

App manifests can declare a list of artifacts (sometimes called datasets — they’re synonymous). PlayMolecule attaches them to the app module as attributes named after each artifact:

deepsite.artifacts                       # container of bundled file handles
deepsite.artifacts.default               # one specific artifact
deepsite.artifacts.default.path          # path inside the container
deepsite.artifacts.default.description

Each artifact is also addressable for a specific version: deepsite.v1.artifacts.<NAME>.

Download an artifact to disk#

If you want to keep an app artifact outside its container:

local_path = deepsite.artifacts.default.download("./models/deepsite-default.ckpt")

Whether this copies from a local install, extracts from a Docker / Apptainer image, or downloads from an HTTP backend depends on which registry the app came from — the call is the same in all cases.

Gotchas#

  • Artifact names must start with a letter and contain no dots. The loader skips invalid names silently — if deepsite.artifacts.X doesn’t exist, check the spelling in the app manifest.

  • The handle is not a string path. Don’t str(...) it before passing it in; PlayMolecule does the resolution itself based on the active execution backend.

  • A pinned-version artifact (deepsite.v1.artifacts.X) may not exist in deepsite.v2.artifacts — artifacts are versioned together with the app.

See also#