Classic Docs
Docs Navigation

Python Continuous Integration

This document contains information related to projects based on the Ubuntu 14.04 image. If you are using the Ubuntu 18.04 image for your projects, please refer to this page.

If you are using the Ubuntu 14.04 image and you want to switch to Ubuntu 18.04, be sure to check our upgrade guide.

Semaphore makes it easy to setup continuous integration for Python projects. When you add a project from a Python repository, Semaphore will run a brief analysis and suggest some common commands based on the structure of your repository.

For example, after the analysis determines that the project is written in Python and it has a requirements.txt file, the following commands will be suggested:

pip install -r requirements.txt
python test

You can easily change or add more build commands, customize your build environment with configuration files, environment variables and more (see the 'Customizing your build' section for more information).

# CI environment for Python projects

The Semaphore platform supports a wide range of Python versions:

  • 2.6.9
  • 2.7.10
  • 3.3.6
  • 3.4.3
  • 3.5.0
  • 3.6.0
  • pypy 5.8.0
  • pypy3 5.8.0

Python environments are managed with virtualenv version 15.1.0. Selecting a Python version in Project Settings activates the corresponding Python environment in your build. Virtual environments are created in the following path: /home/runner/.pyenv/<version>.

Pre-installed packages include pip, mock, pytest, virtualenv, and nose.

# Change Python version with a command

If you have another language set in Project Settings, but you need a specific Python version as well, you can use change-python-version in your setup:

  change-python-version <version>

  Supported versions are: 2.6, 2.7, 3.3, 3.4, 3.5, 3.6

# Dependency management

Python packages installed with pip are cached between builds on Semaphore. By default, pip packages are downloaded to /home/runner/.pip_download_cache.

# Guides

Semaphore Docs are open source — Edit on GitHub


Occasional lightweight product and blog updates. Unsubscribe at any time.

2009-2020 © Rendered Text. All rights reserved. Terms of Service, Privacy policy, Security.