Package: coola
coolaOverviewcoolais a Python library that provides simple functions to check in a single line if two
complex/nested objects are equal or not.coolawas initially designed to work
withPyTorchTensorsandNumPyndarray, but it
is possible to extend it
tosupport other data structures.MotivationDocumentationInstallationContributingAPI stabilityLicenseMotivationLet's imagine you have the following dictionaries that contain both a PyTorchTensorand a
NumPyndarray.
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.
Thecoolalibrary was developed to fill this gap.coolaprovides a functionobjects_are_equalthat can indicate if two complex/nested objects are equal or not.>>>importnumpy>>>importtorch>>>fromcoolaimportobjects_are_equal>>>data1={"torch":torch.ones(2,3),"numpy":numpy.zeros((2,3))}>>>data2={"torch":torch.zeros(2,3),"numpy":numpy.ones((2,3))}>>>objects_are_equal(data1,data2)Falsecoolaalso provides a functionobjects_are_allclosethat can indicate if two complex/nested
objects are equal within a tolerance or not.>>>importnumpy>>>importtorch>>>fromcoolaimportobjects_are_allclose>>>data1={"torch":torch.ones(2,3),"numpy":numpy.zeros((2,3))}>>>data2={"torch":torch.zeros(2,3),"numpy":numpy.ones((2,3))}>>>objects_are_allclose(data1,data2,atol=1e-6)FalseThe current supported types are:jax.numpy.ndarraynumpy.ndarraynumpy.ma.MaskedArraypandas.DataFramepandas.Seriespolars.DataFramepolars.Seriestorch.Tensortorch.nn.utils.rnn.PackedSequencexarray.DataArrayxarray.Datasetxarray.VariablePlease check thequickstart pageto learn more on
how to usecoola.Documentationlatest (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.InstallationWe highly recommend installing
avirtual environment.coolacan be installed from pip using the following command:pipinstallcoolaTo make the package as slim as possible, only the minimal packages required to usecoolaare
installed.
To include all the dependencies, you can use the following command:pipinstallcoola[all]Please check theget started pageto see how to
install only some specific dependencies or other alternatives to install the library.
The following is the correspondingcoolaversions and tested dependencies.coolajax*numpy*pandas*polars*torch*xarray*pythonmain>=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.130.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.130.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.130.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.130.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.130.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.130.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.130.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.130.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*indicates an optional dependencyolder versionscoolajax*numpy*pandas*polars*torch*xarray*python0.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.120.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.120.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.120.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.120.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.120.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.120.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.9ContributingPlease check the instructions inCONTRIBUTING.md.Suggestions and CommunicationEveryone is welcome to contribute to the community.
If you have any questions or suggestions, you can
submitGithub Issues.
We will reply to you as soon as possible. Thank you very much.API stability:warning: Whilecoolais 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 upgradingcoolato a new version will possibly break any code that
was using the old version ofcoola.Licensecoolais licensed under BSD 3-Clause "New" or "Revised" license available inLICENSEfile.