Molecule: Python 3 Compatibility

Created on 19 Dec 2017  路  5Comments  路  Source: ansible-community/molecule

Issue Type

  • Feature request

Molecule and Ansible details

ansible 2.4.2.0
  config file = /Users/dfinninger/.ansible.cfg
  configured module search path = ['/Users/dfinninger/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/dfinninger/.virtualenvs/infra-py3/lib/python3.6/site-packages/ansible
  executable location = /Users/dfinninger/.virtualenvs/infra-py3/bin/ansible
  python version = 3.6.3 (default, Oct  4 2017, 06:09:15) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)]

molecule, version 2.5.0
  • Molecule installation method: pip
  • Ansible installation method: pip

Desired Behaviour

Ability to use Python 3

Actual Behaviour (Bug report only)

$ molecule --debug init
ERROR: Python version '3.6.3' not supported.  Molecule only supports python version = 2.7.

$ molecule --no-debug init
ERROR: Python version '3.6.3' not supported.  Molecule only supports python version = 2.7.

$ molecule init
ERROR: Python version '3.6.3' not supported.  Molecule only supports python version = 2.7.

Additional Discussion

Is there a reason for explicitly blocking Python 3 from molecule?
It looks like the CLI code explicitly disables Python 3.6. The CHANGELOG mentions that version checks were added and the associated pull request doesn't shed much light on the decision either.

Is there a particular rationale for this? I've searched through the docs (and maybe I missed it) but I couldn't find anywhere that states why this is blocked.

763 states that Molecule v2 is 3.5/3.6 compliant.

A note in the documentation about this or removing the constraint would be greatly appreciated. If work is needed to support Python3, then I can try to devote some cycles over the holidays.

All 5 comments

The problem is Ansible _not_ Molecule. I have been trying to release py3 support for Molecule since Ansible 2.2. However, Molecule always finds a bug with Ansible's py3 compatibility.

Last bug reported had to do with galaxy having issues under py3.

Molecule is py3 supported, but until I can pass all the Molecule functional tests (across the supported Ansible releases), I'm not wanting to open it up to py3.

@retr0h Thanks for the response. I'm in the process of upgrading Molecule for our team and wanted to try out Python 3. But if it's a problem with Ansible than that's all fine.

I think a short blurb in the docs with this reasoning would be appreciated. 馃槂

Potentially in the Readme just after Ansible Support or in the docs under the Requirements Section?

Closing. Molecule will report py3 not supported when running under py3.

@retr0h Thanks for going out of your way to try to ensure Py3 compatibility in upstream Ansible, and thanks for molecule!

This information took me a while to find, is there a way to track this information (along with the upstream ansible blockers) in a more obvious location? Maybe the README?

FYI, https://molecule.readthedocs.io/en/latest/installation.html#requirements says:

Python 3.6 with Ansible >= 2.4

:rocket: :rocket: :rocket:

Was this page helpful?
0 / 5 - 0 ratings