Skip to main content

ms_env

Environments for MolSuite apps: find an external tool that already works, or install it, on this machine or on a host reached over ssh. 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.

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()

A recipe

One TOML file per tool, shipped by the app:

[tool]
name = "openbabel"
label = "OpenBabel"
version = "3.1.1"                         # pinned here; never a user option
prefix = "{tools_home}/{name}/{version}"  # the default

[locate]
paths = ["{prefix}/bin/obabel"]           # where the install puts it
commands = ["obabel"]                     # looked up on PATH
check = ["{exe}", "-V"]                   # {exe} = the candidate

[env]                                     # a conda prefix at {prefix}
conda = ["openbabel={version}"]
pip = []

[[install]]                               # plain steps, after [env]
name = "download the model"
argv = ["curl", "-fsSL", "-o", "{prefix}/model.pt", "https://..."]
timeout = 1800

Lookup on a host, first candidate whose check exits 0 wins: the paths the user registered, the managed install under tools_home, then PATH. [env] is created with micromamba: the one on the host's PATH, or one downloaded into tools_home. Another conda-type program is used only when the app names it (manager=).

Whose an environment is

ensure stamps the prefix it installs. The stamp decides what may happen to it:

At the prefix ensure remove
Nothing Creates it Nothing to delete
A stamp of this recipe Nothing Deletes it
A stamp of another recipe (the TOML changed) Creates it again: the update Deletes it
Something without a stamp: the user's own environment Verifies it, never changes it Leaves it
from ms_env import remove, verify

mine = spec.recipe("/home/me/.myapp/tools", prefix="/home/me/envs/babel")   # an environment I already have
verify(mine)    # [] when it meets the recipe, else what it lacks:
                # ["conda: openbabel=3.1.1 is asked for and is not there"]
remove(recipe)  # True: ms_env had installed it and it is gone

verify looks up every pinned conda package, every pinned pip package and the recipe's check, and only reads. An executable registered on its own (extra_paths=) is not an environment: it only has to pass the check.

ensure(recipe, host, busy=why) asks why() before it changes an install of its own: a reason ("2 jobs are running from it") makes the install fail and leaves the prefix as it is.

A host

Host() is this machine. Host("me@login.hpc") runs every command through the system's ssh with BatchMode=yes: users, keys and jumps come from ~/.ssh/config, the key logs in or the command fails at once, no credential is handled and nothing is left listening on the other side. A host is a POSIX machine; only Linux is supported.

The environment of an app

app_recipe makes the recipe that gives a host the environment an app runs in here: the same Python, the same versions, and the code of a source checkout as it is now.

from ms_env import app_recipe

home = cluster.home()
recipe = app_recipe("myapp", ["myapp"], ["myapp"], prefix=f"{home}/.myapp/env",
                    tools_home=f"{home}/.myapp/tools", cache="/home/me/.myapp/cache/wheels")
ensure(recipe, cluster).future.result()

Install

pip install ms_env

Documentation: https://molsuite.github.io/ms_env/

Metadata

Release files for ms-env 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ms-env 0.2.0
File Size Uploaded
ms_env-0.2.0.tar.gz 26.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ms-env 0.2.0
File Interpreter ABI Platform
ms_env-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 44.2 kB

Release files / ms_env-0.2.0.tar.gz

Download URL ms_env-0.2.0.tar.gz
Size 26.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f91de70814c44fcbbf1ed587fc66285674031e81fcaf5113196db0e6bbc809a5
BLAKE2b-256 checksum
How to use checksums
9aba2888b8e4410213edb574fb76391a53156a2808ca9596685942fd37a4f947
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.

Transparency log

Release files / ms_env-0.2.0-py3-none-any.whl

Download URL ms_env-0.2.0-py3-none-any.whl
Size 17.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aaee6cb6306621d73b3bec56ce2719fded59fd1fae7e8f46d2d2d5cfe48a4f9f
BLAKE2b-256 checksum
How to use checksums
d79310dcb3db04be4e6f8c4b75895c0805c4e6f81fa42c42794f6c3aad525299
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page