You can use executable objects with Python services to specify a custom Python interpreter for your Python scripts. This allows different Python services to use different Python versions or configurations.
While this topic focuses on Python services as an example, executable objects also work with Ansible and OpenTofu services.
You can use executable objects to specify custom versions or installations of any supported tool.
Use executable objects with Python services when you need to:
conda environment or pyenv installationIf you don’t specify an executable object, Python services use the system default Python interpreter. This maintains backward compatibility with existing Python services.
Use the iagctl create service python-script command with the --executable-object parameter to create a Python service that uses a custom interpreter.
Syntax:
Parameters:
<service-name>: A unique name for the Python service--executable-object: The name of the executable object that defines the Python interpreter--repository: The name of the Git repository that contains your Python script--working-dir: The path within the repository where your script is located--filename: The name of the Python script file to executeExample:
Create a Python service that uses Python 3.11:
Run Python services the same way you run other services:
IAG uses the executable object configuration to run your Python script with the correct Python interpreter.
You cannot use static environments and executable objects together in the same Python service. If you configure a Python service with both a static environment and an executable object, IAG returns an error.
Choose one of the following approaches for each Python service: