coola

Python library to check if two complex/nested objects are equal or not.

https://github.com/durandtibo/coola

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.4%) to scientific vocabulary

Keywords

equality nested-objects python
Last synced: 6 months ago · JSON representation ·

Repository

Python library to check if two complex/nested objects are equal or not.

Basic Info
Statistics
  • Stars: 1
  • Watchers: 3
  • Forks: 2
  • Open Issues: 2
  • Releases: 55
Topics
equality nested-objects python
Created about 3 years ago · Last pushed 6 months ago
Metadata Files
Readme Contributing License Code of conduct Citation Codeowners

README.md

coola

CI Nightly Tests Nightly Package Tests Codecov
Documentation Documentation
Code style: black Doc style: google Ruff Doc style: google
PYPI version Python BSD-3-Clause
Downloads Monthly downloads

Overview

coola is a Python library that provides simple functions to check in a single line if two complex/nested objects are equal or not. coola 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 check if the two dictionaries are equal or not. By default, Python does not provide an easy way to check if the two dictionaries are equal or not. It is not possible to use the default equality operator == because it will raise an error. The coola library was developed to fill this gap. coola provides a function objects_are_equal that can indicate if two complex/nested objects are equal or not.

```pycon

import numpy import torch from coola import objectsareequal data1 = {"torch": torch.ones(2, 3), "numpy": numpy.zeros((2, 3))} data2 = {"torch": torch.zeros(2, 3), "numpy": numpy.ones((2, 3))} objectsareequal(data1, data2) False

```

coola also provides a function objects_are_allclose that can indicate if two complex/nested objects are equal within a tolerance or not.

```pycon

import numpy import torch from coola import objectsareallclose data1 = {"torch": torch.ones(2, 3), "numpy": numpy.zeros((2, 3))} data2 = {"torch": torch.zeros(2, 3), "numpy": numpy.ones((2, 3))} objectsareallclose(data1, data2, atol=1e-6) False

```

coola supports the following types:

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

Documentation

  • latest (stable): documentation from the latest stable release.
  • main (unstable): documentation associated to the main branch of the repo. This documentation may contain a lot of work-in-progress/outdated/missing parts.

Installation

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

shell pip install coola

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

shell pip install coola[all]

Please check the get started page to see how to install only some specific dependencies or other alternatives to install the library. The following is the corresponding coola versions and tested dependencies.

| coola | jax | numpy | packaging | pandas | polars | pyarrow | torch | xarray | python | |---------|-------------------|---------------------|-------------------------|----------------------|----------------------|-----------------------|---------------------|----------------------|---------------| | main | >=0.4.1,<1.0 | >=1.24,<3.0 | >=22.0,<26.0 | >=2.0,<3.0 | >=1.0,<2.0 | >=11.0,<20.0 | >=2.0,<3.0 | >=2023.1 | >=3.9,<3.14 | | 0.9.0 | >=0.4.1,<1.0 | >=1.24,<3.0 | >=22.0,<26.0 | >=2.0,<3.0 | >=1.0,<2.0 | >=11.0,<20.0 | >=2.0,<3.0 | >=2023.1 | >=3.9,<3.14 | | 0.8.7 | >=0.4.1,<1.0 | >=1.22,<3.0 | >=21.0,<26.0 | >=1.5,<3.0 | >=1.0,<2.0 | >=10.0,<20.0 | >=1.11,<3.0 | >=2023.1 | >=3.9,<3.14 | | 0.8.6 | >=0.4.1,<1.0 | >=1.21,<3.0 | | >=1.3,<3.0 | >=0.18.3,<2.0 | >=10.0,<20.0 | >=1.11,<3.0 | >=2023.1 | >=3.9,<3.14 | | 0.8.5 | >=0.4.1,<1.0 | >=1.21,<3.0 | | >=1.3,<3.0 | >=0.18.3,<2.0 | >=10.0,<19.0 | >=1.11,<3.0 | >=2023.1 | >=3.9,<3.14 | | 0.8.4 | >=0.4.1,<1.0 | >=1.21,<3.0 | | >=1.3,<3.0 | >=0.18.3,<2.0 | >=10.0,<18.0 | >=1.11,<3.0 | >=2023.1 | >=3.9,<3.14 | | 0.8.3 | >=0.4.1,<1.0 | >=1.21,<3.0 | | >=1.3,<3.0 | >=0.18.3,<2.0 | >=10.0,<18.0 | >=1.11,<3.0 | >=2023.1 | >=3.9,<3.13 | | 0.8.2 | >=0.4.1,<1.0 | >=1.21,<3.0 | | >=1.3,<3.0 | >=0.18.3,<2.0 | >=10.0,<18.0 | >=1.11,<3.0 | >=2023.1 | >=3.9,<3.13 | | 0.8.1 | >=0.4.1,<1.0 | >=1.21,<3.0 | | >=1.3,<3.0 | >=0.18.3,<2.0 | >=10.0,<18.0 | >=1.11,<3.0 | >=2023.1 | >=3.9,<3.13 | | 0.8.0 | >=0.4.1,<1.0 | >=1.21,<3.0 | | >=1.3,<3.0 | >=0.18.3,<2.0 | >=10.0,<18.0 | >=1.11,<3.0 | >=2023.1 | >=3.9,<3.13 |

* indicates an optional dependency

older versions | `coola` | `jax`* | `numpy`* | `pandas`* | `polars`* | `pyarrow`* | `torch`* | `xarray`* | `python` | |----------|-------------------|---------------------|----------------------|----------------------|-----------------------|---------------------|----------------------|---------------| | `0.7.4` | `>=0.4.1,<1.0` | `>=1.21,<3.0` | `>=1.3,<3.0` | `>=0.18.3,<2.0` | `>=10.0,<18.0` | `>=1.11,<3.0` | `>=2023.1` | `>=3.9,<3.13` | | `0.7.3` | `>=0.4.1,<1.0` | `>=1.21,<3.0` | `>=1.3,<3.0` | `>=0.18.3,<2.0` | | `>=1.11,<3.0` | `>=2023.1` | `>=3.9,<3.13` | | `0.7.2` | `>=0.4.1,<1.0` | `>=1.21,<3.0` | `>=1.3,<3.0` | `>=0.18.3,<2.0` | | `>=1.11,<3.0` | `>=2023.1` | `>=3.9,<3.13` | | `0.7.1` | `>=0.4.1,<1.0` | `>=1.21,<3.0` | `>=1.3,<3.0` | `>=0.18.3,<1.0` | | `>=1.10,<3.0` | `>=2023.1` | `>=3.9,<3.13` | | `0.7.0` | `>=0.4.1,<1.0` | `>=1.21,<2.0` | `>=1.3,<3.0` | `>=0.18.3,<1.0` | | `>=1.10,<3.0` | `>=2023.1` | `>=3.9,<3.13` | | `0.6.2` | `>=0.4.1,<1.0` | `>=1.21,<2.0` | `>=1.3,<3.0` | `>=0.18.3,<1.0` | | `>=1.10,<3.0` | `>=2023.1` | `>=3.9,<3.13` | | `0.6.1` | `>=0.4.1,<1.0` | `>=1.21,<2.0` | `>=1.3,<3.0` | `>=0.18.3,<1.0` | | `>=1.10,<3.0` | `>=2023.1` | `>=3.9,<3.13` | | `0.6.0` | `>=0.4.1,<1.0` | `>=1.21,<2.0` | `>=1.3,<3.0` | `>=0.18.3,<1.0` | | `>=1.10,<3.0` | `>=2023.1` | `>=3.9,<3.13` | | `0.5.0` | `>=0.4.1,<0.5` | `>=1.21,<1.27` | `>=1.3,<2.2` | `>=0.18.3,<1.0` | | `>=1.10,<2.2` | `>=2023.1,<2023.13` | `>=3.9,<3.13` | | `0.4.0` | `>=0.4.1,<0.5` | `>=1.21,<1.27` | `>=1.3,<2.2` | `>=0.18.3,<1.0` | | `>=1.10,<2.2` | `>=2023.1,<2023.13` | `>=3.9,<3.13` | | `0.3.1` | `>=0.4.1,<0.5` | `>=1.21,<1.27` | `>=1.3,<2.2` | `>=0.18.3,<1.0` | | `>=1.10,<2.2` | `>=2023.1,<2023.13` | `>=3.9,<3.13` | | `0.3.0` | `>=0.4.1,<0.5` | `>=1.21,<1.27` | `>=1.3,<2.2` | `>=0.18.3,<1.0` | | `>=1.10,<2.2` | `>=2023.1,<2023.13` | `>=3.9,<3.13` | | `0.2.2` | `>=0.4.1,<0.5` | `>=1.21,<1.27` | `>=1.3,<2.2` | `>=0.18.3,<1.0` | | `>=1.10,<2.2` | `>=2023.1,<2023.13` | `>=3.9,<3.13` | | `0.2.1` | `>=0.4.1,<0.5` | `>=1.21,<1.27` | `>=1.3,<2.2` | `>=0.18.3,<1.0` | | `>=1.10,<2.2` | `>=2023.1,<2023.13` | `>=3.9,<3.13` | | `0.2.0` | `>=0.4.1,<0.5` | `>=1.21,<1.27` | `>=1.3,<2.2` | `>=0.18.3,<1.0` | | `>=1.10,<2.2` | `>=2023.1,<2023.13` | `>=3.9,<3.13` | | `0.1.2` | `>=0.4.1,<0.5` | `>=1.21,<1.27` | `>=1.3,<2.2` | `>=0.18.3,<0.21` | | `>=1.10,<2.2` | `>=2023.1,<2023.13` | `>=3.9,<3.13` | | `0.1.1` | `>=0.4.1,<0.5` | `>=1.21,<1.27` | `>=1.3,<2.2` | `>=0.18.3,<0.20` | | `>=1.10,<2.2` | `>=2023.1,<2023.13` | `>=3.9,<3.13` | | `0.1.0` | `>=0.4.1,<0.5` | `>=1.21,<1.27` | `>=1.3,<2.2` | `>=0.18.3,<0.20` | | `>=1.10,<2.2` | `>=2023.1,<2023.13` | `>=3.9,<3.12` | | `0.0.26` | `>=0.4.1,<0.5` | `>=1.21,<1.27` | `>=1.3,<2.2` | `>=0.18.3,<0.20` | | `>=1.10,<2.2` | `>=2023.1,<2023.13` | `>=3.9,<3.12` | | `0.0.25` | `>=0.4.1,<0.5` | `>=1.21,<1.27` | `>=1.3,<2.2` | `>=0.18.3,<0.20` | | `>=1.10,<2.2` | `>=2023.4,<2023.11` | `>=3.9,<3.12` | | `0.0.24` | `>=0.3,<0.5` | `>=1.21,<1.27` | `>=1.3,<2.2` | `>=0.18.3,<0.20` | | `>=1.10,<2.2` | `>=2023.3,<2023.9` | `>=3.9,<3.12` | | `0.0.23` | `>=0.3,<0.5` | `>=1.21,<1.27` | `>=1.3,<2.2` | `>=0.18.3,<0.20` | | `>=1.10,<2.1` | `>=2023.3,<2023.9` | `>=3.9,<3.12` | | `0.0.22` | `>=0.3,<0.5` | `>=1.20,<1.26` | `>=1.3,<2.1` | `>=0.18.3,<0.19` | | `>=1.10,<2.1` | `>=2023.3,<2023.9` | `>=3.9,<3.12` | | `0.0.21` | `>=0.3,<0.5` | `>=1.20,<1.26` | `>=1.3,<2.1` | `>=0.18.3,<0.19` | | `>=1.10,<2.1` | `>=2023.3,<2023.8` | `>=3.9,<3.12` | | `0.0.20` | `>=0.3,<0.5` | `>=1.20,<1.26` | `>=1.3,<2.1` | `>=0.18.3,<0.19` | | `>=1.10,<2.1` | `>=2023.3,<2023.8` | `>=3.9` |

Contributing

Please check the instructions in CONTRIBUTING.md.

Suggestions and Communication

Everyone is welcome to contribute to the community. If you have any questions or suggestions, you can submit Github Issues. We will reply to you as soon as possible. Thank you very much.

API stability

:warning: While coola 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 coola to a new version will possibly break any code that was using the old version of coola.

License

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

Owner

  • Name: Thibaut Durand
  • Login: durandtibo
  • Kind: user
  • Location: Vancouver, Canada
  • Company: Borealis AI

Researcher in Computer Vision and Machine Learning. This profile is used for personal projects/contributions

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this library, please cite it as below."
authors:
- family-names: "Durand"
  given-names: "Thibaut"

title: "COOLA: A Python library to check if two complex/nested objects are equal or not."
date-released: 2023-01-01
url: "https://github.com/durandtibo/coola"

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 23
  • Total pull requests: 1,284
  • Average time to close issues: 4 days
  • Average time to close pull requests: 1 day
  • Total issue authors: 2
  • Total pull request authors: 3
  • Average comments per issue: 0.3
  • Average comments per pull request: 1.03
  • Merged pull requests: 1,149
  • Bot issues: 2
  • Bot pull requests: 547
Past Year
  • Issues: 4
  • Pull requests: 362
  • Average time to close issues: 5 days
  • Average time to close pull requests: 2 days
  • Issue authors: 2
  • Pull request authors: 3
  • Average comments per issue: 1.0
  • Average comments per pull request: 1.07
  • Merged pull requests: 315
  • Bot issues: 2
  • Bot pull requests: 276
Top Authors
Issue Authors
  • durandtibo (21)
  • dependabot[bot] (2)
Pull Request Authors
  • durandtibo (737)
  • dependabot[bot] (491)
  • github-actions[bot] (56)
Top Labels
Issue Labels
enhancement (8) documentation (2) dependencies (2) python (2)
Pull Request Labels
dependencies (491) python (409) github_actions (18) enhancement (6) documentation (2)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 528,133 last-month
  • Total dependent packages: 13
  • Total dependent repositories: 3
  • Total versions: 70
  • Total maintainers: 1
pypi.org: coola

Library to check equality between two complex/nested objects

  • Versions: 70
  • Dependent Packages: 13
  • Dependent Repositories: 3
  • Downloads: 528,133 Last month
Rankings
Dependent packages count: 1.0%
Downloads: 1.1%
Dependent repos count: 8.9%
Average: 13.1%
Forks count: 22.6%
Stargazers count: 31.9%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/ci.yaml actions
.github/workflows/coverage.yaml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • codecov/codecov-action v3 composite
  • paambaati/codeclimate-action v5.0.0 composite
  • snok/install-poetry v1 composite
.github/workflows/cyclic-imports.yaml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • snok/install-poetry v1 composite
.github/workflows/dependency-review.yml actions
  • actions/checkout v3 composite
  • actions/dependency-review-action v2 composite
.github/workflows/docs.yaml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • snok/install-poetry v1 composite
.github/workflows/doctest.yaml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • snok/install-poetry v1 composite
.github/workflows/format.yaml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • snok/install-poetry v1 composite
.github/workflows/nightly-package.yaml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
.github/workflows/nightly-tests.yaml actions
.github/workflows/pypi.yaml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • snok/install-poetry v1 composite
.github/workflows/test-deps.yaml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • snok/install-poetry v1 composite
.github/workflows/test.yaml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • snok/install-poetry v1 composite
environment.yaml pypi
poetry.lock pypi
  • astroid 2.15.6
  • babel 2.12.1
  • black 23.9.1
  • certifi 2023.7.22
  • cfgv 3.4.0
  • charset-normalizer 3.2.0
  • click 8.1.7
  • colorama 0.4.6
  • coverage 7.3.1
  • dill 0.3.7
  • distlib 0.3.7
  • docformatter 1.7.5
  • exceptiongroup 1.1.3
  • filelock 3.12.4
  • ghp-import 2.1.0
  • identify 2.5.29
  • idna 3.4
  • importlib-metadata 6.8.0
  • iniconfig 2.0.0
  • isort 5.12.0
  • jax 0.4.14
  • jaxlib 0.4.14
  • jinja2 3.1.2
  • lazy-object-proxy 1.9.0
  • markdown 3.4.4
  • markupsafe 2.1.3
  • mccabe 0.7.0
  • mergedeep 1.3.4
  • mkdocs 1.5.2
  • mkdocs-autorefs 0.5.0
  • mkdocs-material 9.3.1
  • mkdocs-material-extensions 1.1.1
  • mkdocstrings 0.23.0
  • ml-dtypes 0.2.0
  • mpmath 1.3.0
  • mypy-extensions 1.0.0
  • networkx 3.1
  • nodeenv 1.8.0
  • numpy 1.26.0
  • opt-einsum 3.3.0
  • packaging 23.1
  • paginate 0.5.6
  • pandas 2.1.1
  • pathspec 0.11.2
  • platformdirs 3.10.0
  • pluggy 1.3.0
  • polars 0.19.3
  • pre-commit 3.4.0
  • pygments 2.16.1
  • pylint 2.17.5
  • pymdown-extensions 10.3
  • pytest 7.4.2
  • pytest-cov 4.1.0
  • pytest-timeout 2.1.0
  • python-dateutil 2.8.2
  • pytz 2023.3.post1
  • pyyaml 6.0.1
  • pyyaml-env-tag 0.1
  • regex 2023.8.8
  • requests 2.31.0
  • ruff 0.0.290
  • scipy 1.11.2
  • setuptools 68.2.2
  • six 1.16.0
  • sympy 1.12
  • tomli 2.0.1
  • tomlkit 0.12.1
  • torch 2.0.1
  • typing-extensions 4.8.0
  • tzdata 2023.3
  • untokenize 0.1.1
  • urllib3 2.0.6
  • virtualenv 20.24.5
  • watchdog 3.0.0
  • wrapt 1.15.0
  • xarray 2023.8.0
  • xdoctest 1.1.1
  • zipp 3.17.0
pyproject.toml pypi
  • jax >=0.3.0,<0.5
  • jaxlib >=0.3
  • numpy >=1.21,<1.27
  • pandas >=1.3,<2.2
  • polars >=0.18.3,<0.20
  • python >=3.9,<3.12
  • torch >=1.10,<2.1
  • xarray >=2023.3,<2023.9