Skip to main content

Pyallel

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

demo

Tested on Linux and MacOS only

Installation

Pre-built executables are available on the Releases page.

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

pipx install pyallel

Quick start

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

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

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

RUNNING COMMANDS
================
to run multiple commands you must separate them using the command separator symbol (::)

  pyallel mypy . :: black .

if you want to provide options to a command you need to use the double dash symbol (--) to indicate that
any options provided after this symbol should not be interpreted by pyallel

  pyallel -n -- mypy -V :: black --version

commands can also be grouped using the group separator symbol (:::)

  pyallel echo boil kettle :: sleep 1 ::: echo make coffee

the above will print 'boil kettle' and sleep for 1 second first before printing 'make coffee'.
command groups are ran in the sequence you provide them, and if a command within a command group fails,
the rest of the command groups in the sequence are not run

modifiers can also be set for commands to augment their behaviour using the command modifier symbol (::::)

lines (only used in interactive mode):
  the lines modifier allows you to specify how many lines the command output can take up on the screen

    pyallel lines=90 :::: echo running long command... :: echo running other command...

  90 is expressed as a percentage value, which must be between 1 and 100 inclusive

SHELL SYNTAX
============
each command is executed inside its own shell, this means shell syntax is supported.
it is important to note that certain shell syntax must be escaped using backslashes (\)
or wrapped in single quotes (''), otherwise it will be evaluated in your current
shell immediately instead of the shell that your command will run within.

some examples of using shell syntax are below (single quotes are used only if required)

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

positional arguments:
  commands              list of commands and their arguments to run in parallel

options:
  -h, --help            show this help message and exit
  -t, --no-timer        don't time how long each command is taking
  -s, --no-summary      don't output a summary at the end
  -n, --non-interactive
                        run in non-interactive mode
  -V, --version         print version and exit
  --colour {yes,no,auto}
                        colour terminal output, defaults to "auto"
  --debug               enable debug mode, which logs debug info to a "pyallel.log" file in the current directory

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

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

[!NOTE] To build aarch64 binaries on an x86_64 host machine, you will need to run the following commands to setup qemu to allow this to work

sudo apt-get install qemu binfmt-support qemu-user-static && \
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes

Build for generic linux

docker build --tag pyallel --build-arg 'arch=x86_64' --build-arg "uid=$(id -u)" . && \
    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' --build-arg "uid=$(id -u)" --file Dockerfile.alpine . && \
    docker run -e 'arch=x86_64' --rm --volume "$(pwd):/src" pyallel-alpine

Build locally

pipx install uv && \
  uv sync && \
  source .venv/bin/activate && \
  ./build.sh

Build all

./build_all.sh

TODOs

  • Add support to have commands depend on other commands (some commands must complete before a given command can start)
  • Add support to state how many lines a command can use for it's output in interactive mode
  • Improve printing of output performance by only printing lines that have changed
  • Add a debug mode that logs debug information to a log file
  • 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

Download files

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

Source Distribution

pyallel-2.2.1.tar.gz (54.9 kB view details)

Uploaded Source

Built Distribution

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

pyallel-2.2.1-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyallel-2.2.1.tar.gz
  • Upload date:
  • Size: 54.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.15

File hashes

Hashes for pyallel-2.2.1.tar.gz
Algorithm Hash digest
SHA256 119fb3199805c7ceb69b32aed3e6a33e3c8df6b16e708a30a9b9285caff4368f
MD5 19e307314ed721024360a1a17c8aef5e
BLAKE2b-256 e5950622895c76aa8f30b19306a8eb0bc4de0350bbf95234c975238fd7abe854

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyallel-2.2.1-py3-none-any.whl
  • Upload date:
  • Size: 19.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.15

File hashes

Hashes for pyallel-2.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 389c7d11f8be29b2a80e1a2a494249306410eaae544314b3fb1401a4ae77906d
MD5 5642417b04acb4e2fb9fe5287043feec
BLAKE2b-256 08fb8a4b76a0168d780bb41cba93acf3e7d223487732dd9b8ea65bcb4afb6cbf

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.2.1 This release

2 files

2.2.0

2 files

2.1.1

2 files

2.1.0

2 files

2.0.6

2 files

2.0.5

2 files

2.0.4

2 files

2.0.3

2 files

2.0.2

2 files

2.0.1

2 files

2.0.0

2 files

1.3.8

2 files

1.3.7

2 files

1.3.6

2 files

1.3.5

2 files

1.3.4

2 files

1.3.3

2 files

1.3.2

2 files

1.3.1

2 files

1.3.0

2 files

1.2.8

2 files

1.2.7

2 files

1.2.6

2 files

1.2.5

2 files

1.2.4

2 files

1.2.3

2 files

1.2.2

2 files

1.2.1

2 files

1.2.0

2 files

1.1.0

2 files

1.0.1

2 files

1.0.0

2 files

0.18.5

2 files

0.18.4

2 files

0.18.3

2 files

0.18.2

2 files

0.18.1

2 files

0.18.0

2 files

0.17.1

2 files

0.17.0

2 files

0.16.0

2 files

0.15.0

2 files

0.14.0

2 files

0.13.0

2 files

0.12.2

2 files

0.12.1

2 files

0.12.0

2 files

0.11.0

2 files

0.10.1

2 files

0.10.0

2 files

0.9.1

2 files

0.9.0

2 files

0.8.0

2 files

0.7.0

2 files

0.6.0

2 files

0.5.1

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

0.3.4

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

2 files

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