[Python] how to find full delta using python deepdiff?

Discussão em 'Python' iniciado por Stack, Abril 14, 2025.

  1. Stack

    Stack Membro Participativo

    I wrote the following simple test:

    deeptest.py

    from deepdiff import DeepDiff, Delta

    dict1 = {'catalog': {'uuid': 'e95fb23c-57d2-495f-8ab5-2c6b3152bcee', 'metadata': {'title': 'Catalog', 'last-modified': '2025-04-10T16:00:34.033789-05:00', 'version': '1.0', 'oscal-version': '1.1.2'}, 'controls': [{'id': 'ac-1', 'title': 'Access Control', 'parts': [{'id': 'ac-1_stmt', 'name': 'statement', 'prose': 'Access control text.'}]}]}}
    dict2 = {}

    diff = DeepDiff(dict1, dict2)

    print(diff)

    delta = Delta(diff)

    print(f'delta {delta}')


    On the console I observe:

    $ python python/deep_test.py
    {'dictionary_item_removed': ["root['catalog']"]}
    delta <Delta: {"dictionary_item_removed":{"root['catalog']":{"uuid":""}}}>


    My question/issue is that the delta should be the entirety if dict1, but not all of it is shown...why?

    Continue reading...

Compartilhe esta Página