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 the Local Product Launcher.

The following contribution information is specific to the Local Product Launcher.

Install in developer mode#

Installing the Local Product Launcher in developer mode allows you to modify and enhance the source:

  1. Clone the repository:

    git clone https://github.com/ansys/ansys-tools-local-product-launcher
    
  2. Access the directory where you have cloned the repository:

    cd ansys-tools-local-product-launcher
    
  3. Make sure you have the latest version of Poetry:

    python -m pip install pipx
    pipx ensurepath
    pipx install poetry
    
  4. Install the project and all its development dependencies using Poetry, which takes care of creating a clean virtual environment:

    poetry install --with dev,test
    
  5. Activate your development virtual environment:

    poetry shell
    
  6. Verify your development installation:

    tox
    

Testing#

The Local Product Launcher takes advantage of tox. This tool allows you to automate common development tasks (similar to Makefile), but it is oriented towards Python development.

Using 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 environment commands are provided:

  • tox -e style: Checks for coding style quality.

  • tox -e py: Checks for unit tests.

  • tox -e py-coverage: Checks for unit testing and code coverage.

  • tox -e doc: Checks for documentation building.

Raw testing#

If required, from the command line, you can call style commands like Black, isort, and Flake8. You can also call unit testing commands like pytest. However, running these commands do not guarantee that your project is being tested in an isolated environment, which is the reason why tools like tox exist.

Code style#

As indicated in Coding style in the PyAnsys developer’s guide, the Local Product Launcher follows PEP8 guidelines. It implements pre-commit for style checking.

To ensure your code meets minimum code styling standards, run these 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’s not possible for you to push code that fails the style checks:

$ pre-commit install
$ git commit -am "added my cool feature"
black....................................................................Passed
isort....................................................................Passed
flake8...................................................................Passed
codespell................................................................Passed

Documentation#

For building documentation, you can manually run this command:

make -C doc/ html && your_browser_name doc/html/index.html

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

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

Distributing#

The following commands can be used to build and verify the package:

poetry build
twine check dist/*

The preceding commands create both a source distribution and a wheel file.

Post issues#

Use the Local Product Launcher Issues page to report bugs and request new features. When possible, use the issue templates provided. If your issue does not fit into one of these templates, click the link for opening a blank issue.

On the Discussions page on the Ansys Developer portal, you can post questions, share ideas, and get community feedback.

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