{"action":"created","issue":{"url":"https://api.github.com/repos/ellisonbg/altair/issues/93","repository_url":"https://api.github.com/repos/ellisonbg/altair","labels_url":"https://api.github.com/repos/ellisonbg/altair/issues/93/labels{/name}","comments_url":"https://api.github.com/repos/ellisonbg/altair/issues/93/comments","events_url":"https://api.github.com/repos/ellisonbg/altair/issues/93/events","html_url":"https://github.com/ellisonbg/altair/issues/93","id":155655084,"number":93,"title":"API: should ``Layer()`` not derive from ``BaseObject``?","user":{"login":"jakevdp","id":781659,"avatar_url":"https://avatars.githubusercontent.com/u/781659?v=3","gravatar_id":"","url":"https://api.github.com/users/jakevdp","html_url":"https://github.com/jakevdp","followers_url":"https://api.github.com/users/jakevdp/followers","following_url":"https://api.github.com/users/jakevdp/following{/other_user}","gists_url":"https://api.github.com/users/jakevdp/gists{/gist_id}","starred_url":"https://api.github.com/users/jakevdp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakevdp/subscriptions","organizations_url":"https://api.github.com/users/jakevdp/orgs","repos_url":"https://api.github.com/users/jakevdp/repos","events_url":"https://api.github.com/users/jakevdp/events{/privacy}","received_events_url":"https://api.github.com/users/jakevdp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":20,"created_at":"2016-05-19T05:08:10Z","updated_at":"2016-05-21T05:36:03Z","closed_at":null,"body":"Since ``Layer`` is the main interface, it would be nice if tab completion on the object only listed relevant pieces of the API so that you can quickly find what plot types are available (e.g. ``point()``, ``bar()``, ``text()``, etc.)\r\n\r\nCurrently, since it derives from ``BaseObject`` the namespace is polluted with all sorts of traitlet stuff that the user probably doesn't care about.\r\n\r\nI'd propose something like this:\r\n\r\n```python\r\nclass LayerObject(BaseObject):\r\n    # traitlet-related stuff goes here\r\n    def __init__(self, *args, **kwargs):\r\n        super(LayerObject, self).__init__(**kwargs)\r\n        \r\n    # etc.\r\n    \r\nclass Layer(object):\r\n    # non-traitlet-related Layer methods here\r\n    def __init__(self, *args, **kwargs):\r\n        if len(args)==1:\r\n            self.data = args[0]\r\n        self._layerobject = LayerObject(**kwargs)\r\n    \r\n    def point(self):\r\n        self.mark = 'point'\r\n        return self\r\n    \r\n    # etc.\r\n```\r\n\r\nThe only problem would be if we ever want to pass ``Layer`` to some other class this would complicate things. What do you think?"},"comment":{"url":"https://api.github.com/repos/ellisonbg/altair/issues/comments/220760049","html_url":"https://github.com/ellisonbg/altair/issues/93#issuecomment-220760049","issue_url":"https://api.github.com/repos/ellisonbg/altair/issues/93","id":220760049,"user":{"login":"jakevdp","id":781659,"avatar_url":"https://avatars.githubusercontent.com/u/781659?v=3","gravatar_id":"","url":"https://api.github.com/users/jakevdp","html_url":"https://github.com/jakevdp","followers_url":"https://api.github.com/users/jakevdp/followers","following_url":"https://api.github.com/users/jakevdp/following{/other_user}","gists_url":"https://api.github.com/users/jakevdp/gists{/gist_id}","starred_url":"https://api.github.com/users/jakevdp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakevdp/subscriptions","organizations_url":"https://api.github.com/users/jakevdp/orgs","repos_url":"https://api.github.com/users/jakevdp/repos","events_url":"https://api.github.com/users/jakevdp/events{/privacy}","received_events_url":"https://api.github.com/users/jakevdp/received_events","type":"User","site_admin":false},"created_at":"2016-05-21T05:36:03Z","updated_at":"2016-05-21T05:36:03Z","body":"If a Python version of Vega-lite is what you're after, why use Altair at all? You could define things as Python dictionaries, and use ``json.dumps`` directly."}}
{"actor":{"display_login":"jakevdp"}}