Skip to content

Latest commit

 

History

History
90 lines (63 loc) · 2.96 KB

README.md

File metadata and controls

90 lines (63 loc) · 2.96 KB

Build Status

Auto Pyvenv

forthebadge forthebadge

RELATED ARTICLE :: https://iamjohnnym.com/2018/11/15/managing-python-with-pyenv-and-direnv.html

This project is meant to ease the process of managing python for given projects. Leveraging pyenv, virtualenv, and direnv, users will automatically create and source a python virtualenv for their projects.

Table of contents

Usage

(Back to top)

Ensure you have both pyenv and direnv installed on your system.

Installation

(Back to top)

Navigate to the root dir of a python project and copy down this projects .envrc. Having the file in this dir will trigger direnv to prompt you to allow execution of that file.

$ wget https://raw.githubusercontent.com/iamjohnnym/auto-pyvenv/master/.envrc
direnv: error .envrc is blocked. Run `direnv allow` to approve its content.
$ direnv allow
direnv: loading .envrc
Installing virtualenv for Python 3.7.0
Activating Python 3.7.0 virtualenv
Virtualenv has been activated for Python 3.7.0
/Users/iamjohnnym/.personal/tutorials/pyenv-direnv/.venv/bin/python
direnv: export +VIRTUAL_ENV ~PATH

You can also specify what version of python you want to use with your project by creating a .python-version file.

$ pyenv local 3.6.1
$ cat .python-version
3.6.1
$ pyenv versions
  system
  2.7.15
  3.5.0
* 3.6.1 (set by /Users/iamjohnnym/.personal/auto-venv/.python-version)
  3.7.0

Uninstallation

(Back to top)

$ rm .envrc

Authors

(Back to top)

See also the list of contributors who participated in this project.

Contributing

(Back to top)

Your contributions are always welcome! Please have a look at the contribution guidelines first.

License

(Back to top)

Apache License, Version 2.0 2018 - Johnny Martin. Please have a look at the LICENSE.md for more details.

Versioning

(Back to top)

We use SemVer for versioning. For the versions available, see the tags on this repository.