Developer
Documentation
circleci.com
Home
Convenience Images
Documentation
circleci.com
  1. Convenience Images
  2. cimg/python

cimg/python

This image is designed to supercede the legacy CircleCI Python image, circleci/python.

cimg/python is a Docker image created by CircleCI with continuous integration builds in mind. Each tag contains a complete Python version via pyenv. pip, pipenv, and poetry are pre-installed, and any binaries and tools that are required for builds to complete successfully in a CircleCI environment.

Getting Started

This image can be used with the CircleCI docker executor. For example:

1
2
3
4
5
6
7
jobs:
  build:
    docker:
      - image: cimg/python:3.9.0
    steps:
      - checkout
      - run: python --version

In the above example, the CircleCI Python Docker image is used as the primary container. More specifically, the tag 3.9.0 is used meaning the version of Python will be Python v3.9.0. You can now use Python within the steps for this job.

How This Image Works

This image contains the Python programming language as well as pip, pipenv, and poetry. The interpreter is provided via pyenv allowing you to change the Python version during a build as well.

Tagging Scheme

This image has the following tagging scheme:

cimg/python:<python-version>[-variant]

<python-version> - The version of Python to use. This can be a full SemVer point release (such as 3.8.1) or just the minor release (such as 3.8). If you use the minor release tag, it will automatically point to future patch updates as they are released by the Python project. For example, the tag 3.8 points to Python v3.8.5 now, but when the next release comes out, it will point to Python v3.8.6.

[-variant] - Variant tags, if available, can optionally be used. For example, the Node.js variant could be used like this: cimg/python:3.7-node.

Image Tags

Variants

Variant images typically contain the same base software, but with a few additional modifications.

Node.js

The Node.js variant is the same Python image but with Node.js also installed. The Node.js variant can be used by appending -node to the end of an existing cimg/python tag.

1
2
3
4
5
6
7
8
jobs:
  build:
    docker:
      - image: cimg/python:3.9.0-node
    steps:
      - checkout
      - run: python --version
      - run: node --version

Browsers

The browsers variants are currently in beta. Please feel free to contribute to the conversation here.

The browsers variant is the same Python image but with Node.js, Java, Selenium, and browser dependencies pre-installed via apt. The browsers variant can be used by appending -browser to the end of an existing cimg/python tag. The browsers variant is designed to work in conjunction with the CircleCI Browser Tools orb. You can use the orb to install a version of Google Chrome and/or Firefox into your build. The image contains all of the supporting tools needed to use both the browser and its driver.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
orbs:
  browser-tools: circleci/browser-tools@1.1.0

jobs:
  build:
    docker:
      - image: cimg/python:3.7-browsers
    steps:
      - browser-tools/install-browsers
      - checkout
      - run: |
          python --version
          node --version
          java --version
          google-chome --version