{"action":"created","issue":{"url":"https://api.github.com/repos/deanishe/alfred-workflow/issues/55","labels_url":"https://api.github.com/repos/deanishe/alfred-workflow/issues/55/labels{/name}","comments_url":"https://api.github.com/repos/deanishe/alfred-workflow/issues/55/comments","events_url":"https://api.github.com/repos/deanishe/alfred-workflow/issues/55/events","html_url":"https://github.com/deanishe/alfred-workflow/issues/55","id":52612046,"number":55,"title":"The big V2 refactoring and API thread","user":{"login":"deanishe","id":747913,"avatar_url":"https://avatars.githubusercontent.com/u/747913?v=3","gravatar_id":"","url":"https://api.github.com/users/deanishe","html_url":"https://github.com/deanishe","followers_url":"https://api.github.com/users/deanishe/followers","following_url":"https://api.github.com/users/deanishe/following{/other_user}","gists_url":"https://api.github.com/users/deanishe/gists{/gist_id}","starred_url":"https://api.github.com/users/deanishe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deanishe/subscriptions","organizations_url":"https://api.github.com/users/deanishe/orgs","repos_url":"https://api.github.com/users/deanishe/repos","events_url":"https://api.github.com/users/deanishe/events{/privacy}","received_events_url":"https://api.github.com/users/deanishe/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/deanishe/alfred-workflow/labels/v2.0","name":"v2.0","color":"5319e7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":31,"created_at":"2014-12-22T01:02:29Z","updated_at":"2015-01-23T21:35:38Z","closed_at":null,"body":"A significant refactoring of Alfred-Workflow is long overdue. The `Workflow` class has grown very large and the unittests are a horror show, largely due to the necessity of a workflow-like environment to run them in.\r\n\r\nI'd love to hear your ideas on how the library should be refactored and how the API should be changed.\r\n\r\nMy thoughts so far:\r\n\r\n### Refactoring\r\n\r\n- Move all the code that requires a workflow environment (`info.plist` or `version` files, Alfred environmental variables) to its own module(s).\r\n- Split the different feature groups of `Workflow` into separate modules (data storage and cache functions, settings, filtering, text processing, serialisation etc.).\r\n- Generalise the update API, so other backends (e.g. RSS, Packal) can be added easily.\r\n- Add lots of mocking to unittests, especially to return canned HTTP responses and avoid hitting web APIs.\r\n\r\n### API changes\r\n\r\n- Change default `max_age` to 0 in `Workflow.cached_data()`, so cached data is always returned regardless of age by default.\r\n- Move `version` from `update_settings` dict to a `Workflow` argument (as an alternative to `version` file).\r\n- (Possibly) allow `filter()` to be called with an empty `query`, whereupon it will return all `items`. This would mirror the way the built-in Python `filter()` function works, and allow @smargh to not bother checking whether `query` is empty.\r\n\r\nPaging @smargh @fniephaus @owenwater :grinning: \r\n"},"comment":{"url":"https://api.github.com/repos/deanishe/alfred-workflow/issues/comments/71270017","html_url":"https://github.com/deanishe/alfred-workflow/issues/55#issuecomment-71270017","issue_url":"https://api.github.com/repos/deanishe/alfred-workflow/issues/55","id":71270017,"user":{"login":"smargh","id":5077225,"avatar_url":"https://avatars.githubusercontent.com/u/5077225?v=3","gravatar_id":"","url":"https://api.github.com/users/smargh","html_url":"https://github.com/smargh","followers_url":"https://api.github.com/users/smargh/followers","following_url":"https://api.github.com/users/smargh/following{/other_user}","gists_url":"https://api.github.com/users/smargh/gists{/gist_id}","starred_url":"https://api.github.com/users/smargh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smargh/subscriptions","organizations_url":"https://api.github.com/users/smargh/orgs","repos_url":"https://api.github.com/users/smargh/repos","events_url":"https://api.github.com/users/smargh/events{/privacy}","received_events_url":"https://api.github.com/users/smargh/received_events","type":"User","site_admin":false},"created_at":"2015-01-23T21:35:38Z","updated_at":"2015-01-23T21:35:38Z","body":"A la the `info.plist` maybe `info.py`. Or `environ.py` since its information about the workflow environment. Possibly also `details.py` for similar reasons. I personally like the semantics of something like `from details import name, bundle_id`. "}}