a snake that runs. execute python files without packaging or installation
Project description
python, but with running.
ferret provides a new shebang line for your python script that will install dependencies into a fresh venv - saving you the hassle of packaging and distribution. ferret lets you focus on writing just the code you need without sacrificing libraries.
usage
Install ferret on the target environment:
pip install ferret # Warning: this will work with a python3 venv, but not a virtualenv (as used by pipsi)
Replace your shebang line with this:
#! /usr/bin/env ferret
Declare your dependencies in your module’s docstring:
"""
A helpful description about your module
ferret:
- requests == 2.18.4
"""
When you run a script with ferret, it parses the file for dependency declarations, and prepares a venv to match. The environments are kept under ~/.local/ferret/venvs (you can safely delete the entire contents of that folder).
example
Once you’ve installed ferret, take it for a spin:
cat > just_a_script.py << EOF
#! /usr/bin/env ferret
"""
Gets my IP from icanhazip.com
ferret:
- requests == 2.18.4
"""
import requests
response = requests.get('http://icanhazip.com')
response.raise_for_status()
print(response.text())
EOF
chmod +x just_a_script.py
./just_a_script.py
The first time you run the script, ferret will set up a venv and install requests in it. Subsequent runs will re-use that environment.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file ferret-0.6.0-py3-none-any.whl
.
File metadata
- Download URL: ferret-0.6.0-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.18.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86b5fe8141765bca9f789e6011987a1829dfe8cd9bd0bc6aa054668d9a8f6743 |
|
MD5 | b5a400e0d6217c7ed0e4df6ce89d0b3b |
|
BLAKE2b-256 | 2800a415c1c53b9c76e98a8dfe436498c883b6a09df29ae65e3dc20d888205f0 |