Edit on GitHub

declare

Declares a new MLEM Object metafile from config args and config files.

Synopsis

usage: mlem declare [options] object_type [subtype] path

arguments:
OBJECT_TYPE  Type of metafile to declare  [required]
[SUBTYPE]    Subtype of MLEM object  [default: ]
PATH         Where to save object  [required]

Description

.mlem metafiles can be created for MLEM Objects using this command. This is particularly useful for configuring environments and deployments.

Each MLEM Object, along with its subtype (which represents a particular implementation), will accept different configuration arguments. The list of configuration arguments per type can be fetched by running the mlem types command. For an example output, check out the last example here

Options

  • -c, --conf TEXT: Values for object fields in format field.nested.name=value
  • -p, --project TEXT: Path to MLEM project [default: (none)]
  • -e, --external: Save result not in .mlem, but directly in project
  • --index / --no-index: Whether to index output in .mlem directory
  • -h, --help: Show this message and exit.

Examples

Declare an environment object metafile with a config key:

# Fetch all available config args for a heroku env
$ mlem types env heroku
[not required] api_key: str = None

# Declare the heroku env
$ mlem declare env heroku production --conf api_key="mlem_heroku_staging"
💾 Saving env to .mlem/env/staging.mlem

# Print the contents of the new heroku env metafile
$ cat .mlem/env/staging.mlem
api_key: mlem_heroku_staging
object_type: env
type: heroku
Content

🐛 Found an issue? Let us know! Or fix it:

Edit on GitHub

Have a question? Join our chat, we will help you:

Discord Chat