plotly/python-api — pull request #11 by theengineear (2014-04-01 09:58:34+00:00)
Title: Added graph_objs.py module and supporting files.

The classes in `graph_obj.py` are intended to be both user-friendly and
functional.

These are the main goals of this revision:

* Make the docstrings helpful when a user runs `help(obj)`. The docstrings
will immediately list what the valid `key` names are and what the valid
data types for the `values` associated with each `key` are.

* Allow users and plotly to do validation on keys and data in JSON. By
running `obj.check()`, the object itself will raise an exception (could
be changed to a warning later...) if it finds invalid keys. Later, this
should be updated to include some type-checking where necessary and give
warnings when pieces of the JSON structure are unusable for plotly.

* Give users a simple interface to JSON structure. These objects are
basically just the standard `list` and `dict` objects that any Python
user will be quite familiar with. Therefore, it will not create a new
barrier by requiring new syntax for users. In fact, we should attempt to
make it allowable to interact with these objects as if they *were*
simply `dict` and `list` objects, including instantiation where
possible.

* Remain as simple as possible!!!

* Enforce good code documentation. When keys change in plotly, an
exception will be raised because of the new key in the check method, an
exception will be raised if there is not an associated `type`, and an
exception will be raised if there is not an associated `description`.