Skip to main content

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.

Release files for ferret 0.8.0

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

Source distribution (sdist)

Source distribution for ferret 0.8.0
File Size Uploaded
ferret-0.8.0.tar.gz 3.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ferret 0.8.0
File Interpreter ABI Platform
ferret-0.8.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.8 kB

Release files / ferret-0.8.0.tar.gz

Download URL ferret-0.8.0.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c683645807290d355ff8e80fe686726d0e80df87c41de8c0d7a1bac19200a88b
BLAKE2b-256 checksum
How to use checksums
15914d60c00d838ad247ad2772fdae163e38b0b527ad57e5a89dfa8363ff41de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.18.4

Release files / ferret-0.8.0-py3-none-any.whl

Download URL ferret-0.8.0-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a916f1eb72fd53e247d252f734a513d81e5bfb1f2af2299d0401d4a6c0cb8b86
BLAKE2b-256 checksum
How to use checksums
379767296036e6af8578a2a4580648c854e750ea441071c2112f32f6184158f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.18.4

Release history Release notifications | RSS feed

This release

0.8.0 This release

2 release files

0.6.0

1 release file

0.5.0

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.1.0

2 release files

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