Skip to main content

A library to compute a string representation 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 to compute a string representation of complex/nested objects. 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.2a17.tar.gz (19.4 kB view details)

Uploaded Source

Built Distribution

arctix-0.0.2a17-py3-none-any.whl (26.9 kB view details)

Uploaded Python 3

File details

Details for the file arctix-0.0.2a17.tar.gz.

File metadata

  • Download URL: arctix-0.0.2a17.tar.gz
  • Upload date:
  • Size: 19.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.2a17.tar.gz
Algorithm Hash digest
SHA256 ee0bb7234438297310c1511ef0fed615f66f73c0b7039a55fa466af4fb2043bb
MD5 55afd2678b5e0efe6b7736e8c43808a3
BLAKE2b-256 d9a2bd40eff5b7effc9de9cbd731606ad5e05ac13b1b7d94b0ca08c4107d76f9

See more details on using hashes here.

File details

Details for the file arctix-0.0.2a17-py3-none-any.whl.

File metadata

  • Download URL: arctix-0.0.2a17-py3-none-any.whl
  • Upload date:
  • Size: 26.9 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.2a17-py3-none-any.whl
Algorithm Hash digest
SHA256 c439d3a4e2ff900da5b316429eff892bf61c843fe340afd05f628b37bafa415e
MD5 6eb234eb909f13211d31d79aa83eaa56
BLAKE2b-256 afb39a225df03a9d9e6978b22534b35de55d88bfc27158efe02e31892b92dc0a

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