python-lang-installed

Example:

# Install Python version 3.6.8 for user 'freckles', using 'pyenv'.
- python-lang-installed:
    version: 3.6.8
    user: freckles

Description

Install a Python environment for a user, using pyenv or system packages.

If using 'pyenv', this will install all dependencies required to build Python, then it will download the specified version of Python, compile it, and use the 'pyenv global' command (which will write that information into the file $HOME/.pyenv/version) to make it the default version for the user.

If Python type is 'pyenv', this will add a piece of code to $HOME/.bashrc to load pyenv when the user logs in.

Resources

Variables

Name Type Default Description

build_opts

string --

Build options to be forwarded (if supported by 'python_type').

python_type

string pyenv

How to install Python.

user

string --

The user to install Python for.

version

n/a latest

The version of Python to install.

Examples

Example 1

Install Python version 3.6.8 for user 'freckles', using 'pyenv'.

Code
- python-lang-installed:
    version: 3.6.8
    user: freckles

Example 2

Install the latest version of Python using 'pyenv'.

Code
- python-lang-installed

Example 3

Install system Python, version 2

Code
- python-lang-installed:
    version: 2
    python_type: system

Command-line

frecklecute python-lang-installed --help

Usage: frecklecute python-lang-installed [OPTIONS]

  Install a Python environment for a user, using
  [pyenv](https://github.com/pyenv/pyenv) or system packages.

  If using 'pyenv', this will install all dependencies required to build
  Python, then it will download the specified version of Python, compile it,
  and use the 'pyenv global' command (which will write that information into
  the file $HOME/.pyenv/version) to make it the default version for the
  user.

  If Python type is 'pyenv', this will add a piece of code to
  ``$HOME/.bashrc`` to load pyenv when the user logs in.

Options:
  --build-opts BUILD_OPTS    Build options to be forwarded (if supported by
                             'python_type').
  --python-type PYTHON_TYPE  How to install Python.  [default: pyenv]
  --user USER                The user to install Python for.
  --version VERSION          The version of Python to install.  [default:
                             latest]
  --help                     Show this message and exit.