Skip to main content

A library to get a text summary of nested objects

Reason this release was yanked:

use pip install coola for a better implementation

Project description

arctix

CI CI Codecov
PYPI version Python BSD-3-Clause Code style: black Doc style: google
Downloads Monthly downloads

Overview

arctix is a Python library that provides simple functions to check in a single line if two complex/nested objects are equal or not. arctix was initially designed to work with PyTorch Tensors and NumPy ndarray, but it is possible to extend it to support other data structures.

Motivation

Let's imagine you have the following dictionaries that contain both a PyTorch Tensor and a NumPy ndarray. You want to compute a string representation of it. By default, Python tries to show the values of all the tensor/array. The arctix library was developed to easily compute structured string representation of nested objects. arctix provides a function summary that can indicate if two complex/nested objects are equal or not.

>>> import numpy
>>> import torch
>>> from arctix import summary
>>> print(summary({"torch": torch.ones(2, 3), "numpy": numpy.zeros((2, 3))}))
<class 'dict'> (length=2)
  (torch): <class 'torch.Tensor'> | shape=torch.Size([2, 3]) | dtype=torch.float32 | device=cpu
  (numpy): <class 'numpy.ndarray'> | shape=(2, 3) | dtype=float64
>>> print(
...     summary(
...         {
...             "torch": [torch.ones(2, 3), torch.zeros(6)],
...             "numpy": numpy.zeros((2, 3)),
...             "other": [42, 4.2, "abc"],
...         },
...         max_depth=3,
...     )
... )
<class 'dict'> (length=3)
  (torch): <class 'list'> (length=2)
      (0): <class 'torch.Tensor'> | shape=torch.Size([2, 3]) | dtype=torch.float32 | device=cpu
      (1): <class 'torch.Tensor'> | shape=torch.Size([6]) | dtype=torch.float32 | device=cpu
  (numpy): <class 'numpy.ndarray'> | shape=(2, 3) | dtype=float64
  (other): <class 'list'> (length=3)
      (0): <class 'int'> 42
      (1): <class 'float'> 4.2
      (2): <class 'str'> abc

Please check the quickstart page to learn more on how to use arctix.

Installation

We highly recommend installing a virtual environment. arctix can be installed from pip using the following command:

pip install arctix

To make the package as slim as possible, only the minimal packages required to use arctix are installed. To include all the packages, you can use the following command:

pip install arctix[all]

Please check the get started page to see how to install only some specific packages or other alternatives to install the library.

Contributing

Please check the instructions in CONTRIBUTING.md.

API stability

:warning: While arctix is in development stage, no API is guaranteed to be stable from one release to the next. In fact, it is very likely that the API will change multiple times before a stable 1.0.0 release. In practice, this means that upgrading arctix to a new version will possibly break any code that was using the old version of arctix.

License

arctix is licensed under BSD 3-Clause "New" or "Revised" license available in LICENSE file.

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

arctix-0.0.1.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

arctix-0.0.1-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file arctix-0.0.1.tar.gz.

File metadata

  • Download URL: arctix-0.0.1.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.12 Linux/5.15.0-1041-azure

File hashes

Hashes for arctix-0.0.1.tar.gz
Algorithm Hash digest
SHA256 21a82f152b87ad3880ff5249854bdeb3085d29980236d086d46ecce72416d37d
MD5 77517d8c68e9e1355b60be9fa0bb8d32
BLAKE2b-256 4a5ccad86ecff1d81b338ae4b47414795d78b44c30d700887acd511431ea5aa0

See more details on using hashes here.

File details

Details for the file arctix-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: arctix-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.12 Linux/5.15.0-1041-azure

File hashes

Hashes for arctix-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9436f54fa1a4dae752351f23ec0b166bc4c079ab950ea4e8d84de36fd78471f2
MD5 06582fc677ddbf44cb1ad1bda0b728ad
BLAKE2b-256 bf73f6f8ffc1e5a8b12a4ecdbdfe6ad34125b9efdfc05aa93bdbcdb014657fd3

See more details on using hashes here.

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