Skip to main content

arrgh

A small python utility to pretty-print a table summarizing arrays/tensors/scalars from numpy, pytorch, etc.

Why the name? "arr" is short for "array", and "arrgh" is the sound you make while debugging your array shapes.

Example

Calling arrgh(my_arr1, my_arr2, ...) prints a table like:

       name | dtype         | shape         | type          | device | min         | max         | mean       
--------------------------------------------------------------------------------------------------------------
     [None] | None          | N/A           | NoneType      |        | N/A         | N/A         | N/A        
    intval1 | int           | scalar        | int           |        |      7      |      7      |      7     
    intval2 | int           | scalar        | int           |        |     -3      |     -3      |     -3     
  floatval0 | float         | scalar        | float         |        |     42      |     42      |     42     
  floatval1 | float         | scalar        | float         |        | 5.5e-12     | 5.5e-12     | 5.5e-12    
  floatval2 | float         | scalar        | float         |        | 7.72324e+44 | 7.72324e+44 | 7.72324e+44
     npval1 | int64         | [100]         | numpy.ndarray |        |      0      |     99      |   49.5     
     npval2 | int64         | [10000]       | numpy.ndarray |        |      0      |   9999      | 4999.5     
     npval3 | uint64        | [10000]       | numpy.ndarray |        |      0      |   9999      | 4999.5     
     npval4 | float32       | [100, 10, 10] | numpy.ndarray |        |      0      |   9999      | 4999.5     
[temporary] | float32       | [10, 8]       | numpy.ndarray |        |      2      |     99      |   50.5     
     npval5 | int64         | []            | numpy.int64   |        |   9999      |   9999      |   9999     
  torchval1 | torch.float32 | [1000, 12, 3] | torch.Tensor  | cpu    | -4.08445    | 3.90982     | 0.00404567 
  torchval2 | torch.float32 | [1000, 12, 3] | torch.Tensor  | cuda:0 | -3.87309    | 3.90342     | 0.00339224 
  torchval3 | torch.int64   | [1000]        | torch.Tensor  | cpu    |      0      |    999      | N/A        
  torchval4 | torch.int64   | []            | torch.Tensor  | cpu    |      0      |      0      | N/A

Installation

pip install arrgh

from arrgh import arrgh

Docs

The package exposes a single function called arrgh(). Call it like: arrgh(my_arr, some_other_arr, maybe_a_scalar).

The function accepts a variable number of arguments. Arrays can also be passed as named optional arguments.

Inputs can be:

  • Numpy tensor arrays
  • Pytorch tensor arrays
  • Jax tensor arrays
  • Python ints / floats
  • None
  • It may also work with other array-like types, but they have not been tested.
  • Input values which are not arrays or numeric types (strings, objects, etc) will be printed as blank rows in the table.

When arrays are passed as variable arguments, the printed name of the array in the table is inferred from the variable name in the outer scope, when possible. When arrays are passed as named keyword arguments, the key name is used.

Pass an integer for the arrgh_float_width option to specify the precision to which floating point types are printed.

Author: Nicholas Sharp (nmwsharp.com)

Metadata

Release files for arrgh 1.0.0

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

Source distribution (sdist)

Source distribution for arrgh 1.0.0
File Size Uploaded Provenance
arrgh-1.0.0.tar.gz 4.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for arrgh 1.0.0
File Interpreter ABI Platform
arrgh-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.8 kB

Release files / arrgh-1.0.0.tar.gz

Download URL arrgh-1.0.0.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d5dd608184a4ebf9742e5b72a2418bca9dc52f9189caa0ec5c99188d687e0cd7
BLAKE2b-256 checksum
How to use checksums
d96e58751b087ac207324f00ce41dbd8acda3370a77feec56687afd11917796e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / arrgh-1.0.0-py3-none-any.whl

Download URL arrgh-1.0.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
05910d1815cfd1bdf8dfa15ec92e43fb4a74932c30386a8b7e5cdbcba428ad84
BLAKE2b-256 checksum
How to use checksums
bd9ec61a0cb4f5868b1025346714da09a36aa04aa5aa34c07d51abc683084e8e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Security for arrgh 1.0.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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