{"id":14984778,"url":"https://github.com/jenkinsci/pyenv-pipeline-plugin","last_synced_at":"2025-10-05T14:31:46.498Z","repository":{"id":26418513,"uuid":"104392005","full_name":"jenkinsci/pyenv-pipeline-plugin","owner":"jenkinsci","description":"Execute commands in Python virtualenvs in Jenkins Pipeline DSL","archived":false,"fork":true,"pushed_at":"2022-02-24T21:54:00.000Z","size":99,"stargazers_count":33,"open_issues_count":15,"forks_count":15,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-09-24T15:29:53.951Z","etag":null,"topics":["jenkins","jenkins-pipeline","jenkins-plugin","jenkinsfile","python","virtualenv"],"latest_commit_sha":null,"homepage":"https://plugins.jenkins.io/pyenv-pipeline/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"cstarner/pyenv-pipeline","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jenkinsci.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-21T19:49:34.000Z","updated_at":"2024-01-11T08:48:53.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/jenkinsci/pyenv-pipeline-plugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fpyenv-pipeline-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fpyenv-pipeline-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fpyenv-pipeline-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fpyenv-pipeline-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jenkinsci","download_url":"https://codeload.github.com/jenkinsci/pyenv-pipeline-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219877021,"owners_count":16554818,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jenkins","jenkins-pipeline","jenkins-plugin","jenkinsfile","python","virtualenv"],"created_at":"2024-09-24T14:09:39.465Z","updated_at":"2025-10-05T14:31:41.238Z","avatar_url":"https://github.com/jenkinsci.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pyenv Pipeline Plugin\nA Jenkins plugin that provides a way to execute \u003ccode\u003esh\u003c/code\u003e and \n\u003ccode\u003ebat\u003c/code\u003e Pipeline DSL commands within a specified Python\nvirtualenv.\n\n## Overview\nThis plugin provides 1 new Pipeline DSL method:\n\n* \u003ccode\u003ewithPythonEnv\u003c/code\u003e: Specifies a Python virtualenv to execute\n  any \u003ccode\u003esh\u003c/code\u003e and \u003ccode\u003ebat\u003c/code\u003e DSL commands contained \n  within its block.\n  \n  \u003ccode\u003ewithPythonEnv\u003c/code\u003e takes a single String argument, which\n  specifies the Python executable to use for the virtualenv.\n  pyenv-pipeline will use the executable to generate a corresponding\n  virtualenv. At runtime, it will take a snapshot of environmental \n  variables with and without the virtualenv active. From this it generates\n  a diff, and applies the environmental variable changes within the\n  \u003ccode\u003ewithPythonEnv\u003c/code\u003e block (reverting them after the block completes)\n  \n  The argument provided to \u003ccode\u003ewithPythonEnv\u003c/code\u003e will first attempt\n  to match it against the name of a \u003ccode\u003eToolInstallation\u003c/code\u003e that\n  is described by a \u003ccode\u003eToolDescriptor\u003c/code\u003e with an ID that is contained\n  within a pre-defined list of known Jenkins Python Tool plugin IDs. Currently,\n  this plugin only looks to see if [ShiningPanda](https://github.com/jenkinsci/shiningpanda-plugin) is installed. If a \n  \u003ccode\u003eToolInstallation\u003c/code\u003e is matched, the location of that tool is used\n  as the Python executable to generate the virtualenv.\n  \n  If no \u003ccode\u003eToolInstallation\u003c/code\u003e is matched, we attempt to treat the argument as \n  the location of an already existing virtualenv. A directory lookup is attempted with the\n  string argument, and if the argument is determined to point to a virtualenv, we go\n  ahead and use that. \n  \n  * In order for this feature to work, the passed argument must end with the OS appropriate\n  file separator.\n  \n  Lastly, the argument is treated as the literal location of the Python executable to be used. This can be used\n  to specify a specific Python installation (if the location is known beforehand),\n  or to fallback and use the systems default Python installation.\n  \n  * \u003cpre\u003e\u003ccode\u003ewithPythonEnv('python') {\n        // Uses the default system installation of Python\n        // Equivalent to withPythonEnv('/usr/bin/python') \n        ...\n    }\n    \u003c/code\u003e\u003c/pre\u003e\n  * \u003cpre\u003e\u003ccode\u003ewithPythonEnv('/usr/bin/python3.5') {\n        // Uses the specific python3.5 executable located in /usr/bin\n        ...\n    }\u003c/code\u003e\u003c/pre\u003e\n  * \u003cpre\u003e\u003ccode\u003ewithPythonEnv('CPython-2.7'){\n        // Uses the ShiningPanda registered Python installation named 'CPython-2.7'\n        ...\n    }\u003c/code\u003e\u003c/pre\u003e  \n    \n  * \u003cpre\u003e\u003ccode\u003ewithPythonEnv('/home/user/managed_virtualenv/'){\n        // Uses the virtualenv that already exists at /home/user/managed_virtualenv/\n        ...\n    }\u003c/code\u003e\u003c/pre\u003e\n\n\n## Warnings:\n\n  * Earlier version of this plugin relied on using \u003ccode\u003epysh\u003c/code\u003e and\n  \u003ccode\u003epybat\u003c/code\u003e steps to execute code within \u003ccode\u003ewithPythonEnv\u003c/code\u003e\n  blocks. These steps are no longer necessary. To migrate, simply remove the \u003ccode\u003epy\u003c/code\u003e\n  prefix from any such steps, and the command should work as intended. The steps are\n  still included, and are copies of the \u003ccode\u003esh\u003c/code\u003e and \u003ccode\u003ebat\u003c/code\u003e steps. Eventually,\n  the steps will be removed altogether.\n\n\n  * Multibranch pipeline builds will occasionally generate very long path names\n  triggering pypa/virtualenv#596. In these instances, use of this plugin is not\n  an option, at least at this time. \n  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenkinsci%2Fpyenv-pipeline-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjenkinsci%2Fpyenv-pipeline-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenkinsci%2Fpyenv-pipeline-plugin/lists"}