Espadrille

Write short, simple scripts using the power of the entire Python ecosystem. Currently supports macOS.

Shell scripts are a pain to write, unless you've spent years mastering their arcane syntax and the myriad workarounds for the shell's everything-is-a-string philosophy. Writing a Python script and chucking it in your $PATH seems like a much more appealing option, but sometimes you want more than just Python's standard library. Installing the libraries you want in your global Python seems icky, but doing it properly and creating a virtualenv and packaging metadata files doesn't seem worth the effort.

Espadrille lets you write a single-file script that depends on external libraries, and takes care of installing them and keeping them isolated from the rest of your system for you.

Espadrille is named after a type of shoe, which is also an unconventional packaging method for Pythons.

⚠️ Espadrille is a very rough-around-the-edges proof of concept at the moment. It may eat your homework.

Installation

To install a pre-built binary (currently macOS Mojave only):

pip install espadrille

To install from source, assuming you have a Rust toolchain installed:

cargo install espadrille

In the future, pip will be able to install binaries for more platforms, and possibly build from source as well.

Usage

Write a Python script with a shebang line of #!/usr/bin/env espadrille <dependencies> --, like this:

```python

!/usr/bin/env espadrille requests --

import requests

requests.get('https://example.com') ```

Then, chmod +x that script, and run it.

FAQs