Continuous Integration and Continuous Deployment with Python

CircleCI works well for Python projects. We run automatic inference on each build to determine your dependencies and test commands. If we don’t infer all of your settings, you can also add custom configuration to a circle.yml file checked into your repo’s root directory.


When CircleCI detects Python, we automatically use virtualenv to create an isolated Python environment.

We have many versions of Python pre-installed on Ubuntu 12.04 and Ubuntu 14.04 build images.

If you don’t want to use the default, you can specify your version in circle.yml:

    version: pypy-2.2.1

If you need to use multiple Python versions simultaneously, you can make them available as follows:

    - pyenv global 2.7.12 3.4.4

These will be available as python2.7 and python3.4

Please contact us if other versions of Python would be of use to you.

Note: CircleCI will set up virtualenv if you specify your Python version in your circle.yml. This can be useful if we didn’t automatically detect that you’re using Python.

Package managers and dependencies

CircleCI automatically installs your dependencies using either pip when we find a requirements.txt, or distutils when we find a file. You can also add custom dependencies commands from your circle.yml, for example:

    - pip install PIL --allow-external PIL --allow-unverified PIL


CircleCI has pre-installed more than a dozen databases and queues, including PostgreSQL and MySQL. If needed, you can manually set up your test database from your circle.yml.


CircleCI automatically runs test commands when certain files are detected:

  • tox when tox.ini is found
  • nosetests when is found
  • test when contains a testing section
  • test when contains a testing section

Be aware that if you are testing a framework that has generated static assets, i.e. CSS files that are created using SASS, you will need to trigger their generation. For example, with Django you can tell to gather up the static assets and prevent “file not found” testing errors:

    - ./ collectstatic --no-input

You can add custom test commands from your circle.yml:

    - ./

We can automatically parallelize both standard Python tests run with nose and Django tests. However, the mechanisms to collect the tests only see class-style tests, not bare-function nose-style tests.


CircleCI has first-class support for deployment with Fabric or Paver. To set up deployment after green builds, you can add commands to the deployment section of your circle.yml:

    branch: master
      - fab deploy

Troubleshooting for Python

Problems? Check out our Python troubleshooting information:

If you are still having trouble, please contact us and we will be happy to help.