Forge Home

python

python, pyenv and virtual env

8,143 downloads

4,284 latest version

5.0 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 0.2.3 (latest)
  • 0.2.2
  • 0.2.0
  • 0.1.4
  • 0.1.3
  • 0.1.2
  • 0.1.1
  • 0.1.0
released Jul 4th 2019
This version is compatible with:
  • Puppet Enterprise 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x, 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x, 2017.3.x
  • Puppet >= 5.0
  • , , ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'Siebjee-python', '0.2.3'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add Siebjee-python
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install Siebjee-python --version 0.2.3

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

Siebjee/python — version 0.2.3 Jul 4th 2019

Python

Table of contents

  1. Overview
  2. Module Description - What the module does and why it is useful
  3. Usage - Configuration options and additional functionality
  4. Reference - An under-the-hood peek at what the module is doing and how
  5. Limitations

Overview

This python module allows you to easely manage multiple python versions for a single user

Module Description

The python module provides a single module to manage pyenv, pip and virtualenv for a single user. And completely ignores the system installed python.

Usage

To install pyenv and configure pip automatically to your local pip mirror.

class {'python':
  python_versions => '1.2.3',
  pip_url        => 'https://url/to/pip',
}

To enable virtualenv for all versions installed you only have to specify virtualenv => true.

class {'python':
  versions => ['2.7.5','2.7.6']
  pip_url         => 'https://url/for/pip',
}
-> python::virtualenv {'/tmp/foobar':
  python_version => '2.7.5'
}
-> python::pip {'pgadmin':
  python_version => '2.7.5',
  virtualenv     => '/tmp/foobar',
  install_dir    => '/tmp/foobar',
  pkgname        => 'pgadmin4'

}

This can also be set through hiera:

python::versions:
  - '2.7.5'
  - '2.7.6'
  - '2.7.7'
python::virtualenv: true
python::pip_url: 'https://path/to/pip'

or specify an hash of versions

python::versions:
  '2.7.5':
    ensure: absent
  '2.7.6':
    ensure: present
    virtualenv: false
  '2.7.7':
    ensure: present
    virtualenv: true

With the above hiera values you can just specify

class {'python': }

Reference

class: python

  • pyenv_ensure If the specified version should be present.
    • Values: present absent.
    • Default present
  • virtualenv_ensure If virtual env should be installed default.
    • Values true false.
    • Default true
  • pyenv_version Which pyenv version should be installed.
    • Values String.
    • Default 1.2.5
  • pyenv_url Where to get pyenv from.
    • Values String.
    • Default https://github.com/pyenv/pyenv.git
  • user The user pyenv should be installed for.
    • Values String.
    • Default ec2-user
  • group The group pyenv should be installed for.
    • Values String.
    • Default ec2-user
  • pyenv_install_dir Where to install pyenv.
    • Values: String.
    • Default /home/$user/.pyenv
  • pip_url The pip url.
    • Values: String.
    • Default https://pypi.org/simple
  • python_versions The python versions that should be installed.
    • Values Hash or Array.
    • Default empty

class: python::config

  • bashrc The bash rc of the user
    • Value: String
    • Default: /home/${hiera(python::user)}/.bashrc
  • ensure If the pyenv settings should be present.
    • Values present absent.
    • Default present
  • user The user of the bashrc
    • Values: String.
    • Default $python::user
  • install_dir Where pyenv is installed.
    • Value String.
    • Default $python::pyenv_install_dir

class: python::virtualenv

  • ensure If the virtualenv should be present.
    • Values present absent.
    • Default present
  • python_version Which python version to use.
    • Required
    • Value String
  • user The user pyenv is installed for.
    • Values: String.
    • Default $python::user
  • group The group pyenv is installed for.
    • Values: String.
    • Default $python::group
  • runas The user that runs the commnad.
    • Values String.
    • Default $user
  • virtualenv The virtualenv name.
    • Values String.
    • Default $title
  • pyenv_root Where pyenv is installed.
    • Values String.
    • Default $python::pyenv_install_dir

class: python::pip

  • install_dir Where to install the package.
    • Required
    • Value String
  • python_version Which python version to use.
    • Required
    • Value String
  • pkgname The package name.
    • Value String.
    • Default $title
  • user The owner of the package.
    • Value String.
    • Default $python::user
  • group The owner group of the package.
    • Value String.
    • Default $python::group
  • runas The user pip should un as.
    • Value String.
    • Default $user
  • pyenv_root Where pyenv is installed.
    • Value String.
    • Default $python::pyenv_install_dir
  • requirements To install the requirements.
    • Value String.
    • Default undef
  • virtualenv Which virtualenv to use.
    • Value String.
    • Default undef

Limitations

Only *NIX os like systems can use this module.