Integrating Python and Windows on Travis

1 min read
Integrating Python and Windows on Travis

Travis CI does not currently support Windows natively so the following is a workaround. Installing Python is done using Chocolatey package manager and specifying the "patch" version is required. If you need to install specific Python versions, check the available versions here.

matrix:
  include:
    - name: "Python: 3.5"
      os: windows
      language: shell
      before_install:
        - choco install python --version=3.5.4
        - python -m pip install -U pip setuptools
      env: PATH=/c/Python35:/c/Python35/Scripts:$PATH
      cache:
        directories:
          - $LOCALAPPDATA/pip/Cache
    - name: "Python: 3.6"
      os: windows
      language: shell
      before_install:
        - choco install python --version=3.6.8
        - python -m pip install -U pip setuptools
      env: PATH=/c/Python36:/c/Python36/Scripts:$PATH
      cache:
        directories:
          - $LOCALAPPDATA/pip/Cache
    - name: "Python: 3.7"
      os: windows
      language: shell
      before_install:
        - choco install python --version=3.7.7
        - python -m pip install -U pip setuptools
      env: PATH=/c/Python37:/c/Python37/Scripts:$PATH
      cache:
        directories:
          - $LOCALAPPDATA/pip/Cache
    - name: "Python: 3.8"
      os: windows
      language: shell
      before_install:
        - choco install python --version=3.8.2
        - python -m pip install -U pip setuptools
      env: PATH=/c/Python38:/c/Python38/Scripts:$PATH
      cache:
        directories:
          - $LOCALAPPDATA/pip/Cache

Read more articles like this in the future by buying me a coffee!

Buy me a coffeeBuy me a coffee