odoo-openupgrade-wizard/DEVELOP.md

3.8 KiB

Installation to develop

Basic installation

git clone https://gitlab.com/odoo-openupgrade-wizard/odoo-openupgrade-wizard/
cd odoo-openupgrade-wizard
virtualenv env --python=python3
. ./env/bin/activate
poetry install

odoo-openupgrade-wizard commands are now available in your virutalenv.

Advanced installation

If you want to use this library without installing anything in your system, execute the following steps, otherwise, go to 'Installation' part.

  1. Run a docker container:

docker run -it ubuntu:focal

  1. Execute the following commnands

apt-get update
apt-get install git python3 python3-pip python3-venv

python3 -m pip install --user pipx
python3 -m pipx ensurepath

su root

pipx install virtualenv
pipx install poetry

Run tests

Via pytest (simple)

This will run tests only for the current python3.X version.

(in your virtualenv)

poetry run pytest --cov odoo_openupgrade_wizard --verbosity=2 --exitfirst

Via Tox (advanced)

This will run tests for all the python versions put in the tox.ini folder.

(in your virtualenv)

tox

Note : you should have all the python versions available in your local system.

sudo apt-get install python3.6  python3.6-distutils
sudo apt-get install python3.7  python3.7-distutils
sudo apt-get install python3.8  python3.8-distutils
sudo apt-get install python3.9  python3.9-distutils

Via Gitlab Runner locally

# Install tools
pipx install gitlabci-local

# Run new available command
gitlabci-local

Debugging

Some docker command could help you when using / developping this tools.

Enter the postgres container

docker exec -it POSTGRES_CONTAINER_NAME /bin/bash

Contribute

Add python dependencies

If you add new dependencies, you have to:

  • add the reference in the file pyproject.toml

  • run the following command in your virtualenv : poetry update

Publish on pyPI

poetry publish

Understanding the library

Tools to understand

The library is using many tools. It is recommanded to understand that tools to contribute to that project:

Also this project is inspired by the following tools:

Réferences

  • how to install gitlab runner locally:

https://docs.gitlab.com/runner/install/linux-manually.html

  • Check your CI locally. (French)

https://blog.stephane-robert.info/post/gitlab-valider-ci-yml/

https://blog.callr.tech/building-docker-images-with-gitlab-ci-best-practices/

Python version settings depending on the debian version

This part can help you if you want to change your autogenerated Dockerfiles.

See (https://github.com/odoo/odoo/blob/ODOO_VERSION/setup/package.dfdebian)

debian:jessie (V8) (for Odoo: 9.0, 10.0)

  • Ubuntu release : 14.04 trusty, 14.10 utopic, 15.04 vivid, 15.10 wily
  • python2.7 and ???
  • First release : 26/04/2015
  • End LTS : June 2020

debian:stretch (V9) (for Odoo: 11.0, 12.0)

  • Ubuntu releases : 16.04 xenial, 16.10 yakkety, 17.04 zesty, 17.10 artful
  • python2.7 and python3.5
  • First release : 17/06/2017
  • End LTS : June 2022

debian:buster (13.0, 14.0)

  • Ubuntu release : 18.04 bionic, 18.10 cosmic, 19.04 disco, 19.10 eoan
  • python2.7 and python3.7
  • First release : 06/07/2019
  • End LTS : Undefined.

debian:bullseye (15.0)

  • Ubuntu release : 20.04 focal, 20.10 groovy, 21.04 hirsute, 21.10 impish
  • python3.9
  • First release : 14/07/2021
  • End LTS : Undefined.