Python library for ACP - Ansys Composite PrepPost
Project description
A Python client for Ansys Composite PrepPost (ACP).
Overview
Installation
Install PyACP with:
pip install ansys-acp-core
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_filename = acp.upload_file(local_path="<MODEL_PATH>")
>>> model = acp.import_model(path=remote_filename)
>>> 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:
Start by cloning this repository, and entering the newly created directory:
git clone https://github.com/ansys/pyacp cd pyacp
Make sure you have the latest version of poetry:
python -m pip install pipx pipx ensurepath pipx install poetry
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
This step installs PyACP in an editable mode (no build step is needed, no re-install when changing the code).
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.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ansys_acp_core-0.1b2.tar.gz
.
File metadata
- Download URL: ansys_acp_core-0.1b2.tar.gz
- Upload date:
- Size: 86.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dce863acc613f8a23e5626d18a335d51fbee17289f312db49fea1d8ff464b7f7 |
|
MD5 | db69c71c36021258abfa5766d661bd2f |
|
BLAKE2b-256 | 315978573f51bf2f740b5b353485522063b20b75e1d58970e56f606d3e38170b |
File details
Details for the file ansys_acp_core-0.1b2-py3-none-any.whl
.
File metadata
- Download URL: ansys_acp_core-0.1b2-py3-none-any.whl
- Upload date:
- Size: 186.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a3a23e683d12b21f1a15edafc600a05b1279e929bbb02fd06642726e590157d |
|
MD5 | 640ba062baa0b322269baf81e5f9030a |
|
BLAKE2b-256 | 2fa838d76b30beb633a58fc50051a9105bb4c099dd065ab7c08bc2bc21f20134 |