Skip to main content

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 with either:

pipsi install ferret
# or
pip install --user ferret
  • 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 Distribution

ferret-0.4.2.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

ferret-0.4.2-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file ferret-0.4.2.tar.gz.

File metadata

  • Download URL: ferret-0.4.2.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ferret-0.4.2.tar.gz
Algorithm Hash digest
SHA256 7b5b52d9dbead9600b3ae598d215790a32ecff10091f29d65651b9bc65d0bbb8
MD5 765aff240ffec1cc9182de51ed04d901
BLAKE2b-256 5617b5626d0f9426046211e248bd731235225938cf7fa35d58850f5c58c1f267

See more details on using hashes here.

Provenance

File details

Details for the file ferret-0.4.2-py3-none-any.whl.

File metadata

File hashes

Hashes for ferret-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e5f81c356f6f6e474ecf0ca15d0d07ce3ba8f57939e491477d5793ffd61dca48
MD5 f0b3a8c0855007daa8eb483c2aac1cf2
BLAKE2b-256 356e558e979a915a89afb108f0846dd30d8ffb40e77d3f77143ea16e2163669e

See more details on using hashes here.

Provenance

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