Home

Awesome

yen

The last Python environment manager you'll ever need.

Credits: xkcd.com/1987

We're finally putting an end to this XKCD.

So what can yen do?

Essentially, yen lets you replace various Python environment management tools such as pyenv, pipx and virtualenv, with a single static binary.

Running Python code on any machine has never been this easy.

Installation

Get yen by running the following command:

or if you prefer, get it via pip:

pip install yen

or pipx:

pipx run yen

Yeah, if you already have yen, you can do yen run yen and that works. But don't do that.

You can also grab the binary from GitHub releases.

Usage

$ yen list
Available Pythons:
3.12.3
3.11.9
3.10.14
3.9.19
3.8.19

$ yen create venv -p 3.12
Downloading 3.12.3 ━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 17.4/17.4 MB • 12.4 MB/s
Created venv with Python 3.12.3 ✨

$ yen install meowsay
Installed package meowsay with Python 3.12.3 ✨

$ meowsay hello!
 ________
< hello! >
 --------
        \      |\---/|
         \     | ,_, |
                \_`_/-..----.
             ___/ `   ' ,\"\"+ \  sk
            (__...'   __\    |`.___.';
              (_,...'(_,.`__)/'.....+

$ yen run --python 3.9 wttr
Weather report: Milano, Italy

     \  /       Partly cloudy
   _ /"".-.     20 °C
     \_(   ).   ↑ 4 km/h
     /(___(__)  10 km
                0.0 mm

$ wttr paris
Weather report: paris

      \   /     Sunny
       .-.      +22(25) °C
    ― (   ) ―   ↓ 7 km/h
       `-’      10 km
      /   \     0.0 mm

By default the Pythons will be downloaded in ~/.yen_pythons. You can change this location by setting the YEN_PYTHONS_PATH environment variable.

Local Development / Testing

To run Rust tests:

microvenv.py and userpath.pyz

These two files are used by yen and downloaded by the yen install script.

Type Checking

Run mypy .

Create and upload a package to PyPI

Make sure to bump the version in setup.cfg.

Then run the following commands:

pip install setuptools wheel twine
rm -rf build dist
python setup.py sdist bdist_wheel

Then upload it to PyPI using twine:

twine upload dist/*