GithubHelp home page GithubHelp logo

classicvalues / python-pipeline-utils Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ableton/python-pipeline-utils

1.0 1.0 0.0 245 KB

Jenkins shared pipeline library for Python-related utilities

License: MIT License

Groovy 100.00%

python-pipeline-utils's Introduction

python-pipeline-utils

python-pipeline-utils is a Jenkins shared pipeline library which contains utilities for working with Python.

Using the Library

The easiest way to use this library in your Jenkins pipeline scripts is to add it to your Jenkins configuration. See the Jenkins shared library usage documentation for more information. Please note that this library may not work with the GitHub Organization plugin, since it creates workspace directories that exceed the shebang limit of 128 characters.

Singletons

This library contains singleton wrappers for the classes so that the Jenkinsfile can be a bit less verbose.

pipenv

The pipenv singleton runs a closure using pipenv for a list of Python versions. Unlike the virtualenv singleton, it automatically installs packages from the pipenv lockfile with pipenv sync --dev --python.

pipenv.runWith(['python3.6', 'python3.7', 'python3.8']) { python ->
  sh(label: "Running unit tests with ${python}", script: 'pytest .')
}

pythonPackage

The pythonPackage singleton parses the version number from a package, returning it as a string.

String version = pythonPackage.readVersion(filename: 'mypackage/__init__.py')

virtualenv

The virtualenv singleton creates a Python Virtualenv in the project's temporary folder. Example usage might look something like this:

Object venv

stage('Setup') {
  venv = virtualenv.create(this, 'python3.6')
  venv.run('pip install -r requirements.txt')
}

stage('Test') {
  venv.run(label: 'Run unit tests', script: 'pytest .')
}

virtualenvs

This singleton is similar to virtualenv, but is a list of virtualenv objects. It is intended to make testing code with multiple Python versions easier.

Object venvs = virtualenvs.create(['python3.6', 'python3.7', 'python3.8'])
venvs.run('pip install -r requirements.txt')
venvs.run('pytest .')

Building and Testing

The python-pipeline-utils library can be developed locally using the provided Gradle wrapper. Likewise, the Gradle project can be imported by an IDE like IntelliJ IDEA. For this, you'll need the Groovy plugin enabled in IDEA and to install Groovy SDK.

This library uses the JenkinsPipelineUnit framework for unit testing. The unit tests can be run locally with ./gradlew test.

Maintainers

This project is maintained by the following GitHub users:

python-pipeline-utils's People

Contributors

nre-ableton avatar ala-ableton avatar dependabot[bot] avatar mst-ableton avatar dependabot-preview[bot] avatar dgl-ableton avatar rco-ableton avatar

Stargazers

Classic Values avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.