Skip to main content

Downloads, Installs in paralell - A utility to run multiple shell command sequences (e.g., installations) in parallel with status updates.

Project description

Bolt the Builder Bot - RapidInstall Mascot

rapidinstall

PyPI version License: GPL v3

A simple Python utility to run multiple shell command sequences (e.g., complex installations, downloads, build steps) in parallel, providing status updates and aggregated output directly to the console.

Features

  • Parallel Execution: Runs multiple tasks concurrently using subprocess.
  • Real-time Output: Captures stdout and stderr from tasks.
  • Status Updates: Periodically shows which tasks are still running and recent output.
  • Clear Formatting: Presents startup, status, and completion information in distinct blocks.
  • Simple API: Easy to integrate into existing Python scripts.
  • Pure Python: Relies only on the standard library with optionally requiring pySmartDL if you use the aria2-like download manager.

Installation

pip install rapidinstall pySmartDL # pySmartDL is optional

Examples

Example: first look

import rapidinstall

my_tasks = [
    {'name': 'Pip Update', 'commands': 'pip install --upgrade pip'},
    {'name': 'Download Example', 'download': "echo 'Simulating download...'; sleep 30; echo 'Download complete!'"}, # using pySmartDL, similar to aria2
    {'name': 'Run Setup', 'commands': "echo 'Running setup...'; sleep 20; echo 'Setup finished.'"}
]

rapidinstall.install(my_tasks)

Runs the 3 tasks in paralell and updates you on the progress and result.

Example: Git installs

import rapidinstall

clone_and_install = '''clone https://github.com/tomOfBerlin/rapidinstall
cd rapidinstall
python setup.py demo-install
cd ..'''

my_tasks = [
    {'name': 'Pip Update', 'commands': 'pip install --upgrade pip'},
    {'name': 'Download Example', 'commands': "echo 'Simulating download...'; sleep 30; echo 'Download complete!'"},
    {'name': 'Run Setup', 'commands': clone_and_install}
]

rapidinstall.install(my_tasks)

Example: Some Parameters

# Completely silent - verbose is turned on by default
rapidinstall.install(my_tasks, verbose=False)

# Shows Updates every 60 seconds
rapidinstall.install(my_tasks, update_interval=60)

# No Updates
results = rapidinstall.install(my_tasks, update_interval=0)

# Show results your way
rc = result.get('returncode')
duration = result.get('duration_sec')
status = "Success" if rc == 0 else f"Failed (RC={rc})"
duration_str = f"{duration:.2f} sec" if duration is not None else "N/A"
print(f"Task '{name}': {status} (Duration: {duration_str})")
print(f"Full Stdout:\n{result['stdout']}") # full "console" output
print(f"Full Stderr:\n{result['stderr']}") # full error output

RapidInstaller Class

Example

The class interface provides more flexibility, especially if tasks are generated dynamically. Tasks start immediately when added.

from rapidinstall import RapidInstaller

installer = RapidInstaller(verbose=True, update_interval=10)

# Start the downloads even before basic setup.
installer.add_download(name='HF model1', url='https://example.com/model1.zip')
installer.add_download(name='HF model2', url='https://example.com/model1.zip')
installer.add_download(name='HF model3', url='https://example.com/model1.zip')

# Basic Setup, e.g. connect to gdrive on colab
#
#
#

# Rest of the install that for example requires a drive connection
# Note: Please test if paralell pip installs work together or have conflicts.
clone_and_install = '''clone https://github.com/tomOfBerlin/rapidinstall
cd rapidinstall
python setup.py demo-install
pip install -r requirements.txt
cd ..'''

setup_tasks = [
    {'name': 'Pip installs', 'commands': 'pip install a b c'},
    {'name': 'Setup Demo', 'commands': clone_and_install}
]

installer.add_tasks(setup_tasks)

# Some more setup that creates new directories
#
#
#

installer.add_download(name='extra model 123', url='https://example.com/model1.zip', directory='new_directory/models')

# Wait for everything to finish
installer.wait()

This example demonstrates adding tasks incrementally. The wait() call ensures the script doesn't exit until all tasks and downloads have completed execution.

Error Handling

  • rapidinstall (both the function and the class) runs all initiated tasks to completion, regardless of individual task failures (non-zero exit codes).
  • Failure information (non-zero returncode, stderr output) is captured for each task and included in the final results dictionary returned by install() or wait().
  • If verbose=True, the console output during execution and in the final summary will typically highlight failed tasks with their return code and stderr.
  • Programmatically check the returncode key in the results dictionary for each task to determine success or failure. A returncode of 0 indicates success.

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.◊

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

rapidinstall-1.2.0.tar.gz (34.0 kB view details)

Uploaded Source

Built Distribution

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

rapidinstall-1.2.0-py3-none-any.whl (31.1 kB view details)

Uploaded Python 3

File details

Details for the file rapidinstall-1.2.0.tar.gz.

File metadata

  • Download URL: rapidinstall-1.2.0.tar.gz
  • Upload date:
  • Size: 34.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.15

File hashes

Hashes for rapidinstall-1.2.0.tar.gz
Algorithm Hash digest
SHA256 8341a0f92ca9a8c8e351fd8a22793b18c4d0059d36ff650f8f27603c4de35577
MD5 e35fcf383241ab4e5d6ab478d673c3a0
BLAKE2b-256 5c009c933f41c5054356d770e97ad394da7cb2111f28d50c3aa47f5cbdb56c1c

See more details on using hashes here.

File details

Details for the file rapidinstall-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: rapidinstall-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 31.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.15

File hashes

Hashes for rapidinstall-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 42d01f194c02391bfec3c3895509bc0d35d0ad9edad2bd0092eafa103f76307b
MD5 5726b1ceea589e53586364de9c0e799a
BLAKE2b-256 b7a357ea6bebb8c73e66536d548223d5197bafe6f86c259d7ab6af44d5cace95

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