Contribute#

Install in development mode#

Installing PyDPF Composites in development mode allows you to modify the source and enhance it.

Before attempting to contribute to PyDPF Composites, ensure that you are thoroughly familiar with the PyAnsys Developer’s Guide.

  1. Clone the repository:

    git clone https://github.com/ansys/pydpf-composites
    cd pydpf-composites
    
  2. Install dependencies:

    python -m pip install pipx
    pipx ensurepath
    # Minimum required poetry version is 1.2.0
    pipx install poetry
    pipx install pip
    pipx install tox
    

    PyDPF Composites uses Poetry to manage the development environment.

  3. Create a virtual environment and install the package with the development dependencies:

    poetry install --all-extras
    
  4. Activate the virtual environment:

    poetry shell
    

Test#

There are different ways to run the PyDPF Composites tests, depending on how the DPF server is started.

  1. Run tests with a Docker container:

    Follow the steps in Getting the DPF server Docker image to get and run the DPF docker image. Run the tests with the following command

    pytest . --port 50052
    
  2. Run tests with a DPF server started from the Ansys installer. The Ansys version must be 2023 R2 or later.

    pytest . --ansys-path "C:\Program Files\Ansys Inc\v232"
    
  3. Run tests with a Docker container from Github (Ansys Internal only):

    docker pull ghcr.io/ansys/pydpf-composites:latest
    pytest .
    

Build documentation#

Follow the description in Getting the DPF server Docker image image to get and run the dpf docker image.

On Windows, build the documentation with:

tox -e doc-windows

On Linux, build the documentation with:

tox -e doc-linux

Ansys internal only: Build the docs with the latest container from Github:

docker pull ghcr.io/ansys/pydpf-composites:latest
docker run -d -p 50052:50052 -e ANSYSLMD_LICENSE_FILE=1055@mylicserver -e ANSYS_DPF_ACCEPT_LA=Y ghcr.io/ansys/pydpf-composites:latest
tox -e doc-windows

Run style checks#

The style checks use pre-commit and can be run through tox:

tox -e style

The style checks can also be configured to run automatically before each git commit:

pre-commit install

View documentation#

Documentation for the latest stable release of PyDPF Composites is hosted at PyDPF Composites Documentation.

In the upper right corner of the documentation’s title bar, there is an option for switching from viewing the documentation for the latest stable release to viewing the documentation for the development version or previously released versions.