{"action":"created","issue":{"url":"https://api.github.com/repos/ClusterHQ/eliot/issues/66","labels_url":"https://api.github.com/repos/ClusterHQ/eliot/issues/66/labels{/name}","comments_url":"https://api.github.com/repos/ClusterHQ/eliot/issues/66/comments","events_url":"https://api.github.com/repos/ClusterHQ/eliot/issues/66/events","html_url":"https://github.com/ClusterHQ/eliot/issues/66","id":33000955,"number":66,"title":"More succinct Deferred-integration API","user":{"login":"itamarst","id":3266662,"avatar_url":"https://avatars.githubusercontent.com/u/3266662?v=3","gravatar_id":"","url":"https://api.github.com/users/itamarst","html_url":"https://github.com/itamarst","followers_url":"https://api.github.com/users/itamarst/followers","following_url":"https://api.github.com/users/itamarst/following{/other_user}","gists_url":"https://api.github.com/users/itamarst/gists{/gist_id}","starred_url":"https://api.github.com/users/itamarst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itamarst/subscriptions","organizations_url":"https://api.github.com/users/itamarst/orgs","repos_url":"https://api.github.com/users/itamarst/repos","events_url":"https://api.github.com/users/itamarst/events{/privacy}","received_events_url":"https://api.github.com/users/itamarst/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ClusterHQ/eliot/labels/API%20enhancement","name":"API enhancement","color":"0052cc"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2014-05-07T16:22:16Z","updated_at":"2015-12-23T16:42:22Z","closed_at":null,"body":"Jean-Paul Calderone suggests the following:\r\n\r\nHere are a couple other ideas.  The wrapper for creating `DeferredContext` could be a method of the thing returned by `MY_ACTION(logger).context()` so you could write `with MY_ACTION(logger).context() as logctx: d = logctx.deferred(getDeferred())` and avoid the extra import and the extra public class object.  And maybe this would also let the action track the Deferreds associated with it and automatically add finish callbacks to them when the context block is exited.  (If that makes sense... it would be convenient but maybe you don't always want it?)\r\n"},"comment":{"url":"https://api.github.com/repos/ClusterHQ/eliot/issues/comments/166940505","html_url":"https://github.com/ClusterHQ/eliot/issues/66#issuecomment-166940505","issue_url":"https://api.github.com/repos/ClusterHQ/eliot/issues/66","id":166940505,"user":{"login":"itamarst","id":3266662,"avatar_url":"https://avatars.githubusercontent.com/u/3266662?v=3","gravatar_id":"","url":"https://api.github.com/users/itamarst","html_url":"https://github.com/itamarst","followers_url":"https://api.github.com/users/itamarst/followers","following_url":"https://api.github.com/users/itamarst/following{/other_user}","gists_url":"https://api.github.com/users/itamarst/gists{/gist_id}","starred_url":"https://api.github.com/users/itamarst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itamarst/subscriptions","organizations_url":"https://api.github.com/users/itamarst/orgs","repos_url":"https://api.github.com/users/itamarst/repos","events_url":"https://api.github.com/users/itamarst/events{/privacy}","received_events_url":"https://api.github.com/users/itamarst/received_events","type":"User","site_admin":false},"created_at":"2015-12-23T16:42:22Z","updated_at":"2015-12-23T16:42:22Z","body":"Another option, with still an extra import but doesn't leak Twisted stuff in go general API:\r\n\r\n```\r\nwith DeferredContext.fromAction(MY_ACTION(key=foo), getDeferred, arg) as d:\r\n    d.addCallback(f)\r\nd = d.result\r\n```"}}