# Python package
# Create and test a Python package on multiple Python versions.
# Add steps that analyze code, save the dist with the build record,
# publish to a PyPI-compatible index, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/python
variables:
latestPythonVersion: '3.7'
trigger:
- master
strategy:
matrix:
# Test across operating systems on latest Python version
linuxLatest:
image: ubuntu-16.04
python.version: $(latestPythonVersion)
toxenv: py,codecov
macOSLatest:
image: macos-10.13
python.version: $(latestPythonVersion)
toxenv: py,codecov
windowsLatest:
image: vs2017-win2016
python.version: $(latestPythonVersion)
toxenv: py,codecov
# Test across previous Python versions
linuxPython36:
image: ubuntu-16.04
python.version: '3.6'
toxenv: py,codecov
linuxPython35:
image: ubuntu-16.04
python.version: '3.5'
toxenv: py,codecov
linuxPython27:
image: ubuntu-16.04
python.version: '2.7'
toxenv: py,codecov
# Docs
docs:
image: ubuntu-16.04
python.version: $(latestPythonVersion)
toxenv: docs-html
pool:
vmImage: $(image)
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
displayName: 'Use Python $(python.version) on $(vmImage)'
- script: |
python -m pip install --upgrade pip
pip install tox
displayName: 'Install tox'
- script: tox
env:
TOXENV: toxenv
displayName: 'Run tox'