Hollerith#

PyAnsys Python PyPI GH-CI MIT Black

Hollerith is a small python library that supports fixed-width formatting of some value types and tables. It is named after Herman Hollerith, the inventor of punch cards.

Install the package#

Install in user mode#

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

python -m pip install -U pip

Then, install hollerith with:

pip install hollerith

Install in developer mode#

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

Note

Before contributing to the project, ensure that you are thoroughly familiar with the PyAnsys Developer’s Guide.

To install hollerith in developer mode, perform these steps:

git clone https://github.com/pyansys/hollerith
cd hollerith
pip install .

Install in offline mode#

If you lack an internet connection on your installation machine, you should install hollerith 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 hollerith from scratch on Windows, Linux, and MacOS from Python 3.8 to 3.11.

Documentation#

In addition to installation information, the hollerith documentation provides information on API reference.

Usage#

Example:

>>> import io
>>> import hollerith as holler
>>> s = io.StringIO()
>>> holler.write_float(s, 1.2099, 10)
>>> holler.write_int(s, 2803, 10)
>>> holler.write_float(s, float("nan"), 10)
>>> holler.write_int(s, 0, 10)
>>> s.getvalue()
'    1.2099      2803                   0'

License#

hollerith is licensed under the MIT license. The full license can be found in the root directory of the repository, see LICENSE.

Code Examples#

Here’s a quick preview for how Python code looks using hollerith.

Rendered Python Code#

>>> import io
>>> import hollerith as holler
>>> s = io.StringIO()
>>> holler.write_float(s, 1.2099, 10)
>>> holler.write_int(s, 2803, 10)
>>> holler.write_float(s, float("nan"), 10)
>>> holler.write_int(s, 0, 10)
>>> s.getvalue()
'    1.2099      2803                   0'

API Reference#

To see a full API reference, see API Reference