Contribute#

Overall guidance on contributing to a PyAnsys library appears in Contributing in the PyAnsys developer’s guide. Ensure that you are thoroughly familiar with this guide before attempting to contribute to Ansys SCADE GUI Tools.

The following contribution information is specific to Ansys SCADE GUI Tools.

Install in developer mode#

Installing Ansys SCADE GUI Tools in developer mode allows you to modify the source and enhance it.

  1. Clone the ansys-scade-guitools repository:

    git clone https://github.com/ansys/scade-guitools
    
  2. Access the scade-guitools directory where the repository has been cloned:

    cd scade-guitools
    
  3. Create a clean Python 3.10 environment and activate it:

    You should use the interpreter delivered with Ansys SCADE. For example, C:\Program Files\ANSYS Inc\v241\SCADE\contrib\Python310\python.exe.

    # Create a virtual environment
    python -m 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
    
  4. Make sure that you have the latest required build system, documentation, testing, and CI tools:

    python -m pip install -U pip     # Upgrading pip
    python -m pip install tox        # Installing tox (optional)
    python -m pip install .[build]   # for building the wheels
    python -m pip install .[tests]   # for testing the package
    python -m pip install .[doc]     # for building the documentation
    
  5. Install the project in editable mode:

    python -m pip install --editable .
    
  6. Use tox to verify your development installation:

    tox
    

Test#

Ansys SCADE GUI Tools uses tox for testing. This tool allows you to automate common development tasks (similar to Makefile), but it is oriented towards Python development.

Use tox#

While Makefile has rules, tox has environments. In fact, tox creates its own virtual environment so that anything being tested is isolated from the project to guarantee the project’s integrity.

The following tox commands are provided:

  • tox -e code-style: checks for coding style quality.

  • tox -e doc: checks for the documentation-building process.
    • tox -e doc-html: builds the HTML documentation.

    • tox -e doc-links: checks for broken links in the documentation.

Use raw testing#

If required, from the command line, you can call style commands like black, isort, and flake8. However, running these commands does not guarantee that your project is being tested in an isolated environment, which is the reason why tools like tox exist.

Use pre-commit#

Ansys SCADE GUI Tools follows the PEP8 standard as outlined in PEP 8 in the PyAnsys developer’s guide and implements style checking using pre-commit.

To ensure your code meets minimum code styling standards, run the following commands:

pip install pre-commit
pre-commit run --all-files

You can also install this as a pre-commit hook by running this command:

pre-commit install

This way, it is not possible for you to push code that fails the style checks:

$ pre-commit install
$ git commit -am "added my cool feature"
Add License Headers......................................................Passed
ruff check...............................................................Passed
ruff format..............................................................Passed
codespell................................................................Passed
check for merge conflicts................................................Passed
debug statements (python)................................................Passed
check yaml...............................................................Passed
trim trailing whitespace.................................................Passed
Validate GitHub Workflows................................................Passed
check pre-commit.ci config...............................................Passed
blacken-docs.............................................................Passed

Build documentation#

For building documentation, you can run the usual rules provided in the Sphinx make file. Here are some examples:

#  build and view the doc from the POSIX system
make -C doc/ html && your_browser_name doc/html/index.html

# build and view the doc from a Windows environment
.\doc\make.bat clean
.\doc\make.bat html
start .\doc\_build\html\index.html

However, the recommended way of checking documentation integrity is to use tox:

tox -e doc-html && your_browser_name doc/_build/html/index.html

Debug and integration test#

Ansys SCADE GUI Tools needs to be registered to SCADE for integration testing. Indeed, the library is used in a SCADE IDE session.

Install in user mode#

It is not possible to reuse the virtual environment setup for the repository. You must install the package in an environment accessible by SCADE, for example its own Python distribution, although this is not advised, or the Python 3.10 user distribution:

<python310.exe> -m pip install --user --editable .

You can reuse any <install>\SCADE\contrib\Python310\python.exe or Python 3.10 installation on your computer.

If you are using Ansys SCADE 2024 R1 or below, you must perform one additional step, to install a registration file in %APPDATA%\SCADE\Customize:

<python310.exe> -m ansys.scade.guitools.register

Debug#

The debugging of SCADE Custom Extensions that run in the context of the SCADE IDE requires a different approach. You can use the module enable_debugpy to enable the usage of debugpy, that is an implementation of the Debug Adapter Protocol for Python 3.

Refer to the following links to setup a Python IDE supporting debugpy:

Run the integration tests#

These are manual tests. Refer to the test procedures, contained in each test directory as readme files.

Uninstall#

Once the test or debug sessions are completed, proceed as follows to uninstall the package:

  • If you are using Ansys SCADE 2024 R1 or below, you should remove the registration files:

    <python310.exe> -m ansys.scade.guitools.unregister
    
  • Uninstall the package:

    <python310.exe> -m pip uninstall ansys.scade.guitools
    

Distribute#

If you would like to create either source or wheel files, start by installing the building requirements and then executing the build module:

python -m pip install .[build]
python -m build
python -m twine check dist/*

Post issues#

Use the Ansys SCADE GUI Tools Issues page to submit questions, report bugs, and request new features. When possible, use these templates:

  • Bug, problem, error: to file a bug report

  • Documentation error: to request modifications to the documentation

  • Adding an example: to propose a new example

  • New feature: to request enhancements to the code

If your issue does not fit into one of these template categories, click the link to open a blank issue.

To reach the project support team, email pyansys.core@ansys.com.