Skip to main content

Simple bootstraping of python scripts

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.

Metadata

Release files for scriptstrap 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scriptstrap 0.0.1
File Size Uploaded
scriptstrap-0.0.1.tar.gz 4.8 kB Details

Release files / scriptstrap-0.0.1.tar.gz

Download URL scriptstrap-0.0.1.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b7dc6c90658063f7557e833e2c60bc0abbef5e634db286b2285173b8b9265c5c
BLAKE2b-256 checksum
How to use checksums
3d03f8faf49a82c854c8a9fbeb81b43395bb86e15148ced36aa1e7d7d1cb319b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file

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