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.1.tar.gz (126.4 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.1-py3-none-any.whl (267.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ansys_acp_core-0.3.1.tar.gz
Algorithm Hash digest
SHA256 9f3cd521183e02b013bea0eff5b96c103ba327123d90b8a42ae2b544fe768e47
MD5 d0c023403d5e0dbc9c5eeb8ba2b5e3c3
BLAKE2b-256 37013d0a1be52b9c13ff84fb391dcfe51e35bffe7ae70db39bf7fdbb11eb2c1a

See more details on using hashes here.

Provenance

The following attestation bundles were made for ansys_acp_core-0.3.1.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.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for ansys_acp_core-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fdd6003b6f0ce71a16e9849a28334422da89148d35948f233fd55890b2885ceb
MD5 9175cad42904379adaebd8c72a841f70
BLAKE2b-256 60c5c4f8474f66afbe72dfba9f4b7b64fab1a0cabcc4231931a8e87d8c83d1d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for ansys_acp_core-0.3.1-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