Skip to content

ms_env

ms_env gives a MolSuite app the external tools it needs: it finds one that already works, or installs it, on this machine or on a host reached over ssh. It is the lowest layer of MolSuite and uses the standard library only.

A recipe says how to tell that a tool works and how to install it. A host says where. ms_env applies one to the other.

Install

pip install ms_env

The package requires Python 3.12 or newer. A host is a POSIX machine; only Linux is supported.

First use

from ms_env import READY, Host, ToolSpec, ensure, locate

spec = ToolSpec.load("openbabel.toml")

recipe = spec.recipe("/home/me/.myapp/tools")      # bound to this machine
state, executable = locate(recipe)                  # (READY, ".../bin/obabel") or (MISSING, "")
if state != READY:
    install = ensure(recipe)                        # returns at once: a daemon thread installs
    install.future.result()                         # wait; `install.lines` is the live log

cluster = Host("me@login.hpc")                    # as `ssh` knows it
ensure(spec.recipe("/home/me/.myapp/tools"), cluster).future.result()

Where next

  • The guide explains recipes, whose an environment is, hosts and the environment of an app.
  • The API reference lists every public name.