Installation#

You can install PyETK using an installer, using Python, or in developer mode. Choose the method that best suits your needs.

Install PyETK using an installer#

The repository’s Releases page provides for downloading PyETK assets. For the latest PyETK release, use one of these links to download the installer for your operating system:

Follow these steps to use the Windows installer to install PyETK in user mode:

  1. Download the Windows installer. The file should be named PyETK-Installer-Windows.exe.

  2. Run the installer.

  3. Search for PyETK and run it.

The PyETK UI opens.

On Linux, supported operating systems are Ubuntu 22.04 and 24.04.

Follow these steps to use a Linux installer to install PyETK in user mode:

  1. Run the following commands to update the apt-get repository and install these packages with sudo privileges: wget, gnome, libffi-dev, libssl-dev, libsqlite3-dev, libxcb-xinerama0, and build-essential:

    sudo apt-get update -y
    sudo apt-get install wget gnome libffi-dev libssl-dev libsqlite3-dev libxcb-xinerama0 build-essential -y
    
  2. Install the zlib package:

    wget https://zlib.net/current/zlib.tar.gz
    tar xvzf zlib.tar.gz
    cd zlib-*
    make clean
    ./configure
    make
    sudo make install
    
  3. Install the Toolkit Template:

    1. Download the latest Toolkit-Template_*.zip file from the repository’s Release page.

    2. Run this command on the terminal:

      unzip Toolkit-Template_*.zip
      ./installer.sh
      
    3. Search for PyETK and run it.

The PyETK UI opens.

To uninstall PyETK, follow these steps.

  1. Select File > Uninstall.

  2. Click Uninstall.

Install PyETK using Python#

You can use Python to install from PyPI either both the PyETK backend and UI methods or only the backend methods.

To install both the backend and UI methods:

pip install ansys-pyetk[all]

To install only the backend methods:

pip install ansys-pyetk

Install PyETK in developer mode#

Installing PyETK in developer mode allows you to modify the source and enhance it.

Note

Before contributing to the project, see the PyAnsys developer’s guide.

You can install PyETK in developer mode with only these few lines of code:

git clone https://github.com/ansys/ansys-pyetk
cd ansys-pyetk
python -m pip install -U pip uv
uv venv
uv pip install -e .

To run PyEDT, use this command:

uv run run_toolkit

Work environment setup

To set up your work environment for development, follow these steps:

  1. Create a fresh-clean Python environment and activate it. For more information, see the venv Python documentation.

    # Create a virtual environment
    python -m uv venv .venv
    
    # Activate it in a POSIX system
    source .venv/bin/activate
    
    # Activate it in Windows CMD environment
    .venv\Scripts\activate.bat
    
    # Activate it in Windows Powershell
    .venv\Scripts\Activate.ps1
    
  2. Make sure you have the latest version of pip:

    python -m pip install -U pip uv
    
  3. Install the project in editable mode:

    python -m uv pip install -e .[tests,doc]
    
  4. Verify your development installation by running the tests:

    uv run pytest tests -v
    

Run style checks and tests#

This project uses pre-commit to run style checks and tests.

Install pre-commit:

uv pip install pre-commit
uv run pre-commit install

After each commit, pre-commit runs to ensure your changes follow project style guidelines:

git commit -am 'fix style'
isort....................................................................Passed
black....................................................................Passed
blacken-docs.............................................................Passed
flake8...................................................................Passed
codespell................................................................Passed
pydocstyle...............................................................Passed
check for merge conflicts................................................Passed
debug statements (python)................................................Passed
check yaml...............................................................Passed
trim trailing whitespace.................................................Passed
Validate GitHub Workflows................................................Passed

If you need to run pre-commit again on all files and not just staged files, run it with the --all-files option:

uv run pre-commit run --all-files

Deploy a local build#

You can deploy PyETK as a frozen application using PyInstaller:

uv pip install -e .[freeze]
uv run pyinstaller frozen.spec

This generates app files at dist/ansys_pyetk/Electronic Transformer Toolkit.exe. The Electronic Transformer Toolkit.exe is a standalone application, without the need to install Python or any dependencies.

It is also possible to deploy an Windows installer using NSIS.

For more information see: Distributing Toolkits

Build documentation#

To build the documentation, run the usual rules provided in the Sphinx Makefile:

uv pip install -e .[doc]
uv run make -C doc/ html

# subsequently open the documentation with (under Linux):
<your_browser_name> doc/html/index.html