Skip to main content

PyRunner

PyPI version License: MIT

A lightweight, cross-platform script runner inspired by npm scripts. Store reusable commands in scripts.json files and execute them by name from anywhere.

PyRunner supports both local and global script collections with automatic priority handling.


Installation

pip install pyrunner-cli

Once installed, the pyr command will be available everywhere in your terminal:

pyr --help
pyr list
pyr build

From Source

git clone https://github.com/AbdullahAhmad-0/PyRunner.git
cd PyRunner
pip install -e .

Or run directly without installing:

  • Windows: Use pyr.bat <script>
  • Linux/macOS: Use ./pyr <script>

Manual PATH Setup (Without pip)

Windows (Using Batch File)

PyRunner includes a pyr.bat file so you can use pyr directly:

  1. Place pyr.bat and runner.py in the same directory.
  2. Add that directory to your system's PATH environment variable.
  3. Open a new terminal.

Now you can run PyRunner from any location:

pyr build
pyr list

Linux / macOS (Using Shell Script)

PyRunner includes a pyr shell script:

  1. Make the script executable:
    chmod +x pyr
    
  2. Move it to a directory in your PATH (such as /usr/local/bin on Linux/Intel Macs or /opt/homebrew/bin on Apple Silicon Macs):
    sudo mv pyr /usr/local/bin/
    

    Note: Ensure runner.py remains in the same directory as the pyr script if not installed via pip.


Features

  • 🚀 Run scripts by name (pyr <name>)
  • 📁 Local and global script collections
  • 🔍 Automatic script lookup
  • ⭐ Local scripts take priority over global scripts
  • 📋 List available local and global scripts (pyr list)
  • 📄 Use a custom scripts.json file
  • 💻 Cross-platform (Windows, Linux, macOS)
  • ⚡ No external dependencies

Script Locations

PyRunner supports three sources of scripts.

Local Scripts

Located in the current working directory.

project/
│
├── scripts.json
└── ...

These scripts are intended for a single project.


Global Scripts

Stored in ~/.pyrunner/scripts.json (or next to the PyRunner executable in scripts/scripts.json).

~/.pyrunner/
└── scripts.json

These scripts are available from every directory.


Custom Script File

You may specify any scripts.json file:

pyr --file D:/Configs/scripts.json build

Configuration

Example scripts.json:

{
    "scripts": {
        "start": "python app.py",
        "build": "python build.py",
        "clean": "python clean.py",
        "test": "pytest"
    }
}

Running Scripts

Automatic Mode (Default)

pyr build

Search order:

  1. Local scripts.json
  2. Global scripts/scripts.json (or ~/.pyrunner/scripts.json)

If a script exists in both locations, the local script is executed.

If one of the configuration files doesn't exist, it is simply ignored.


Local Only

pyr --local build

or

pyr -l build

Only the local scripts.json is searched.

Global scripts are ignored.


Global Only

pyr --global build

or

pyr -g build

Only the global scripts are searched.

Local scripts are ignored.


Custom Configuration

pyr --file ./configs/scripts.json build

Only the specified configuration file is used.


Listing Scripts

Display every available script:

pyr list

Example:

Local Scripts
-------------
build      python build.py
clean      python clean.py
start      python app.py

Global Scripts
--------------
git-clean  git clean -fd
update     winget upgrade --all
serve      python -m http.server

Missing configuration files are skipped automatically.


List Local Scripts

pyr list --local

List Global Scripts

pyr list --global

List Custom File

pyr list --file ./configs/scripts.json

Priority Rules

Default behavior:

Local Script
    ↓
Global Script

Example:

Local:

{
    "scripts": {
        "build": "python build.py"
    }
}

Global:

{
    "scripts": {
        "build": "docker compose build"
    }
}

Running:

pyr build

executes:

python build.py

because local scripts always have higher priority.


Help

pyr --help

Displays every available command and option.


Future Features

  • init — Create a new scripts.json
  • add — Add a script from the command line
  • remove — Remove a script
  • edit — Open the configuration in your editor
  • doctor — Validate configuration files
  • aliases
  • Environment variables
  • Sequential execution
  • Parallel execution
  • Colored output
  • Shell auto-completion
  • YAML and TOML support

Contributing

Issues and pull requests are welcome! Feel free to visit the GitHub repository: https://github.com/AbdullahAhmad-0/PyRunner


License

MIT License. See LICENSE for details.

Metadata

Release files for pyrunner-cli 0.1.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 pyrunner-cli 0.1.0
File Size Uploaded Provenance Actions
pyrunner_cli-0.1.0.tar.gz 8.1 kB Without provenance Details for pyrunner_cli-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyrunner-cli 0.1.0
File Interpreter ABI Platform Actions
pyrunner_cli-0.1.0-py3-none-any.whl Python 3 none any Details for pyrunner_cli-0.1.0-py3-none-any.whl

Total release size: 15.5 kB

Release files / pyrunner_cli-0.1.0.tar.gz

Download URL pyrunner_cli-0.1.0.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2ecbdeaccbac5adc196cb5a228f266cfa9002ef16ccd693cde3cb7c51e187dcd
BLAKE2b-256 checksum
How to use checksums
79d46042593010b81001da05ae7cbcb40d608e702d104d31ed2a8252770723bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Release files / pyrunner_cli-0.1.0-py3-none-any.whl

Download URL pyrunner_cli-0.1.0-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1ee914ce6a06f63572e04af68d5e798fc186de06600f7dfac13fa263c23d4b6c
BLAKE2b-256 checksum
How to use checksums
50ea30ebcc51d9bf3be49421c68d62fcc3a7f66b3843ba8d8fe4c2b6b36f94d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Security for pyrunner-cli 0.1.0

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

0.1.0 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