Skip to main content

Python library for ACP - Ansys Composite PrepPost

Project description

PyACP Logo

PyAnsys Python PyPI GH-CI Codecov MIT Black

A Python client for Ansys Composite PrepPost (ACP).

Installation

Install PyACP with:

pip install ansys-acp-core[all]

For installing PyACP in development mode, see the Development Setup instructions below.

Documentation

The PyACP documentation can be viewed online at https://acp.docs.pyansys.com.

Getting Started

Launching ACP

The ACP server can be started with launch_acp:

import ansys.acp.core as pyacp

acp = pyacp.launch_acp()

Basic Usage

Once the server is running, we can start working with PyACP. For example, to load an ACP Model from an existing file:

>>> remote_path = acp.upload_file(local_path="<MODEL_PATH>")
>>> model = acp.import_model(path=remote_path)
>>> model.name
'ACP Model'

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 and its shell plugin:

    python -m pip install pipx
    pipx ensurepath
    pipx install poetry
    pipx inject poetry poetry-plugin-shell
  1. Install the project and all its development dependencies using poetry. This also takes care of creating a new virtual environment:

    poetry install --all-groups --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

Basic documentation build

To build the documentation, run the following commands:

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.

This method of building the documentation will run the examples with the default or currently configured launch options for the ACP, MAPDL, and DPF servers. Make sure to have these installed and configured correctly, or alternatively follow the Docker-based instructions below.

Alternative: start services with docker

Alternatively, you can use the provided docker-compose file to start the MAPDL and DPF servers.

First, review the DPF preview license agreement, and if you agree, set the ANSYS_DPF_ACCEPT_LA environment variable to Y. See the PyDPF documentation for details.

On Windows, you can then use the shipped shell script:

.\doc\create_doc_windows.ps1

The following manual steps can be used on any platform:

  1. Set the following additional environment variables in your shell:

    • ANSYSLMD_LICENSE_FILE: To a valid license server (e.g 1055@mylicenseserver.com).

    • PYMAPDL_PORT: Choose any free port.

    • PYMAPDL_START_INSTANCE=FALSE

    • PYDPF_COMPOSITES_DOCKER_CONTAINER_PORT: Choose any free port.

  2. Start the docker containers with:

    docker compose -f docker-compose/docker-compose-extras.yaml up -d
  3. Build the documentation with the Sphinx commands mentioned above:

    On Linux & MacOS:

    make -C doc html

    On Windows:

    cd doc; .\make.bat html

Partial builds

Two environment variables can be used to run a quicker partial documentation build:

  • PYACP_DOC_SKIP_API=1: Skip the API reference build.

  • PYACP_DOC_SKIP_GALLERY=1: Skip running the examples.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ansys_acp_core-0.3.2.tar.gz (126.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ansys_acp_core-0.3.2-py3-none-any.whl (267.5 kB view details)

Uploaded Python 3

File details

Details for the file ansys_acp_core-0.3.2.tar.gz.

File metadata

  • Download URL: ansys_acp_core-0.3.2.tar.gz
  • Upload date:
  • Size: 126.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for ansys_acp_core-0.3.2.tar.gz
Algorithm Hash digest
SHA256 543ccc9a9227ac42dfb967de05957e600da0abb3bd6f371375773f3ee6fb8a09
MD5 0ffbe7e05378ae926af1cf82105ebb5a
BLAKE2b-256 2b0f506e3b451b86fd2ebb0fe67f665a98783f89a049b286391fcb765a28c8da

See more details on using hashes here.

Provenance

The following attestation bundles were made for ansys_acp_core-0.3.2.tar.gz:

Publisher: ci_cd.yml on ansys/pyacp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ansys_acp_core-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: ansys_acp_core-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 267.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for ansys_acp_core-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e633d9176d5b76fce9537b791a8bf8c088a13e80a0d442cba5ec189bd978b959
MD5 f26a7cd3120df851df6c3c6bcd0b6190
BLAKE2b-256 1c7ac8a6488c5b347fceba2fd485647ecabde07847b71486d4f67717009c0a30

See more details on using hashes here.

Provenance

The following attestation bundles were made for ansys_acp_core-0.3.2-py3-none-any.whl:

Publisher: ci_cd.yml on ansys/pyacp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page