Skip to main content

Simple bootstrapping of python scripts

Project description

This is an early prototype of a simple bootstrapping system for python. By importing scriptstrap into a python script, a virtual environment (“venv”) will be automatically created, dependencies installed (using pip) and the script will finally be re-launched inside the venv. This simplifies distribution of small utility scripts, as package dependencies are automatically manged by just running the script.

The intended use case for scriptstrap is single-file utility scripts only!

Features

  • Automatic creation of virtual environment for each script

  • Dependencies are installed and imported automatically

  • Simplified script distribution

  • No additional dependencies other than python and virtualenv

Requirements

  • Python 2.7 or later

  • virtualenv

Getting started

You must do a global install of scriptstrap or run it from another venv. Recommended installation is:

$ pip install scriptstrap

Example

Simple script that downloads the Google main page and prints it:

import scriptstrap

scriptstrap.python3('requests')

print(requests.get('http://google.com').content)

Running the script, assuming the script is called requests.py, will create a new venv in a directory called requests.venv3 next to the script. If the script is launched again, the same venv will be re-used.

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

scriptstrap-0.0.1.tar.gz (4.8 kB view details)

Uploaded Source

File details

Details for the file scriptstrap-0.0.1.tar.gz.

File metadata

  • Download URL: scriptstrap-0.0.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for scriptstrap-0.0.1.tar.gz
Algorithm Hash digest
SHA256 b7dc6c90658063f7557e833e2c60bc0abbef5e634db286b2285173b8b9265c5c
MD5 2586e029b613a41a6e645032326e7bcd
BLAKE2b-256 3d03f8faf49a82c854c8a9fbeb81b43395bb86e15148ced36aa1e7d7d1cb319b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page