Skip to content

Puppet module for installing and managing Python, pip, virtualenvs and Gunicorn virtual hosts.

License

Notifications You must be signed in to change notification settings

voxpupuli/puppet-python

puppet-python

Build Status Release Puppet Forge Puppet Forge - downloads Puppet Forge - endorsement Puppet Forge - scores puppetmodule.info docs License

Puppet module for installing and managing python, pip, virtualenvs and Gunicorn virtual hosts.

Please note: The module stankevich/python has been deprecated and is now available under Vox Pupuli: puppet/python.

Usage

For class usage refer to the Reference. If contributing, this is updated with

bundle exec rake strings:generate\[',,,,false,true']

Install Python package to a user's default install directory

The following code simulates

python3 -m pip install pandas --user

where pip installs packages to a user's default install directory -- typically ~/.local/ on Linux.

# Somewhat hackishly, install Python PIP module PANDAS for Oracle Cloud API queries.
python::pyvenv { 'user_python_venv':
  ensure     => present,
  version    => 'system',
  systempkgs => true,
  venv_dir   => '/home/example/.local',
  owner      => 'example',
  group      => 'example',
  mode       => '0750',
}

python::pip { 'pandas':
  virtualenv => '/home/example/.local',
  owner      => 'example',
  group      => 'example',
}

hiera configuration

This module supports configuration through hiera. The following example creates two python3 virtualenvs. The configuration also pip installs a package into each environment.

python::python_pyvenvs:
  "/opt/env1":
    version: "system"
  "/opt/env2":
    version: "system"
python::python_pips:
  "nose":
    virtualenv: "/opt/env1"
  "coverage":
    virtualenv: "/opt/env2"
python::python_dotfiles:
  "/var/lib/jenkins/.pip/pip.conf":
    config:
      global:
        index-url: "https://mypypi.acme.com/simple/"
        extra-index-url: "https://pypi.risedev.at/simple/"

Using SCL packages from RedHat or CentOS

To use this module with Linux distributions in the Red Hat family and python distributions from softwarecollections.org, set python::provider to 'rhscl' and python::version to the name of the collection you want to use (e.g., 'python27', 'python33', or 'rh-python34').

Release Notes

See Changelog

Contributors

Check out Github contributors.