The Vitis Unified IDE supports Python APIs to automate the management of Vitis Unified IDE components. The Vitis Unified IDE contains a Python Interpreter and script building logger. The Python interpreter supports Python APIs and executes the APIs in the Vitis tool.
The script building logger converts the Vitis tool GUI user actions (create and build Vitis Unified IDE components) into equivalent Python APIs. You can use the Python file the script building logger bgenerates to create and build components with the Python interpreter.
The Vitis Unified IDE works on the server-client architecture. To execute Python APIs, you need to first establish the connection between the server and the client. Python APIs can be executed in command line mode or as a Python script. The Vitis Unified IDE supports two methods to run Python APIs:
- Run Python API in CLI (Command-Line Interface) mode. Vitis only supports executing the Python API in CLI mode with interactive mode. More details on interactive mode can be found at Vitis Interactive Python Shell.
- Run Python API in a Python Script. The Vitis
Unified IDE supports the execution of Python script in batch mode as well as in an
interactive
mode.
In batch mode: $ vitis -s <.py> In Interactive mode: vitis [1]: run <.py>
Before running the script, you must set up the environment variables for the Vitis Unified IDE. Refer to Setting Up the Vitis Tool Environment in the AI Engine Tools and Flows User Guide (UG1076) to set up the Vitis Unified IDE environment. The Vitis Unified IDE supports Python APIs for project flow management, creation and building of the following Vitis components.
- AI Engine Component
- HLS Component
- Platform Component
- Application Component
- System Project
The script building logger logs actions from the GUI and saves the file as
builder.py. To access builder.py, follow the steps below.
- Navigate to . You can also press
Ctrl+Shit+E.
- In the Explorer window, go to
logs: builder.py. The Python interpreter
creates builder.py. This file logs the
equivalent Python APIs for the commands used in the Vitis Unified IDE. You can run builder.py later to automate the process.
Some Python APIs are helpful in managing client life cycles. The Python APIs can create Vitis workspaces and manage Vitis project flows. These APIs are described in the following table. Refer to the Vitis API CLI documentation for more details.
| Python API | Description | Example |
|---|---|---|
| create_client | Creates a client instance. | client=vitis.create.client() |
| dispose | Closes all client connections and terminates the connection to the server. | client.dispose() |
| exit | Closes the session. | exit() |
For more details on all the Python APIs Vitis supports, refer to <vitis_installation_path>/cli/api_docs/build/html/vitis.html. In the Vitis Unified IDE, go to .
Refer to <vitis_installation_path>/cli/examples for Python examples.
vitis -w <workspace_path>
If you create components and system projects through Python APIs, their build
and created status has status done.
Refer to the following sections for the Python APIs for creating and building components.