Contribute#

We absolutely welcome all code contributions and hope that this guide facilitates an understanding of the PyACP code repository. It is important to note that while the PyACP software package is maintained by Ansys and any submissions are reviewed thoroughly before merging, we still seek to foster a community that can support user questions and develop new features to make this software a useful tool for all users. As such, we welcome and encourage any questions or submissions to this repository.

For example, you can make contributions as follows:

  • Report a bug or suggest a feature.

  • Give feedback or make suggestions for improving the documentation.

  • Submit a pull request to fix a bug or add a feature.

  • Report your use case, explain how PyACP has helped you, or indicate what features are still missing.

For feedback, suggestions, or bug reports, open an issue on the PyACP GitHub repository. For code changes or documentation improvements, open a pull request.

Development Setup#

Installation#

Installing PyACP in developer mode allows you to modify the source and enhance it. Before contributing to the project, please refer to the PyAnsys Developer’s guide.

You will need to follow these steps:

  1. Start by cloning this repository, and entering the newly created directory:

    git clone https://github.com/ansys/pyacp
    cd pyacp
    
  2. Make sure you have the latest version of poetry:

    python -m pip install pipx
    pipx ensurepath
    pipx install poetry
    

    Note

    At this point, you may need to restart your shell or editor to ensure that the new poetry command is available.

  1. Install the project and all its development dependencies using poetry. This also takes care of creating a new virtual environment:

    poetry install --with dev,test --all-extras
    

    This step installs PyACP in an editable mode (no build step is needed, no re-install when changing the code).

  2. Activate your development virtual environment with:

    poetry shell
    

Testing#

The PyACP test suite uses pytest. You can run it with

pytest --license-server=<YOUR_LICENSE_SERVER> tests/unittests

Benchmarking#

As part of the test suite, we run some performance benchmarks. These can be run with

pytest --license-server=<YOUR_LICENSE_SERVER> tests/benchmarks

Additional options can be found in the pytest-benchmark documentation.

NOTE: The benchmarks use the tc-netem Linux kernel module to simulate a slow network connection within a Docker container. This is available only on Linux, not on Docker for MacOS or Windows.

The benchmark results from the main branch are uploaded to https://acp.docs.pyansys.com/benchmarks.

Pre-commit hooks#

Style and linter checks are run through the pre-commit tool. You can run these checks with

pre-commit run --all-files

We also recommend installing pre-commit into your repository:

pre-commit install

This will run the pre-commit hooks on the changed files before every git commit. If you ever need to create a commit without running the hooks, you can skip them with git commit -n.

Documentation#

Before generating the documentation, configure the PyACP server via the ansys-launcher, see Launching ACP above. If Ansys is installed the examples can directly built with Sphinx.

On Linux & MacOS:

make -C doc html

On Windows:

cd doc; .\make.bat html

The generated HTML files can be viewed with the browser of your choice.

Alternatively you can build the documentation by starting a mapdl and pydpf-composites docker container. First ensure that you have accepted the DPF Preview License Agreement by setting the ANSYS_DPF_ACCEPT_LA environment variable to Y (see DPF Preview License Agreement ). In addition the ANSYSLMD_LICENSE_FILE environment variable needs be set to a valid license server (e.g 1055@mylicenseserver.com). Then start the docker containers with:

docker compose -f docker-compose/docker-compose-extras.yaml up -d

Then build the documentation with the Sphinx commands mentioned above.

On Windows, you can use the shipped shell script:

.\doc\create_doc_windows.ps1

Distribution#

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

poetry build
twine check dist/*

This creates both a source distribution, and a wheel file. An alternative is

pip install build
python -m build --wheel

License#

PyACP is licensed under the MIT license. Please see the LICENSE for more details.