An Ansible role that installs a specific base python+pip version (major.minor only).
The executables will be available at /usr/bin/python3.7 and /usr/local/bin/pip3.7, for the python_base_version specified.
The role is tested against: Ubuntu 16.04/18.04/20.04, Fedora 31 and CentOS 8 for python versions 3.6, 3.7 and 3.8.
You can also specify a path in which to create a virtualenv which uses this python version, with python_venv_path. By default python_venv_packages is set to install the latest pip, setuptools and wheel versions.
ansible-galaxy install marvel-nccr.python
See defaults/main.yml
- hosts: servers
roles:
- role: marvel-nccr.python
vars:
python_base_version: "3.7"
python_install_dev: true
python_venv_path: "/tmp/my_venv"
python_venv_packages:
- pip
- setuptools
- wheel
python_venv_state: latest- Python 3.7 is not available on CentOS 8
python_install_devandpython_install_tkwill not work for Fedora 31 if no Python 3.7 (python3-develandpython3-tkinterwill be installed, which only work for the default python 3.7 version)
This role uses Molecule and Docker for tests.
After installing Docker:
Clone the repository into a package named marvel-nccr.python (the folder must be named the same as the Ansible Galaxy name)
git clone https://github.com/marvel-nccr/ansible-role-python marvel-nccr.python
cd marvel-nccr.pythonThen run:
pip install -r requirements.txt # Installs molecule
molecule test # runs testsor use tox (see tox.ini):
pip install tox
toxFor testing specific distributions and python versions, .e.g.:
MOLECULE_DISTRO=centos8 MOLECULE_PYTHON_VERSION=3.8 toxTo manually inspect a container, you can run the converge and destroy steps individually:
tox converge
tox destroyCode style is formatted and linted with pre-commit.
pip install pre-commit
pre-commit run -allDeployment to Ansible Galaxy is automated via GitHub Actions.
Simply tag a release vX.Y.Z to initiate the CI and release workflow.
Note, the release will only complete if the CI tests pass.
MIT
Please direct inquiries regarding Quantum Mobile and associated ansible roles to the AiiDA mailinglist.