Use the python build extension to add support for executing Python scripts in your project
pythonExtension
build extension via the @trigger.dev/python
package.
First, you’ll need to install the @trigger.dev/python
package:
pythonExtension
build extension in your trigger.config.ts
file:
python
utilities in the @trigger.dev/python
package to execute Python scripts in your tasks. For example, running a Python script inline in a task:
scripts
option in the pythonExtension
function. This will copy the specified scripts to the build directory during the deploy process. For example:
python
directory to the build directory during the deploy process. You can then execute these scripts using the python.runScript
function:
dev
mode, so you can use the same exact path in development as you do in production.requirements.txt
file in your project, you can use the requirementsFile
option in the pythonExtension
function to install the required packages during the build process. For example:
requirements.txt
file during the build process. You can then use these packages in your Python scripts.
requirementsFile
option is only available in production mode. In development mode, you can
install the required packages manually using the pip
command.devPythonBinaryPath
option in the pythonExtension
function to specify the path to the Python binary in the virtual environment. For example:
python
functions have a streaming version that allows you to stream the output of the Python script as it runs. For example:
process.env
object when running Python scripts. You can access these environment variables in your Python scripts using the os.environ
dictionary. For example:
env
option in the python.runScript
function. For example: