Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

PyAnsys Tools Variable Interop

PyAnsys pypi GH-CI codecov MIT black

Overview

PyAnsys Tools Variable Interop contains definitions of the basic variables, types, metadata, and values intended to provide interoperability between all products that optionally choose to participate.

Characteristics

PyAnsys Tools Variable Interop has these key characteristics:

  • Supports a minimal but complete set of formally defined data types for engineering work.

  • Offers a standard base implementation in each supported language that matches the style and intent of the given language.

  • Implements the same standard data types and conversion rules as all ModelCenter products.

  • Provides the following capabilities:

    • To/from an “API” string (not intended for UI layer) to allow data transfer in human-readable format across products and regions

    • To/from human-readable display strings

    • To/from binary blocks that are platform agnostic

    • Implicit conversion to/from language primitives for lossless conversions

    • Explicit conversion for lossy conversions

  • Uses the visitor pattern to make it easy and reliable to add and reuse new operations with compile-time semantics. A data type library can either make it easy to add new data types or make it easy to add new operations to the existing data types. It is extremely hard to make both possible at the same time. Because this library makes it easy to add new operations to the existing data types, adding new data types is not easy.

  • Defines strongly the most commonly reused metadata.

  • Provides a generic dictionary for custom metadata.

Top-level items

Descriptions follow of the top-level items in PyAnsys Tools Variable Interop:

  • The base metadata type that all variable types extend is CommonVariableMetadata. Metadata is defined as the information about a variable that is static and does not change when a component or workflow is run.

  • The value interface is IVariableValue. These values are defined so that PyAnsys Tools Variable Interop knows how to properly convert from one type to the other via language operators. Lossless conversions are implicit. Operations that are lossy, such as converting a real value to an integer, are explicit. Explicit conversions can throw an exception if there is an overflow or other “bad data” situation.

Project background

After 20 years of work on integration problems, a holistic review was performed around the concept of a variable in some legacy codebases. No less than two dozen classes that represent a variable were found. There were many more switch statements, where one data type needed to be converted to another. This inconsistency brings about the following problems:

  • The behavior of one capability within the product suite does not match that of other capabilities, leading to confusion, bugs, and lost time.

  • Switch statements are notorious for introducing bugs. People tend to cut and paste them, leading to subtle maintenance issues as one is modified and the other diverges. There is no compile-time type checking.

  • Slight differences in data types (int32 versus int64) can lead to unexpected bugs, including disastrous “bad data with no error” class issues.

  • Seemingly simple tasks like reliably converting to a string or byte buffer and back are surprisingly hard to do correctly in all edge cases. Worse, even if you get a “correct” implementation, if it doesn’t match what is used at an API boundary by a different capability or product, errors ensue.

The standards and the standard implementations in several languages came out of this review.

Documentation and issues

Documentation for the latest stable release of this package is hosted at PyAnsys Tools Variable Interop 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.

On the PyAnsys Tools Variable Interop Issues page, you can create issues to report bugs and request new features. On the PyAnsys Tools Variable Interop Discussions page or the Discussions page on the Ansys Developer portal, you can post questions, share ideas, and get community feedback.

To reach the project support team, email pyansys.core@ansys.com.

Installation

The pyansys-tools-variableinterop package currently supports Python 3.10 through 3.13 on Windows, MacOS, and Linux.

You can install this package with this command:

pip install pyansys-tools-variableinterop

Alternatively, install the latest version from the pyansys-tools-variableinterop GitHub repository with this command:

pip install git+https://github.com/ansys/pyansys-tools-variableinterop

To install a local development version of the project, run these commands:

git clone https://github.com/ansys/pyansys-tools-variableinterop
cd pyansys-tools-variableinterop
pip install -e .

Documentation building

Install the required dependencies for building the documentation with this command:

pip install .[doc]

Build and view documentation with the one or more commands for your operating system:

# For Linux and MacOS
make -C doc/ html && your_browser_name doc/build/html/index.html

# For Windows
.\doc\make.bat html
.\doc\build\html\index.html

Testing

Install the dependencies required for testing with this command:

pip install .[tests]

Run the tests via pytest with this command:

pytest -v

Usage

You can create values and metadata like any other Python object:

import ansys.tools.variableinterop as atvi

width = atvi.RealValue(3.1)
width
width_metadata = atvi.RealMetadata()
width_metadata.lower_bound = 0.1
var(width_metadata)

License

PyAnsys Tools Variable Interop is licensed under the MIT license.

Metadata

Release files for pyansys-tools-variableinterop 0.2.dev0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyansys-tools-variableinterop 0.2.dev0
File Size Uploaded Provenance Actions
pyansys_tools_variableinterop-0.2.dev0.tar.gz 49.8 kB With provenance Details for pyansys_tools_variableinterop-0.2.dev0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyansys-tools-variableinterop 0.2.dev0
File Interpreter ABI Platform Actions
pyansys_tools_variableinterop-0.2.dev0-py3-none-any.whl Python 3 none any Details for pyansys_tools_variableinterop-0.2.dev0-py3-none-any.whl

Total release size: 137.0 kB

Release files / pyansys_tools_variableinterop-0.2.dev0.tar.gz

Download URL pyansys_tools_variableinterop-0.2.dev0.tar.gz
Size 49.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c25256a0a4d429d35e58759504d044a382f8975b94500e020663bf5e70efe534
BLAKE2b-256 checksum
How to use checksums
2085f4ec9ba3a293b21c6220a0fb02f4269bd5e44a2e8d23297e656c870e7601
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Release files / pyansys_tools_variableinterop-0.2.dev0-py3-none-any.whl

Download URL pyansys_tools_variableinterop-0.2.dev0-py3-none-any.whl
Size 87.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25cda5f746f1d300f216439b6e42250bac9cf2642359ef10512db287162aa8b5
BLAKE2b-256 checksum
How to use checksums
8cfb763395b6c62d85e6fdedab2f9d1e12ef687be28b82762fbceba8b9975aa6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Security for pyansys-tools-variableinterop 0.2.dev0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pyansys_tools_variableinterop-0.2.dev0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page