{"id":5160,"library":"coola","title":"Coola: Object Equality Checker","description":"Coola is a Python library designed for robustly checking equality between two complex or nested Python objects. It provides a flexible mechanism to compare various data structures, going beyond Python's default `==` operator for deep and custom comparisons. The library is actively maintained with frequent minor releases, ensuring ongoing development and improvements.","status":"active","version":"1.1.3","language":"en","source_language":"en","source_url":"https://github.com/durandtibo/coola","tags":["equality","comparison","nested objects","deep comparison","testing","utility"],"install":[{"cmd":"pip install coola","lang":"bash","label":"Default Install"}],"dependencies":[{"reason":"Runtime environment","package":"python","version":">=3.10"}],"imports":[{"symbol":"objects_are_equal","correct":"from coola.equality import objects_are_equal"}],"quickstart":{"code":"from coola.equality import objects_are_equal\n\nobj1 = {'a': 1, 'b': [2, {'c': 3}], 'd': {'e': 4}}\nobj2 = {'d': {'e': 4}, 'b': [2, {'c': 3}], 'a': 1}\nobj3 = {'a': 1, 'b': [2, {'c': 99}], 'd': {'e': 4}}\n\n# Deep comparison of two equal nested objects (order-independent for dicts)\nprint(f\"obj1 == obj2: {objects_are_equal(obj1, obj2)}\")\n\n# Deep comparison of two different nested objects\nprint(f\"obj1 == obj3: {objects_are_equal(obj1, obj3)}\")\n\n# Comparison with a custom tolerance for floats (example for potential feature)\nfloat_obj1 = {'x': 1.000000001}\nfloat_obj2 = {'x': 1.000000002}\n# For demonstration, assume a tolerance parameter, actual API might vary\n# print(f\"float_obj1 == float_obj2 with tolerance: {objects_are_equal(float_obj1, float_obj2, atol=1e-8)}\")\n","lang":"python","description":"This quickstart demonstrates how to use `objects_are_equal` to perform deep comparisons on nested dictionaries and lists. It shows both identical and differing structures, highlighting the library's ability to handle complex objects."},"warnings":[{"fix":"Review and update import paths for functionalities previously located in `coola.utils.imports` according to the new package structure. Refer to the official documentation for the updated paths.","message":"In version 1.1.0, the `coola.utils.imports` module was converted into a package, leading to a reorganization of its functions into different modules. Code that directly imports from or patches `coola.utils.imports` will break.","severity":"breaking","affected_versions":">=1.1.0"},{"fix":"Carefully review the release notes for version 1.0.0 and subsequent releases. Update code to align with the new API consistency, especially for function names and parameter signatures.","message":"Version 1.0.0 introduced significant API alignment across all functionalities. While aiming for consistency, this release may contain breaking changes for users upgrading from pre-1.0.0 versions, particularly regarding naming conventions and usage patterns.","severity":"breaking","affected_versions":">=1.0.0 (from pre-1.0.0)"},{"fix":"Consult the `coola` documentation for functions that support approximate comparisons (e.g., with `atol` or `rtol` arguments) when dealing with floating-point numbers, especially in numerical or scientific applications.","message":"When comparing floating-point numbers in nested structures, direct equality checks can fail due to precision issues. While `coola` offers advanced comparison, ensure you configure appropriate tolerances (e.g., `atol` or `rtol` parameters if available in the specific comparison function) for floats to avoid unexpected `False` results.","severity":"gotcha","affected_versions":"All"},{"fix":"For custom objects, either implement robust `__eq__` and `__hash__` methods or explore `coola`'s features for registering custom comparison functions or strategies for specific types, if supported.","message":"By default, `coola` might perform strict type and value comparisons. For custom classes or objects with complex internal states, you might need to register custom comparison logic or ensure your `__eq__` and `__hash__` methods are correctly implemented for `coola` to interpret equality as intended.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}