Skip to main content

Run and handle the output of multiple executables in pyallel (as in parallel)

Project description

Pyallel

Run and handle the output of multiple executables in pyallel (as in parallel)

https://github.com/Danthewaann/pyallel/assets/22531177/8685eb92-aac5-440a-9170-30fd1460c53f

Tested on Linux and MacOS only

Installation

Pre-built executables are available on the Releases page.

pyallel can also be installed using pip (requires Python >=3.8):

pip install pyallel

Quick start

Once installed, you can run pyallel to see usage information, like so:

usage: pyallel [-h] [-t] [-n] [-V] [--colour {yes,no,auto}] [commands ...]

Run and handle the output of multiple executables in pyallel (as in parallel)

positional arguments:
  commands              list of quoted commands to run e.g "mypy ." "black ."

                        each command is executed inside a shell, so shell syntax is supported as
                        if you were running the command directly in a shell, some examples are below:

                             "MYPY_FORCE_COLOR=1 mypy ."          <- provide environment variables
                             "mypy | tee -a mypy.log"             <- use pipes to redirect output
                             "cat > test.log < other.log"         <- use input and output redirection
                             "mypy .; pytest ."                   <- run commands one at a time in sequence
                             "echo \$SHELL" or "\$(echo mypy .)"  <- expand variables and commands to evaluate (must be escaped)
                             "pytest . && mypy . || echo failed!" <- use AND (&&) and OR (||) to run commands conditionally


options:
  -h, --help            show this help message and exit
  -t, --no-timer        don't time how long each command is taking
  -n, --non-interactive
                        run in non-interactive mode
  -V, --version         print version and exit
  --colour {yes,no,auto}
                        colour terminal output, defaults to "auto"

Currently you can provide a variable number of commands to run to pyallel, like so:

[!IMPORTANT] If you need to provide arguments to a command, you must surround the command and it's arguments in quotes!

pyallel "MYPY_FORCE_COLOR=1 mypy ." \
        "black --check --diff ." \
        "pytest ."

Build

You can also build an executable with the following (executables will be written to ./dist):

[!NOTE] The arch=x86_64 values in the following code blocks can be replaced with arch=aarch64 and any other architecture that is supported by docker to build an executable for that given architecture

Build for generic linux

docker build --tag pyallel --build-arg 'arch=x86_64' . && docker run -e 'arch=x86_64' --rm --volume "$(pwd):/src" pyallel

Build for alpine linux

docker build --tag pyallel-alpine --build-arg 'arch=x86_64' --file Dockerfile.alpine . && docker run -e 'arch=x86_64' --rm --volume "$(pwd):/src" pyallel-alpine

Build locally

python -m venv .venv && source .venv/bin/activate && pip install . -r requirements_build.txt && ./build.sh

TODOs

  • Maybe add support to allow the user to provide stdin for commands that request it (such as a REPL)
  • Add custom parsing of command output to support filtering for errors (like vim's errorformat)
  • Allow list of files to be provided to supply as input arguments to each command
  • Allow input to be piped into pyallel via stdin to supply as standard input to each command

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

pyallel-1.1.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

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

pyallel-1.1.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file pyallel-1.1.0.tar.gz.

File metadata

  • Download URL: pyallel-1.1.0.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for pyallel-1.1.0.tar.gz
Algorithm Hash digest
SHA256 143d7bee7ca8682f763952cd3ff87e80b93962a6c66b88d37b7bca39ccb51311
MD5 6e45a317966ccd1571a1617ac3ca3ead
BLAKE2b-256 28ecc9cc0d93267edac944a07c6e4038661293392ba08770dcae0cda628ccf51

See more details on using hashes here.

File details

Details for the file pyallel-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyallel-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for pyallel-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a520d147c76b04b3b71a9ffd12b3512aac37bda45789b39304520e57d884d9d
MD5 47f030ecfe900665c92721506c853c18
BLAKE2b-256 81edd17efb31ecc1f3790e1a51de66defc0493f310f1154cf7a4fbd7e45c02f4

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