Skip to main content

A tool that helps organize and simplify helper commands using YAML configuration

Project description

Makim

CI Python Versions Package Version License Discord

Makim is inspired by tools like Make and Ansible, focusing on improving task definition and dependency management. Instead of using the Makefile format, it utilizes YAML for defining tasks.


Features

  • Help Text as First-Class: Add detailed help text to tasks and arguments for clear documentation.
  • Task Arguments: Define and manage arguments with types, defaults, and descriptions.
  • Dependencies with Conditional Control: Set task dependencies with if conditionals to manage execution dynamically.
  • Environment Variables: Scope variables globally, by group, or by task to reduce redundancy and maintain modularity.
  • Jinja2 Templating: Access arguments, variables, or environment variables via Jinja2 templates.
  • Matrix Configuration: Automate tasks across multiple parameter combinations (ideal for CI/CD workflows).
  • Hooks: Use pre-run and post-run hooks to customize task lifecycles.
  • Scheduler: Cron-like scheduling with APScheduler integration for periodic tasks.
  • Remote Execution: Execute tasks on remote servers via SSH with flexible configurations.
  • File Logging: Log outputs to files with custom formatting and stream control.
  • Retry Mechanism: Adds resilience by retrying tasks that encounter errors.
  • Validation: Ensures .makim.yaml configurations are correct with schema validation.

How to use it

First you need to place the config file .makim.yaml in the root of your project. This is an example of a configuration file:

groups:
  build:
    env:
      GROUP_ENV: group_value
    tasks:
      clean:
        help: Clean build artifacts
        args:
          cache:
            type: bool
            action: store_true
            help: Remove all cache files
        log:
          path: ./logs/clean.txt
          level: err
          format: "%(asctime)s - %(file)s - %(levelname)s - %(message)s"
        run: |
          echo "Cleaning build directory..."
          rm -rf build/
      compile:
        help: Compile the project
        hooks:
          pre-run:
            - task: build.clean # Run 'clean' before 'compile'
        run: |
          echo "Compiling the project..."

# Scheduler for automated tasks
scheduler:
  daily-clean:
    task: build.clean
    schedule: "0 0 * * *" # Every day at midnight

Some examples of how to use it:

  • run the compile task: makim build.compile

  • run the clean task with argument: makim build.clean --cache

The help menu for the .makim.yaml file would looks like this:

$ makim --help

 Usage: makim [OPTIONS] COMMAND [ARGS]...

 Makim is a tool that helps you to organize and simplify your helper commands.

╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --version             -v            Show the version and exit                │
│ --file                        TEXT  Makim config file [default: .makim.yaml] │
│ --dry-run                           Execute the command in dry mode          │
│ --verbose                           Execute the command in verbose mode      │
│ --skip-hooks                        Skip hooks while executing the command   │
│ --install-completion                Install completion for the current       │
│                                     shell.                                   │
│ --show-completion                   Show completion for the current shell,   │
│                                     to copy it or customize the              │
│                                     installation.                            │
│ --help                              Show this message and exit.              │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ build ──────────────────────────────────────────────────────────────────────╮
│ build.clean                         Clean build artifacts                    │
│ build.compile                       Compile the project                      │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Extensions ─────────────────────────────────────────────────────────────────╮
│ cron                                Tasks Scheduler                          │
╰──────────────────────────────────────────────────────────────────────────────╯

 If you have any problem, open an issue at: https://github.com/osl-incubator/makim

As you can see, the help menu automatically adds information defined by all the help key, inside the .makim.yaml file.

Playground

Experience makim directly in your browser using Google Colab! Google Colab is an online platform that allows you to write, run, and share Python code through your browser. It is especially useful for machine learning, data analysis, and education.

To try makim, simply click the following link, make a copy of the notebook to your drive, and then you can modify and execute the code as needed:

Experiment with makim on Google Colab

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

saisanjay_test-1.1.2.tar.gz (26.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

saisanjay_test-1.1.2-py3-none-any.whl (28.5 kB view details)

Uploaded Python 3

File details

Details for the file saisanjay_test-1.1.2.tar.gz.

File metadata

  • Download URL: saisanjay_test-1.1.2.tar.gz
  • Upload date:
  • Size: 26.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.13 Linux/6.11.0-1015-azure

File hashes

Hashes for saisanjay_test-1.1.2.tar.gz
Algorithm Hash digest
SHA256 567524b81e1886cad29d6a5ec0612175b82cd9f5dd1c9db156b87638d4b4dc30
MD5 ec621f0e34f0526aa5b9368c6f79112c
BLAKE2b-256 cccf585a3f191246a3d31d0e46e5dace57945692b089dbe5b4c4a9753c5d4da5

See more details on using hashes here.

File details

Details for the file saisanjay_test-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: saisanjay_test-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 28.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.13 Linux/6.11.0-1015-azure

File hashes

Hashes for saisanjay_test-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5068d1830b69e4b86ea851bae0548a37a3a4e5baa78b56d7fc5aa63352facbae
MD5 bf882a2e2bb81f541cf4ff76c247fbb1
BLAKE2b-256 afa3c80c3b3bacf5ee0db6d7bfb8f4841525b41f25e7e5022283baa5fa86c2a5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page