Skip to main content

A python wrapper for Ansys Geometry service

Project description

PyAnsys Python PyPI GH-CI Codecov MIT Black pre-commit.ci

PyAnsys Geometry is a Python client library for the Ansys Geometry service.

Usage

There are different ways of getting started with using the Geometry service and its client library, PyAnsys Geometry.

For more information, see Getting Started documentation.

Installation

PyAnsys Geometry has three installation modes: user, developer, and offline.

Install in user mode

Before installing PyAnsys Geometry in user mode, make sure you have the latest version of pip with:

python -m pip install -U pip

Then, install PyAnsys Geometry with:

python -m pip install ansys-geometry-core

Install in developer mode

Installing PyAnsys Geometry in developer mode allows you to modify the source and enhance it.

To install PyAnsys Geometry in developer mode, perform these steps:

  1. Clone the pyansys-geometry repository:

    git clone https://github.com/ansys/pyansys-geometry
  2. Access the pyansys-geometry directory where the repository has been cloned:

    cd pyansys-geometry
  3. Create a clean Python virtual environment and activate it:

    # Create a virtual environment
    python -m venv .venv
    
    # Activate it in a POSIX system
    source .venv/bin/activate
    
    # Activate it in Windows CMD environment
    .venv\Scripts\activate.bat
    
    # Activate it in Windows Powershell
    .venv\Scripts\Activate.ps1
  4. Make sure you have the latest required build system tools:

    python -m pip install -U pip tox
  5. Install the project in editable mode:

    # Install the minimum requirements
    python -m pip install -e .
    
    # Install the minimum + tests requirements
    python -m pip install -e .[tests]
    
    # Install the minimum + doc requirements
    python -m pip install -e .[doc]
    
    # Install all requirements
    python -m pip install -e .[tests,doc]

Install in offline mode

If you lack an internet connection on your installation machine, you should install PyAnsys Geometry by downloading the wheelhouse archive from the Releases page for your corresponding machine architecture.

Each wheelhouse archive contains all the Python wheels necessary to install PyAnsys Geometry from scratch on Windows, Linux, and MacOS from Python 3.8 to 3.11. You can install this on an isolated system with a fresh Python installation or on a virtual environment.

For example, on Linux with Python 3.8, unzip the wheelhouse archive and install it with:

unzip ansys-geometry-core-v0.3.3-wheelhouse-Linux-3.8.zip wheelhouse
pip install ansys-geometry-core -f wheelhouse --no-index --upgrade --ignore-installed

If you’re on Windows with Python 3.9, unzip to a wheelhouse directory and install using the preceding command.

Consider installing using a virtual environment.

Testing

This project takes advantage of tox. This tool automate common development tasks (similar to Makefile), but it is oriented towards Python development.

Using tox

While Makefile has rules, tox has environments. In fact, tox creates its own virtual environment so that anything being tested is isolated from the project to guarantee the project’s integrity.

The following environments commands are provided:

  • tox -e style: Checks for coding style quality.

  • tox -e py: Checks for unit tests.

  • tox -e py-coverage: Checks for unit testing and code coverage.

  • tox -e doc: Checks for documentation building process.

Raw testing

If required, from the command line, you can call style commands, including black, isort, and flake8, and unit testing commands like pytest. However, this does not guarantee that your project is being tested in an isolated environment, which is the reason why tools like tox exist.

Using pre-commit

The style checks take advantage of pre-commit. Developers are not forced but encouraged to install this tool with:

python -m pip install pre-commit && pre-commit install

Documentation

For building documentation, you can run the usual rules provided in the Sphinx Makefile, such as:

make -C doc/ html && your_browser_name doc/html/index.html

However, the recommended way of checking documentation integrity is to use tox:

tox -e doc && your_browser_name .tox/doc_out/index.html

Distributing

If you would like to create either source or wheel files, start by installing the building requirements and then executing the build module:

python -m pip install -U pip
python -m build
python -m twine check dist/*

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_geometry_core-0.3.3.tar.gz (119.1 kB view hashes)

Uploaded Source

Built Distribution

ansys_geometry_core-0.3.3-py3-none-any.whl (216.7 kB view hashes)

Uploaded Python 3

Supported by

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