Travis setup

Tue 12 May 2020
One job in continuous integration pipeline (Photo credit: Wikipedia)

The goal is to setup a CI pipeline based on Travis with external dependencies integrated to a Github repository

Travis basics

To enable Travis integration in Github, one must edit ./.travis.yml file.

I won't go into detail. The setup is documented in the official tutorials and is straight forward. All your Github repository will be listed on your Travis home page. The official documentation propose a default file:

language: python
   python:
     - "2.7"
     - "3.4"
     - "3.5"
     - "3.6"      # current default Python on Travis CI
     - "3.7"
     - "3.8"
     - "3.8-dev"  # 3.8 development branch
     - "nightly"  # nightly build
     # command to install dependencies
   install:
     - pip install -r requirements.txt
     # command to run tests
   script:
     - pytest

This works (if you have setup tests runnable with pytest). Yet, python version does not need to include the older one, neither the unstable one. That means when updating your python version, you must update your Travis file.

When pushing a commit to Github, the Travis pipeline will be triggered, and if all tests pass, a tick will appear in the list of commit on Github.

Small tick appearing on Github commit list

Debug

When the CI tests fail, you can see Travis logs. A commit trigger a Travis build, and a build can be composed of several jobs. For example, there is one job per python version. Each job generate its log. The log contain all command run and its results.

Package installation

Your project may require extra dependencies. Let's see how to install them.

Extra scripts

You can custom the install section of your Travis file. You can put multiple steps on this section: If you use a requirements.txt:

language: python
   python:
     - "3.8"
   install:
     - pip install -r requirements.txt
     - make install
   script:
     - pytest

Python setup.py

For python projects, given that you may have more steps to do for installation, the prefered way to do this is to use a setup.py <https://docs.python.org/3/distutils/setupscript.html>_. The minimal setup.py I recommand use only the setup() function with the following arguments:

  • install_requires for requirements (if needed, read from requirements.txt)
  • packages
  • package_dir to avoid manipulating PYTHONPATH manually

Thus, the setup.py, located at the root of the project, contains

#!/usr/bin/env python

from distutils.core import setup


setup(
  package_dir={"": "src"},
  packages=["egg"],
  install_requires=["faker"],
)

To run this setup.py, you can pip install your project:

...
install:
  - pip install .
...

apt-get

The CI runs on ubuntu virtual machines. Thus, you can add a list of packages that can be installed. This is done through the add-on section:

language: python
   add_ons:
     apt_packages:
       - texlive-full
       - pandoc
   python:
     - "3.8"
   install:
     - pip install .
   script:
     - pytest -v

Category: howto Tagged: travis ci howto


Wikidata crawling

Sun 26 April 2020
Graph database representation (Photo credit: Wikipedia)

I wish to have reliable data about vehicles. I decided to rely on one large source, namely Wikipedia. I chose it because it is reviewable and most of the time reviewed, and regularly updated and completed.

Wikipedia - Wikidata relationship

Wikidata items are made to …

Category: how to Tagged: python wikipedia wikidata html

Read More

Differential equation in python

Sat 04 April 2020
Second order differential equation (Photo credit: Wikipedia)

In python, differential equations can be numerically solved thanks to scipy [1]. Is usage is not as intuitive as I expected.

Simple equation

Let's start small. The first equation will be really simple:

\begin{equation*} \frac{\partial{f}}{\partial{t}} = a \times f …

Category: maths Tagged: python maths equation

Read More

Zombie propagation

Sat 21 March 2020
Zombie favorite food warning (Photo credit: wikipedia)

I recently read a paper [1] trying to model a disease propagation. I wanted to play with this model.

The model

The model is know as "SIR" as it divide the population into 3 groups:

  • S: suceptible to become a zombie
  • I: infected …

Category: maths Tagged: python maths zombie

Read More

Python virtualenv: quick reference

Sun 21 July 2019
Virtual environement (Photo credit: wikipedia)

To isolate python developments, I use virtualenv. This allow me to forget about the specific python version used for each project, avoid interferences with the default python installation and between my projects, is relatively light, and may have other advantages I cannot imagine with my …

Category: programming Tagged: python tools code

Read More

C*: Yaw

Mon 01 April 2019
aileron Vertical stabilizer (Photo credit: Wikipedia)

This post is about yaw control. This is also the post for which I did not find many references.

Remember the yaw is the axis controlled by the rudder. The rudder acts as any foil, providing a force dependant of its angle of attack. This …

Category: aviation Tagged: C star Flight dynamics yaw

Read More

LaTeX makefile updated

Fri 29 March 2019

My default LaTeX makefile evolved. Here is an update:

The makefile looks like:

LATEX=pdflatex
BIBTEX=bibtex
BIB=
RERUN='(There is undefined reference|Rerun to get (cross-references|the bars) right)'

%.pdf:%.tex
    ${LATEX} $<
    @if [ -e $*.bbl ]; then ${BIBTEX} $* && ${LATEX} $< && ${LATEX} $< ; fi
    @if egrep -q $(RERUN) $*.log ; then ${LATEX} $< ; fi

%.aux …

Category: tools Tagged: GNU LaTeX Makefile Writing how to tools

Read More
Page 1 of 11

Next »