Skip to main content

Python wrapper for the Jenkins CI REST API

Project description

Build Automation Test Coverage Python Versions Documentation Status Requirements Status Package Format Download Count GPL License

Overview

Extensible, user and developer friendly Python interface to the Jenkins CI tool, wrapping the features exposed by the standard REST API using Pythonic objects and functions. Tested against the latest 2.x and 3.x versions of Python, and the latest trunk and LTS editions of Jenkins.

With an intuitive and well thought out interface, PyJen offers anyone familiar with the Python programming language an easy way to manage Jenkins servers from a simple command prompt. All core primitives of Jenkins including views, jobs and builds are easily accessible and can be loaded, analyzed and even modified or created via simple Python commands.

Comments, suggestions and bugs may be reported to the project maintainer

Full API documentation can be found on ReadTheDocs.org.

Quick start guide

  1. First, we recommend that you install the pip package manager if it is not already installed. See here for details.

  2. Install PyJen directly from PyPI using PIP:

# pip install pyjen
  1. import the pyjen module and start scripting! See below for some common examples.

For a more in-depth guide to contributing to the project, see our contributors guide.

Examples

Display a list of all jobs on the default view

from pyjen.jenkins import Jenkins
jk = Jenkins("http://localhost:8080")
vw = jk.default_view
jobs = vw.jobs

for j in jobs:
    print(j.name)

Disable all jobs in a view named “My View”

from pyjen.jenkins import Jenkins
jk = Jenkins("http://localhost:8080")
vw = jk.find_view("My View")
vw.disable_all_jobs()

Get all upstream dependencies of a job named “JobA”

from pyjen.jenkins import Jenkins
jen = Jenkins("http://localhost:8080")
jb = jen.find_job("JobA")
upstream = jb.all_upstream_jobs

for u in upstream:
    print(u.name)

Clone all jobs in a view named with a ‘trunk’ identifier for a new branch

from pyjen.jenkins import Jenkins
j = Jenkins("http://localhost:8080")
v = j.find_view("trunk_builds")
v.clone_all_jobs("trunk", "branch")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pyjen-1.0.1-py2.py3-none-any.whl (76.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pyjen-1.0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: pyjen-1.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 76.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/38.2.4 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.3

File hashes

Hashes for pyjen-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 05fcb3d5758c68aec3c7b796819fac3abd23597de2f1a1a4a370f1c4f97f3b1e
MD5 cc4bb2c367aab5001b83ca0bf33ecd55
BLAKE2b-256 4397c952b26a39a2a878ddafa0e792dddbd511cc2eca2ad510bf28b13272131b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page