To mitigate against conflicting dependencies, each tool created with the Python SDK can have an independent Python virtual environment. This allows tools to independently manage a list of dependencies, removing the need to consider other Python SDK tools that could be installed on a user's system.
Each virtual environment has a Python binary, allowing environment creation with multiple Python versions, and can have independent Python packages installed in its site directories. The environment still shares the standard library with the base-installed Python.
By default, a virtual environment is isolated from system-level site-packages directories.
A virtual environment can be created before or after a Python SDK tool is developed. If a tool does not use additional third-party Python libraries, a virtual environment is not needed.
The following steps detail the recommended process for installing a virtual environment. Consistent installation methods prevent issues with virtual environment replication for end users.
Tools using the Program directory require admin permissions:
C:\ProgramData\Alteryx\Tools\ExamplePythonSDKTool
Tools can also be installed on a per-user basis:
C:\Users\%USER%\AppData\Roaming\Alteryx\Tools\ExamplePythonSDKTool
C:\Program Files\Alteryx\bin\Miniconda3>python -m venv C:\ProgramData\Alteryx\Tools\ExamplePythonSDKTool
For more information about Python virtual environments, refer to Python3 documentation.
Use the following steps to install each third-party dependency required by your tool.
C:\ProgramData\Alteryx\Tools\ExamplePythonSDKTool\Scripts
C:\ProgramData\Alteryx\Tools\ExamplePythonSDKTool\Scripts>pip install numpy
Test and manage a virtual environment for development and distribution, ensuring compatibility and portability, by adhering to the following standards.