Code Monkey home page Code Monkey logo

ansible-role-python-virtualenv's Introduction

Build Status Ansible Role

Ansible role: python-virtualenv

  • Uses pyenv to install setup your python work environment.
  • pyenv support multiple paralel versions of python, the exact list of python versions installed by this role, as well how they are prioritized, is entirely customizable.
  • Finally, for each installed version of python, pipenv is installed to manage the virtual enviroments

Requirements

This role is only working on MacOSX & Ubuntu/Debian.

Post install: Shell configuration

Since pyenv is used to manage the different python versions, it needs to be activated in your shell.

Simply add these lines to the corresponding files:

  • ~/.zshrc / ~/.bashrc

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
  • ~/.zlogin / ~/.bash_profile

if command -v pyenv 1>/dev/null 2>&1; then
    eval "$(pyenv init -)"
fi

The reason we're splitting the initialisation between these two files is to ensure smooth operation with both pyenv and pipenv. That way, the pyenv activation is only done once per login shell and does not interfere with the sub-shell started with pipenv shell.
Learn more about it: Pyenv Issue #184 - Wrong Python inside of 'pipenv shell'

Role Variables

  • python_versions

    • List of python version to install
    • The order in which they are listed will be the order in why they will be prioritized via pyenv
      Learn more about it: Pyenv - Multiple Global versions
    • Required

Example Playbook

- hosts: sandbox
  tasks:
    - include_role:
        name: FlorianKempenich.python-virtualenv
      vars:
        python_versions:
          - 3.7.0
          - 2.7.15

License

MIT

Author Information

Follow me on Twitter: @ThisIsFlorianK
Find out more about my work: Florian Kempenich - Personal Website

ansible-role-python-virtualenv's People

Contributors

hellothisisflo avatar

Watchers

Adam J. Mendoza 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.