All Projects → markosamuli → ansible-pyenv

markosamuli / ansible-pyenv

Licence: MIT license
Ansible role to install pyenv on Ubuntu or macOS development machines

Programming Languages

shell
77523 projects
python
139335 projects - #7 most used programming language
Makefile
30231 projects
Jinja
831 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to ansible-pyenv

pyenv-pyright
Setup a pyenv virtualenv for microsoft pyright in the pyrightconfig.json config file
Stars: ✭ 51 (+10.87%)
Mutual labels:  pyenv, pyenv-virtualenv
Devilutionx
Diablo build for modern operating systems
Stars: ✭ 5,015 (+10802.17%)
Mutual labels:  homebrew, debian
Wslu
A collection of utilities for Windows 10 Linux Subsystems
Stars: ✭ 2,020 (+4291.3%)
Mutual labels:  debian, pengwin
AwsTerm
A collection of awesome terminal utilities
Stars: ✭ 37 (-19.57%)
Mutual labels:  homebrew, debian
anon-hotspot
On demand Debian Linux (Tor) Hotspot setup tool
Stars: ✭ 34 (-26.09%)
Mutual labels:  debian
wp-in-a-box
WordPress in a (LEMP) box (Debian & Ubuntu)!
Stars: ✭ 53 (+15.22%)
Mutual labels:  debian
RC24-Bot
Server bot for the RiiConnect24 Discord server that can store Wii friend codes to be added. | https://discord.gg/b4Y7jfD
Stars: ✭ 37 (-19.57%)
Mutual labels:  homebrew
Autodesk-Fusion-360-for-Linux
This is a project, where I give you a way to use Autodesk Fusion 360 on Linux!
Stars: ✭ 810 (+1660.87%)
Mutual labels:  debian
piu
Cross platform package manager wrapper
Stars: ✭ 33 (-28.26%)
Mutual labels:  debian
LinuxMirrors
Linux 一键更换国内软件源
Stars: ✭ 623 (+1254.35%)
Mutual labels:  debian
Brewfile.vim
Brewfile syntax for Vim
Stars: ✭ 14 (-69.57%)
Mutual labels:  homebrew
realtek-r8125-dkms
A DKMS package for easy use of Realtek r8125 driver, which supports 2.5 GbE.
Stars: ✭ 142 (+208.7%)
Mutual labels:  debian
rombundler
A tiny libretro frontend to release homebrews as executables
Stars: ✭ 49 (+6.52%)
Mutual labels:  homebrew
my blog
在 Issues 中建立的个人博客
Stars: ✭ 28 (-39.13%)
Mutual labels:  debian
Linux-Active-Directory-join-script
Active directory Join script for Ubuntu, Debian, CentOS, Linux Mint, Fedora, Kali, Elementary OS and Raspbian with built in failchcheck and debugmode for Ubuntu. "The most advanced and updated AD join script on GITHUB for Linux"
Stars: ✭ 97 (+110.87%)
Mutual labels:  debian
wakemeops
A Debian repository for portable applications
Stars: ✭ 54 (+17.39%)
Mutual labels:  debian
awesome-sysadmin-tools
Collection of links and resources for sysadmins and Drupal lovers
Stars: ✭ 17 (-63.04%)
Mutual labels:  debian
dotfiles
🗿 dotfilery, configuration, environment settings, automation, etc. 🛖
Stars: ✭ 67 (+45.65%)
Mutual labels:  homebrew
grml-debootstrap
wrapper around debootstrap
Stars: ✭ 53 (+15.22%)
Mutual labels:  debian
ibrew
🍻Interactive CLI for Homebrew – the missing package manager for macOS.
Stars: ✭ 33 (-28.26%)
Mutual labels:  homebrew

markosamuli.pyenv

Ansible Quality Score Ansible Role GitHub release License

Branch Pipeline
master master

Ansible role to install pyenv and pyenv-virtualenv on Ubuntu or macOS development machines.

Optionally, pyenv-virtualenvwrapper can be installed and used for managing environments.

Don't use this role on production servers as it supports installing pyenv only under user home directory.

Install from Homebrew on macOS

The default method to install pyenv and plugins on macOS is to use Homebrew.

The role doesn't know how to migrate from existing Homebrew installs to Git-based installations, so it will try to detect any existing installation and keep using the previous method.

If you want to migrate, backup and delete your existing ~/.pyenv directory before running this role.

Install from Homebrew on Linux

The role includes an experimental support for installing pyenv and plugins with Homebrew on Linux.

The role doesn't install Homebrew on Linux itself and expects it to be installed in the default /home/linuxbrew/.linuxbrew location.

Installing Python versions with pyenv on Linux when Homebrew installation exists has some known issues:

  • readline extension was not compiled, installed pyenv by Linuxbrew on Ubuntu 16 #1479

Installed Python versions

This role installs Python versions defined in pyenv_python_versions variable.

To set global version, set pyenv_global variable to the desired version(s).

pyenv_global: "{{ pyenv_python37_version }} system"

This is configured to use latest Python 2 and Python 3 versions and the system version as default.

Changes to shell config files

This role creates config file in ~/.pyenv/.pyenvrc that is loaded in .bashrc and .zshrc files.

Code completion is loaded by default.

If you're managing your shell scripts .dotfiles or are using a framework, you should set pyenv_init_shell to false and update these files yourself to keep them clean.

Reference .bashrc configuration:

if [ -e "$HOME/.pyenv/.pyenvrc" ]; then
  source $HOME/.pyenv/.pyenvrc
  if [ -e "$HOME/.pyenv/completions/pyenv.bash" ]; then
    source $HOME/.pyenv/completions/pyenv.bash
  elif [ -e "/usr/local/opt/pyenv/completions/pyenv.bash" ]; then
    source /usr/local/opt/pyenv/completions/pyenv.bash
  fi
fi

Reference .zshrc configuration:

if [ -e "$HOME/.pyenv/.pyenvrc" ]; then
  source $HOME/.pyenv/.pyenvrc
  if [ -e "$HOME/.pyenv/completions/pyenv.zsh" ]; then
    source $HOME/.pyenv/completions/pyenv.zsh
  elif [ -e "/usr/local/opt/pyenv/completions/pyenv.zsh" ]; then
    source /usr/local/opt/pyenv/completions/pyenv.zsh
  fi
fi

Role Variables

Path to ~/.pyenv is based on environment variables:

pyenv_home: "{{ ansible_env.HOME }}"
pyenv_root: "{{ ansible_env.HOME }}/.pyenv"

Update .bashrc and .zshrc files in user home directory:

pyenv_init_shell: true

Versions to install:

pyenv_version: "v1.2.13"
pyenv_virtualenv_version: "v1.1.5"
pyenv_virtualenvwrapper_version: "v20140609"

Latest Python 3.7 and Python 3.8 versions:

pyenv_python37_version: "3.7.6"
pyenv_python38_version: "3.8.1"

Python 2 and Python 3 versions are installed by default:

pyenv_python_versions:
  - "{{ pyenv_python37_version }}"
  - "{{ pyenv_python38_version }}"

Set global version to Python 3.7 with system fallback:

pyenv_global: "{{ pyenv_python37_version }} system"

Install virtualenvwrapper plugin:

pyenv_virtualenvwrapper: false
pyenv_virtualenvwrapper_home: "{{ ansible_env.HOME }}/.virtualenvs"

Install using Homebrew package manager on macOS:

pyenv_install_from_package_manager: true

Detect existing installation method and use that:

pyenv_detect_existing_install: true

Install using Homebrew on Linux:

pyenv_homebrew_on_linux: true

Example Playbook

- hosts: localhost
  connection: local
  become: false
  roles:
    - role: markosamuli.pyenv

Updating versions

Run the following scripts to get latest releases from GitHub and update them in role defaults.

Update pyenv release:

./update-release pyenv

Update pyenv-virtualenv release:

./update-release pyenv-virtualenv

Update default Python 3.7 version:

./update-python python37

Update default Python 3.8 version:

./update-python python38

Update all versions:

make update

Coding style

Install pre-commit hooks and validate coding style:

make lint

Run tests

Run tests in Ubuntu and Debian using Docker:

make test

Acknowledgements

Use of .pyenvrc file and parts used for installing python version taken from avanov.pyenv role.

Development

Install development dependencies in a local virtualenv:

make setup

Install pre-commit hooks:

make install-git-hooks

Changes

License

Author Information

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].