MAHKRAB CLI tool
Project description
mahkrab
mahkrab is a lightweight CLI that installs as mk.
It is a cross-language source runner and compile-and-run helper for small files and small projects.
Why
mk gives you one command shape for many languages:
mk <file>to run/interpret or compile a source file by extensionmk runto run the configured entry from.mkconfig.tomlor.mkconfig
The goal is reducing friction when switching between languages.
Installation
Install from PyPI:
pip install mahkrab
Or with pipx (isolated CLI install):
pipx install mahkrab
1) Run a file directly
mk hello.py
mk main.c -r
mk src/app.js
-r/--run-on-compile matters for compiled languages.
For interpreted files, it has no practical effect.
2) Use a config entry
Create .mkconfig.toml in your project:
entry = "src/main.c"
build_dir = "build"
run_on_compile = true
Then run:
mk run
You can also point to a specific config file:
mk run --config /path/to/.mkconfig.toml
Usage
Basic forms:
mk <file>
mk run
Useful options:
--config <file>: use a specific config file--cwd <dir>: run as if started from a different directory-o, --output <file>: output path/name for compiled targets--build-dir <dir>: build output directory (default:build)--python <python>: override Python interpreter for.py--program-args ...: extra compiler/interpreter args-r, --run-on-compile: compile then run (compiled languages)-c, --clear: clear terminal before action-v, --version: show version-h, --help: show help
Example commands:
mk main.cpp --build-dir out -o out/main -r
mk script.py --python python3
mk run --cwd ./examples
mk app.go --program-args "-trimpath" -r
Config (.mkconfig.toml / .mkconfig)
mk run reads TOML config and resolves an entry file.
Auto-discovery checks current directory and parent directories for:
.mkconfig/.mkconfig.toml.mkconfig.toml.mkconfig
Supported keys currently used by runtime:
entry = "src/main.py"
cwd = "."
build_dir = "build"
output = "build/main"
python = "python3"
python_cmd = "python3"
run_on_compile = true
clear = false
program_args = ["-O2"]
[env]
MY_VAR = "value"
Notes:
entryis required formk run.- Relative paths in config are resolved from the config location.
mk runcurrently forces compile-and-run behavior (run_on_compile = trueat runtime)..mkconfigis also parsed as TOML.langandtoolvalues can be parsed from config/CLI, but are not currently applied by executors.
Tool detection and external dependencies
mk calls external compilers/interpreters. They are not bundled.
If a required tool is missing, execution fails with a runtime error for that tool.
By default, command names come from PATH (for example gcc, node, javac).
You can override tool paths/commands with environment variables, for example:
export MAHKRAB_GCC=/usr/bin/gcc-14
export MAHKRAB_PYTHON=/usr/bin/python3.12
export MAHKRAB_JAVA=/usr/lib/jvm/default/bin/java
Common overrides include:
MAHKRAB_GCC,MAHKRAB_GPP,MAHKRAB_RUSTC,MAHKRAB_GOMAHKRAB_JAVAC,MAHKRAB_JAVAMAHKRAB_PYTHON,MAHKRAB_NODE,MAHKRAB_TSMAHKRAB_SQLITE3,MAHKRAB_NASM- plus other
MAHKRAB_*tool variables defined insrc/mahkrab/constants.py
Supported language note
Language support is extension-driven and depends on your installed toolchain.
Current extension handlers include:
-
Interpreted:
.py,.js,.ts,.rb,.php,.lua,.sh,.ps1,.pl,.r,.m,.pro,.prolog,.plg,.dart,.sql,.sb3
-
Compiled via dedicated executors:
.c,.cpp,.cc,.cxx,.rs,.go,.java,.asm
-
Compiled via command mapping:
.cs,.vb,.pas,.f,.for,.f77,.f90,.f95,.f03,.f08,.adb,.ada,.swift,.kt,.bas,.cob,.cbl
There is also a binary run path for targets with no extension (or .exe).
Current limitations
- Focus is convenience for small projects and standalone files, not full project orchestration.
- Behavior depends on external tools being installed and available.
- Assembly flow is currently Unix-like only (
.asmis not supported on Windows in current code). - C/C++ dependency flags are limited, no current auto-discovery system
Development
From this repository:
python3 -m venv .venv
. .venv/bin/activate
python -m pip install -U pip
python -m pip install -e .
mk -h
Contributing
Issues and pull requests are welcome.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mahkrab-0.1.0.tar.gz.
File metadata
- Download URL: mahkrab-0.1.0.tar.gz
- Upload date:
- Size: 20.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db0493419e232061d68df44d7044ce1df224a257a9fcb3f1c06af6fe1f253277
|
|
| MD5 |
7d85cacf27ea959c9efa2ece0bf9959f
|
|
| BLAKE2b-256 |
3e7d4cea42f0fcf6d6683ef8c8c57dbe2b56d7f877967b523bac5ceee09df42c
|
File details
Details for the file mahkrab-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mahkrab-0.1.0-py3-none-any.whl
- Upload date:
- Size: 27.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a798a7ccf3e4de7cd54163a76a4c9928bace8da0d761b3a289c736511df5e970
|
|
| MD5 |
6b1250ca3cf44fb6b7a95ff6ba43d54e
|
|
| BLAKE2b-256 |
23de448053bbebb93cc11143e6d37df4c42bc3d2dda12db51f2efa56895439c2
|