2 minute read

Versions and setup

CodeShip uses pyenv to manage Python versions. 3.11 is the default version.

Versions 3.7, 3.8, 3.9, 3.10 and 3.12 are preinstalled as well. These are aliases that point to the specific versions installed.

The following Python versions are preinstalled:

3.7 3.7.17 3.8 3.8.19 3.9 3.9.19 3.10 3.10.14 3.11 * 3.11.9 (set by /home/rof/.pyenv/version) 3.12 3.12.2

Specifying Version

You have several options to specify which Python version you would like to use.

In your setup commands you can use pyenv commands. For instance:

pyenv local $version

You can also use the environment variable PYENV_VERSION to choose from one of the installed Python versions.

Alternatively, you can specify a version to use by committing a file named .python-version into your code repository with a version specification.

To install a specific Python version that is not already preinstalled, add these commands:

pyenv install $version pyenv local $version


You can use pip to install any dependencies in your setup commands.

For example:

pip install -r requirements.txt

Dependency Cache

CodeShip automatically caches all dependencies installed through pip. You can read this article to learn more about the dependency cache and how to clear it.

Frameworks And Testing

All Python frameworks, including Django, Flask and Pyramid, should work without issue.

All test frameworks and tools, including pytest and unittest, should also work without issue.

Parallel Testing

If you are running parallel test pipelines, you will want separate your tests into groups and call a group specifically in each pipeline. For instance:

Pipeline 1


Pipeline 2


Parallelization Modules

In addition to parallelizing your tests explicitly via parallel pipelines, you may find that there are packages available for parallelizing different types of testing, such as nose-parallel, to speed your tests up.

While we do not officially support or integrate with these modules, many CodeShip users find success speeding their tests up by using them. Note that it is possible for these modules to cause resource and build failure issues, as well.

Notes And Known Issues

Due to Python version issues, you may find it helpful to tests your commands with different versions via an SSH debug session if tests are running differently on CodeShip compared to your local machine.

Executable Not Available

As we use pyenv, if an executable is not available after installation you may need to run the command pyenv rehash after installing the package. You can read pyenv’s documentation for more information.

Cannot Rehash

You may encounter a rehash error like this:

pyenv: cannot rehash: /home/rof/.pyenv/shims/.pyenv-shim exists

If this occurs try adding this command to the start of your Setup Steps:

rm -rf $HOME/.pyenv/plugins/pyenv-codeship-rehash