Define requirements inside your python code and scriptenv makes them ready to import.
Install scriptenv
$ pip install scriptenvuse any package you want in your REPL or short-lived scripts
import scriptenv
scriptenv.requires('rsa==4.8')
import rsa
assert rsa.__version__ == "4.8"
rsa.newkeys(32)use a binary/entry point defined in any package
$ scriptenv run -r black==21.5b2 -- black --version
black, version 21.5b2The goal of this project is to provide a way to define your dependencies in your script you want to run and requires no extra setup steps for a virtual env.
The scope is for small scripts you want to share or you only want to run from time to time.
For sharing scripts it is also not necessary anymore to also share a requirements.txt file.
It works also within your REPL.
scriptenv installs every dependency it ever sees in a seperate folder
and prepends the folders for the defined dependencies in a script to sys.path.
Open in gitpod.io
Get the code
$ git clone https://github.com/stefanhoelzl/scriptenv.git
$ cd scriptenvOptionally create a venv
$ python -m venv venv
$ source venv/bin/activateInstall required python packages
$ pip install -r requirements.txtInstall scriptenv from repository
$ pip install -e .Run tests and file checks
$ pytestTrigger a new release build
$ python tools/release.py release-candidateUpdate all requirements
$ python tools/requirements.py update