Skip to main content

Molot

GitHub Actions PyPI License: MIT Ruff uv

Simple execution orchestrator.

Requirements

Molot requires Python 3.8 or above.

For development, you will need uv installed.

Usage

Create a new orchestration file, e.g. build.py for a build orchestration. Make it executable chmod +x build.py to make it easier to run.

#!/usr/bin/env python3
from molot import *

# Your targets and environment arguments here

evaluate()

Now you're ready to run the build script to see the help message:

./build.py

To only see a list of targets and environment arguments, call the built-in list target:

./build.py list

Not very exciting so far, let's learn how to add your own targets and environment arguments.

Targets

Any piece of work that your build needs to perform is defined as a target. Here's a trivial example of a target that executes ls.

@target(
    name="ls",
    description="lists current directory items",
    group="greetings",
    depends=["target1", "target2"]
)
def ls():
    shell("ls")

Parameters explained:

  • name - unique name to reference the target (optional; function name is used by default)
  • description - short description of what the target does displayed in the help message (optional)
  • group - grouping to list target under (optional; listed under "ungrouped" by default)
  • depends - list of other targets that must be executed first (optional)

Since all the parameters are optional, the shortest definition of the same target can be as follows:

@target()
def ls():
    shell("ls")

Here's how you run your new target:

./build.py ls

Dependency Resolution

Now we can define another target hello that depends on ls:

@target(description="say hello", depends=["ls"])
def hello():
    print("hello")

There is basic dependency resolution that checks for circular dependencies and finds all transitive dependency targets to execute before running the one that you called. When you call:

./build.py hello

What actually happens is equivalent to calling:

./build.py ls hello

Environment Arguments

Environment arguments ar a cross between environment variables and arguments. Values can be passed as the former and then overriden as the latter.

Here's how you define one:

ENV = envarg("ENV", default="dev", description="build environment")

Parameters explained:

  • name - unique name for the argument
  • default - default value if none is supplied (optional; None by default)
  • description - short description of what the argument is displayed in the help message (optional)
  • sensitive - indicates the value is sensitive and should be masked (optional)

The argument is evaluated right there (not inside of targets), so you can use that variable straightaway.

It can be set as a regular environment variable:

ENV=dev ./build.py sometarget

Alternatively, it can be passed as an argument:

./build.py sometarget --arg ENV=prod

Finally, you can pass .env file to load:

./build.py sometarget --dotenv /path/to/.env

If both are passed simultaneously, then argument takes precedence over the environment variable.

Examples

See examples for use cases that demonstrate the main features.

Metadata

Release files for molot 1.0.3

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

Source distribution (sdist)

Source distribution for molot 1.0.3
File Size Uploaded Provenance
molot-1.0.3.tar.gz 46.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for molot 1.0.3
File Interpreter ABI Platform
molot-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 57.0 kB

Release files / molot-1.0.3.tar.gz

Download URL molot-1.0.3.tar.gz
Size 46.9 kB
Tags Source
SHA-256 checksum
How to use checksums
29286c5f6cb5c7ae3bfdcc5a7de4e8b443b2cd0ea474fbf30e0dd3d8e4099be4
BLAKE2b-256 checksum
How to use checksums
3e09092d30c756fdc1efdbfb755b9991d5ca924213b2f689f462fd2885bc7536
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.5

Release files / molot-1.0.3-py3-none-any.whl

Download URL molot-1.0.3-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e8ef88916272f153aebadc297fc323a3ea21d3ed8a6ea43cf4ab246a1e259c5
BLAKE2b-256 checksum
How to use checksums
cd7408a14484568449cba0312cce34eba63d77abed201b260272e5a29caed81c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.5

Security for molot 1.0.3

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files No provenance

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