atmos.version
The atmos.version function runs atmos version through the current Atmos executable. Use it to read the
running Atmos version, list and inspect releases, install or uninstall Atmos versions, and manage version tracks
from automation.
Usage
atmos.version(
*positionals,
flags = {},
args = [],
working_directory = ...,
env = ...,
output = "stream",
check = True,
)
Subcommands
Pass the subcommand and any positional arguments as strings before the keyword arguments. The bare call
atmos.version() runs atmos version, which shows the running version. The call atmos.version("show", "v1.194.0")
runs atmos version show v1.194.0.
| Subcommand | Purpose |
|---|---|
list | List Atmos releases. |
show | Show details for a specific Atmos release. |
install | Install a specific version of Atmos. |
uninstall | Uninstall a specific version of Atmos. |
track | Manage tracked external versions with the Atmos Version Tracker. Also available as tracks. |
The track subcommand has its own subcommands, such as status,
lock, update,
apply, verify,
diff, list,
show, get,
add, set, and
remove. Pass them after "track", as in
atmos.version("track", "verify").
See the atmos version command reference for the complete list of subcommands and
flags.
Arguments
*positionals(Optional) Strings placed on the command line right after
version, in order: the subcommand and its positional arguments, such as a release version forshoworinstall. Every value must be a string.flags(Optional) A dictionary of command-line options; see flag translation. A bare key such as
"format"becomes--format, and registered shorthands such as"c"resolve to--check. Common keys are"format"and"check"for the bare command, and"limit","offset","since","include-prereleases", and"installed"forlist.args- (Optional) A list or tuple of strings appended after the flags.
working_directory,env,output,check(Optional) See
atmos.runfor process options and defaults.
Options other than the positionals are keyword-only.
Returns
A result with stdout, stderr, and exit_code. See atmos.run for output and error behavior.
Examples
Read the running version as data
result = atmos.version(flags = {"format": "json"}, output = "capture")
info = json.decode(result.stdout)
ui.info("Running Atmos " + info["version"] + " on " + info["os"] + "/" + info["arch"])
List recent releases
releases = atmos.version("list", flags = {"limit": 5, "format": "json"}, output = "capture")
print(json.decode(releases.stdout))
This runs atmos version list --limit=5 --format=json.
Verify version tracks in a pipeline
result = atmos.version("track", "verify", output = "capture", check = False)
if result.exit_code != 0:
fail("Version tracks are not locked, current, and applied:\n" + result.stderr)
Install a specific Atmos version
atmos.version("install", "1.194.0")
Notes
The list and show subcommands, and the "check" key in flags, contact GitHub, so they need network access.
The "check" key becomes the --check flag of atmos version and is separate from the check keyword argument,
which controls whether a nonzero exit code raises an error.
Related
atmos.runruns any Atmos command from an argument list.atmos versiondocuments every subcommand and flag.- Atmos Automation Language and the script step