Skip to main content

Setup Python Environment

Sets up a Python virtual environment with dependencies from a GitHub repository or requirements file.

Category: Python Execution · Group: General · Activity name: SetupPythonEnvironment

The SetupPythonEnvironment activity in the designer

Example

pythonPath = SetupPythonEnvironment("<venvPath>", githubToken="<githubToken>", githubUrl="<githubUrl>", branch="<branch>", repoPath="<repoPath>", requirementsPath="<requirementsPath>", interpreterPath="<interpreterPath>")

Inputs

NameTypeRequiredDefaultDescription
GitHub Access TokenstringPersonal access token for private repositories. Leave empty for public repositories.
GitHub Repository URLstringThe URL of the GitHub repository to clone (e.g., https://github.com/user/repo). Leave empty if using an existing local requirements file.
Branch NamestringGit branch to checkout after cloning (e.g., main, develop, feature/xyz). Defaults to the repository's default branch if not specified.
Repository Clone PathstringAbsolute path where to clone the repository (e.g., /tmp/my-project). Required when githubUrl is provided.
Virtual Environment PathstringYesPath where the virtual environment should be created. Can be absolute (e.g., /tmp/my-project/venv) or relative (e.g., ./venv).
Requirements File PathstringPath to requirements.txt file. Can be relative to repoPath (e.g., requirements.txt) or absolute path.
Python Interpreter PathstringPath to the Python interpreter to use for creating the virtual environment (e.g., /usr/bin/python3.9, python3). Defaults to 'python3' if not specified.

Outputs

NameTypeDescription
pythonPathstringPath to the Python executable in the created virtual environment.