This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Take 2 sets of containers and provide a (deep) delta between them

This module is used by the author to diff yaml files and on disk file trees and best work out how to transition from one state to another (mainly for work with containers).

Note: Requires Python 3.3 or greater due to use of ‘yield from

How?

Objdiff uses difflib built into python for lists and tuples (basically sorted things) and implements its own comparison code for dictionaries. User types are detected via the collections.abc.Mapping type and instance comparison and are treated as dictionaries (ie unsorted item => value mappings)

What does this look like?

>>> import objdiff
>>> a = {'a': 1, 'b':[1,2,3], 'c':None}
>>> b = {'a': 1, 'b':[1,4], 'c':'hello'}
>>> objdiff.obj_diff(a, b)
<generator object obj_diff at 0xb6a3da80>

We return an iterator and make use of yield from so you can process large trees of objects efficiently and incremental

>>> from pprint import pprint
>>> pprint(list(objdiff.obj_diff(a, b)))
[modified(path=['c'], old=None, new='hello'),
 modified(path=['b'], old=[1, 2, 3], new=[1, 4]),
 equal(path=['a'], old=1, new=1)]

Expanding out the generator we get back a bunch of tuples containing the command value, key path, before and after value

>>> c = {'a':{1: None, 2: 2, 3: 3}, 'b': None}
>>> d = {'a':{1: 1, 2: 2}, 'b': {'1':{}, '2':{'2':2}}}
>>> pprint(list(objdiff.obj_diff(c, d)))
[modified(path=['b'], old=None, new={'1': {}, '2': {'2': 2}}),
 modified(path=['a', 1], old=None, new=1),
 equal(path=['a', 2], old=2, new=2),
 deleted(path=['a', 3], val=3)]

Note: in the above how you get a full list of keys to the destined object after the command value.

In total there are 4 types of command, as listed below with one internal type that can be ignored.

  • added
  • deleted
  • modified
  • equal (internal, scalar values are equal)

More documentation can be found at Blitz works docs

Changelog

1.2.3 2016-08-26

  • Actually include module with release

1.2.2 2016-03-28

  • Split out CHANGELOG to seperate file
  • Add documentation
  • Add doctests
  • Protection against PYTHONHASHSEED randomisation for doctests
  • objdiff arg names where renamed to make relationship clearer

1.2.1 2016-03-26

  • Add ‘version guard’ to prevent install on python older than version 3.3

1.2 2016-03-26

  • Documentation updates
  • ‘deep_update’ function

1.1 2016-03-24

  • Cleanups of code
  • Documentation updates
  • More infrastructure in src module

1.0 2016-03-24

  • Initial release
  • Working objdiff
  • diffing of lists and dicts functions
Release History

Release History

1.2.3

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.2.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.2.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
objdiff-1.2.3-py2.py3-none-any.whl (7.5 kB) Copy SHA256 Checksum SHA256 3.5 Wheel Aug 15, 2016
objdiff-1.2.3.tar.bz2 (17.3 kB) Copy SHA256 Checksum SHA256 Source Aug 15, 2016
objdiff-1.2.3.zip (29.6 kB) Copy SHA256 Checksum SHA256 Source Aug 15, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting