Version: 0.24 Minimum Jenkins requirement: 1.609 ID: shiningpanda

This plugin adds Python support to Jenkins with some useful builders (Python builder, virtualenv builder, tox builder...) and the ability to use a Python axis in multi-configuration projects (for testing on multiple versions of Python).

This plugin is developed by ShiningPanda., the editor of requires.io, a web service to monitor the dependencies of your Python projects. Contact us for more informations!

Configure Python installations

To configure Python installations, step in Manage Jenkins > Global Tool Configuration . Then look for the Python section.

To configure a new Python installation click on Add Python , then fill the following fields:

Name : the name of this Python installation, make it meaningful by including the Python's version for example.

: the name of this Python installation, make it meaningful by including the Python's version for example. Home or executable : the path to the root folder of the Python installation (CPython, PyPy, Stackless Python, Jython or IronPython) or the path to the Python executable, such as: /opt/local/Library/Frameworks/Python.framework/Versions/2.7 on MacOS X (MacPorts). C:\Python27 on Windows. /usr/bin/python2.6 on Unix. ...

: the path to the root folder of the Python installation (CPython, PyPy, Stackless Python, Jython or IronPython) or the path to the Python executable, such as:

A good practice is to install raw Pythons and then use the Virtualenv Builder to setup your execution environment.

Builders

Five builders dedicated to Python:

Virtualenv Builder (recommended): creates an isolated environment with virtualenv,

(recommended): creates an isolated environment with virtualenv, Buildout Builder : use Buildout to build your project,

: use Buildout to build your project, Tox Builder : use tox to build your project, only available for Jenkins multi-configuration projects,

: use tox to build your project, only available for Jenkins multi-configuration projects, Python Builder : use a Python installation configured on Jenkins via Manage Jenkins > Global Tool Configuration > Python ,

: use a Python installation configured on Jenkins via , Custom Python Builder : use an arbitrary Python installation, typically a manually created virtualenv environment.

Publishers

One publisher dedicated to Python:

Publish coverage.py HTML reports : this publisher aims at displaying HTML reports generated by the coverage package.

FAQ

Why can't I see all the builders?

Have you configured some Python installations in the Python section of the Manage Jenkins > Global Tool Configuration page?

How to configure IronPython on UNIX?

See this blog post.

Roadmap

Support pip's requirements.txt in virtualenv builders (thanks @myusuf3 for the idea). Ease PyLint code analysis (and associated reporting). Improve coverage reporing. Automate installation of Pythons. Your idea here... contact us!

Version History

Version 0.24 (15/07/2018)

Bundle virtualenv 16.0.0

Do not use pip.main

Version 0.23 (25/06/2016)

Bundle virtualenv 15.0.2

Update Tox axis default environments

Version 0.22 (29/08/2015)

Bundle virtualenv 13.1.2 (JENKINS-30068, JENKINS-27551),

Fix JENKINS-28428: coverage 4 renames status.dat to status.json.

Version 0.21 (14/06/2014)

Bundle virtualenv 1.11.6,

Remove package manager selector on Virtualenv Builder ,

, Remove hosted mode.

Version 0.20 (30/06/2013)

Fix JENKINS-18415: can't run shining panda jobs on Jenkins 1.519.

Version 0.19 (19/03/2013)

Bundle virtualenv 1.9.1.

Version 0.18 (24/02/2013)

Add py33 to Tox axis,

to axis, Copyright 2013.

Version 0.17 (29/11/2012)

Bundle virtualenv 1.8.4.

Version 0.16 (21/11/2012)

Fallback on virtualenv 1.7.2 for Python 2.4 (default is 1.8.2).

Version 0.15 (06/11/2012)

Fix JENKINS-14188: path to executable is now allowed in the Home field of a Python installation,

field of a Python installation, Configurable ShiningPanda working directory,

Bundle virtualenv 1.8.2.

Version 0.14 (25/07/2012)

Bundle virtualenv 1.7.2,

Fix Buildout Builder : bootstrap.py of zc.buildout 2 always uses distribute.

Version 0.13 (17/05/2012)

Fix help.

Version 0.12 (30/04/2012)

Add IronPython support,

Switch from Affero GPL to something we could call a Lesser Affero GPL (see here),

Fix path to Jython 2.2.1 executable.

Version 0.11 (05/04/2012)

Bundle the development branch of virtualenv (1.7.1.2.post1@e299c87a1b9a63fcc2c3279cef3bf42e14ba0d32) to include PyPy and Jython fixes for Windows,

Fix the path to the binary of a PyPy based virtualenv on Windows in Virtualenv Builder ,

, Fix JENKINS-13339: configuration file not set when calling buildout in Buildout Builder .

Version 0.10 (20/02/2012)

Bundle virtualenv 1.7.1.2,

New builder for Buildout.

Version 0.9 (26/01/2012)

Improve the Virtualenv Builder cleanup algorithm to avoid useless virtual environment creations,

cleanup algorithm to avoid useless virtual environment creations, Move virtual environments generated by the Virtualenv Builder under $JENKINS_HOME/shiningpanda to avoid deletions caused by full checkouts, as a consequence the Virtualenv home field becomes a Name field: two Virtualenv Builder with the same Name will use the same virtual environment installation,

under to avoid deletions caused by full checkouts, as a consequence the field becomes a field: two with the same will use the same virtual environment installation, Fix the workspace addition in the PATH for the XShell nature.

Version 0.7 (19/01/2012)

Add a Nature field on Python Builder , Virtualenv Builder and Custom Python Builder to specify the type of the Command field. In addition to shell ( Shell nature), you can now type some Python with the Python nature, and some shell commands translated at runtime to match the targeted platform (variables, separator, ...) with the XShell nature,

field on , and to specify the type of the field. In addition to shell ( nature), you can now type some Python with the nature, and some shell commands translated at runtime to match the targeted platform (variables, separator, ...) with the nature, Add a coverage.py HTML report publisher,

Add a TOXENV pattern field to the Tox Builder to compute the test environment (an alternative to Tox axis),

field to the to compute the test environment (an alternative to axis), Detect Python installations in standard locations at first launch,

Unable to submit job configuration if only Custom environments field is used in Tox axis (Mantis 12),

field is used in axis (Mantis 12), In specific cases the Python version was still asked in Virtualenv Builder and Python Builder on multi-configuration projects (Mantis 14),

Create symbolic links to Python shared libraries in $VIRTUAL_ENV/lib on Unix (see virtualenv 216),

on Unix (see virtualenv 216), Copyright 2012.

Version 0.6 (05/12/2011)

Embed virtualenv 1.7 including pull request #193.

As a consequence, No site packages becomes System site packages (with the opposite value) for Virtualenv Builder .

becomes (with the opposite value) for . Fix a 0.4 to 0.5 backward compatibility bug on Python installations.

Version 0.5 (24/11/2011)

Tox Builder .

. Virtualenv is no more required in Python installations.

Windows support.

Jython support.

Custom Virtualenv Builder becomes Custom Python Builder and handles now any kind of Python installation.

becomes and handles now any kind of Python installation. Standard Python Builder becomes Python Builder .

becomes . Full path to Python executable available via PYTHON_EXE environment variable in Command fields.

environment variable in fields. Python axis displayed as a tree on shiningpanda-ci.com.

Version 0.4 (28/09/2011)

Adding ability to pass --no-site-packages to virtualenv (thanks @amcfague).

to virtualenv (thanks @amcfague). Remove (Default) Python version.

Python version. Add an explicit option on builders with Command to ignore non-zero exit code (previously done by specifying an header, which are now ignored).

Version 0.3 (20/09/2011)

Whitespace characters are not allowed in Python names (as they are used to create the workspace path in multi-configuration projects).

Make the build fail if there a some whitespace characters in PYTHONHOME (see. https://bugs.launchpad.net/virtualenv/+bug/241581).

(see. https://bugs.launchpad.net/virtualenv/+bug/241581). Propagate User-defined Axis variables in all builders (multi-configuration projects).

Version 0.2 (13/09/2011)

PyPy support.

Version 0.1 (31/08/2011)

Initial release.

Running tests

If you want to run ShiningPanda plugin tests, ensure that you're on UNIX and that following environment variables are not set: PYTHONHOME , VIRTUAL_ENV and JYTHON_HOME .

You'll also need some Python installations:

a CPython 2 installation,

a CPython 3 installation,

a PyPy installation,

a Jython installation.

To declare them, create a new property file by copying the template (only if template's configuration does not match your environment):

cp src/test/resources/test.properties.model src/test/resources/test.properties

Then edit test.properties and modify the following entries:

CPython.2.Home : CPython 2's home folder ( PYTHONHOME ),

: CPython 2's home folder ( ), CPython.3.Home : CPython 3's home folder ( PYTHONHOME ),

: CPython 3's home folder ( ), PyPy.Home : PyPy's home folder,

: PyPy's home folder, Jython.Home : Jython's home folder ( JYTHON_HOME ),

You can also provide these values via command line:

mvn -DCPython.3.Home=/path/to/cpython/3/home

To run all the tests:

mvn clean install

To run a test:

mvn -Dtest=jenkins.plugins.shiningpanda.builders.TestVirtualenvBuilder

And to debug one (with Eclipse for instance):

mvn -Dmaven.surefire.debug -Dtest=jenkins.plugins.shiningpanda.TestVirtualenvBuilder

For those developing on Eclipse, its test runner is not compatible with Jenkins's base test case. You'll need to run tests via command line.