Skip to content

Instantly share code, notes, and snippets.

@yyuu
Created August 30, 2012 10:29
Show Gist options
  • Select an option

  • Save yyuu/3525829 to your computer and use it in GitHub Desktop.

Select an option

Save yyuu/3525829 to your computer and use it in GitHub Desktop.
idea notes of pyenv

idea notes of pyenv

overview

I want nicer version manager like rbenv for python.

  • do things almost like rbenv.
  • implemented as pure shell scripts (bash and zsh).
  • have all pythons in $PATH to use them from tox easily.

Of course, I know there are tools for python.

I am using pythonz currently, but I think there are some problems.

  • they are depending on python.
    • there is bootstrap problem.
    • and also there are python's 2to3 problems.
  • not manages user's $PATH. (pythonz)
  • cannot manage multiple pythons at a time.

I'd like to write scripts and let it be an alternative to them. The notes following are an idea note of new scripts (called pyenv).

usage idea

show installed pythons.

% pyenv versions
CPython-2.5.6
CPython-2.6.8
CPython-2.7.3
CPython-3.2.3

execute command in pyenv.

% pyenv exec python --version
Python 2.7.3

show global stack of pythons.

% pyenv global
CPython-2.7.3
CPython-2.6.8
CPython-3.2.3
% pyenv which python2.7
/home/yyuu/.pyenv/versions/CPython-2.7.3/bin/python2.7
% pyenv which python2.6
/home/yyuu/.pyenv/versions/CPython-2.6.8/bin/python2.6
% pyenv which python
/home/yyuu/.pyenv/versions/CPython-2.7.3/bin/python

show local stack of pythons.

% pyenv local
CPython-2.5.6
CPython-2.6.8
CPython-2.7.3

modify global stack.

% rm -f ~/.pyenv-version
% echo -e "CPython-2.6.8\nCPython-2.7.3" > ~/.pyenv-version
% pyenv exec python --version
Python 2.6.8

install new python.

% pyenv global
CPython-2.7.3
CPython-2.6.8
CPython-3.2.3
% pyenv pypy-1.9
(... snip ...)
% pyenv global
PyPy-1.9
CPython-2.7.3
CPython-2.6.8
CPython-3.2.3

run tox with pythons. since pyenv has all pythons on $PATH, we can easily find all of them from tox.

% tox
@yyuu
Copy link
Copy Markdown
Author

yyuu commented Aug 31, 2012

created new project.

https://github.com/yyuu/pyenv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment