• To install and execute:
ansible-galaxy install constrict0r.develpy
ansible localhost -m include_role -a name=constrict0r.develpy -K
  • Passing variables:
ansible localhost -m include_role -a name=constrict0r.develpy -K \
    -e "{packages: [gedit, rolldice]}"
  • To include the role on a playbook:
- hosts: servers
      - {role: constrict0r.develpy}
  • To include the role as dependency on another role:
  - role: constrict0r.develpy
    packages: [gedit, rolldice]
  • To use the role from tasks:
- name: Execute role task.
    name: constrict0r.develpy
    packages: [gedit, rolldice]

To run tests:

cd develpy
chmod +x

On some tests you may need to use sudo to succeed.



In order to run tests with pytest, execute the following steps:

  • Inside your project’s root folder, create a tests directory:
cd my-project
mkdir tests
  • Add your test file inside the tests folder, be sure to prefix it with the text test_, for example
touch tests/
  • Inside the test file add some test functions, each function name must be prefixed with the text test_:
def tests_ok():
  • Call pytest using the command:
python3 -m pytest tests/

Pytest with virtualenv

If you want to use a virtualenv for running your tests, from a terminal:

  • Create the virtual environment:
python3 -m venv .
  • Activate the virtual environment:
source bin/activate
  • Install pytest on the virtual environment:
python3 -m pip install pytest
  • Then run the tests:
python3 -m pytest tests/

Pytest on Emacs

On emacs, you can use the following keybindings:

  • C-c C-c: Execute current script.
  • C-c C-t: Execute pytest tests.

For more keybinding available see the elpy documentation.


In order to run tox, execute the following steps:

  • Create a folder named tests.
  • Add your tests to the created folder.
  • On the root directory of your project, create a tox.ini file with the following contents:
skipsdist = True
envlist = py{37}

deps =
commands =
  python3 -m pytest tests
  • Finally call tox:

Tox on Emacs

To run tox form emacs, step over the name of a test function and execute the keybindings:

M-x tox-current-test RET

Or you can run the entire test suite with:

M-x tox-current-class: Execute current tox test suite.

Virtualenvs on Emacs

To make emacs automatically load a virtual enviroment when a file inside a project is edited, follow the steps:

  • Create a virtual enviroment inside ·/.virtualenvs, for example name it my_virtualenv:
python3 -m venv ~/.virtualenvs/my_virtualenv
  • Add a file named .dir-locals.el on the root directory of your project with the following content:
;; Directory Local Variables

;; Activate 'my_virtualenv' virtual enviroment from emacs.
((nil . ((pyvenv-workon . "my_virtualenv"))))

Now if you open a file of your project the virtual enviroment my_virtualenv will be enabled automatically.

Emacs, PDB & Virtualenv

In order to run pdb from emacs when using a virtual enviroment, execute the steps:

  • Create your virtual enviroment:
python3 -m venv ~/.virtualenvs/my_virtualenv
  • Copy pdb3 from the system path to the newly created virtual enviroment:
cp /usr/bin/pdb3 ~/.virtualenvs/my_virtualenv/bin/pdb
  • Edit the file ~/.virtualenvs/my_virtualenv/bin/pdb and change the first line from:
#! /usr/bin/python3.7
  • To:
#! /home/username/.virtualenvs/my_virtualenv/bin/python3
  • If you are developing a python package, inside emacs and on first editing, install your package running:
M-x shell RET
python install RET
  • You can now call pdb with
M-x pdb

You will be prompted (on the minibuffer) for a way to run pdb (i.e.: run pdb like this: pdb), you must run pdb passing the path to your file:

  • You can now use the following keybindings:
- M-x pdb RET: Run PDB on a new window.
- C-x: Set breakpoint on current line.
- c: Run up to the breakpoint.
- n: Next line.
- s: Explore (search) functions on current line.
- p: Watch a variable.
- w: Print out the stack.
- u: Go up on the stack.
- d: Go down on the stack.


In order to use python poetry you will need a pyproject.toml file similar to the following:

name = "my-project"
version = "0.1.0"
description = "My description"
authors = ["username <>"]

readme = "README.rst"

keywords = ["devel", "tools"]
classifiers = [
    'Topic :: Software Development :: Devel Tools',
    'License :: OSI Approved :: MIT License',

pytest = "^=5.4"
tox = "^3.14"

click = "^7.0"
python = "^3.7"

my-project = "my_project.cli:main"

legacy_tox_ini= """
skipsdist = True
envlist = py{37}

deps =
commands =
  poetry install
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

And then run poetry as a python3 module:

python3 -m poetry install

Poetry on Emacs

You can execute poetry on emacs running the command:

M-x poetry RET