Giter Club home page Giter Club logo

ferret's Introduction

ferret

A snake that can run

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.

ferret's People

Contributors

jelford avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.