{"action":"created","issue":{"url":"https://api.github.com/repos/pyugrid/pyugrid/issues/71","labels_url":"https://api.github.com/repos/pyugrid/pyugrid/issues/71/labels{/name}","comments_url":"https://api.github.com/repos/pyugrid/pyugrid/issues/71/comments","events_url":"https://api.github.com/repos/pyugrid/pyugrid/issues/71/events","html_url":"https://github.com/pyugrid/pyugrid/pull/71","id":94498869,"number":71,"title":"Extract version from __init__.py","user":{"login":"ocefpaf","id":950575,"avatar_url":"https://avatars.githubusercontent.com/u/950575?v=3","gravatar_id":"","url":"https://api.github.com/users/ocefpaf","html_url":"https://github.com/ocefpaf","followers_url":"https://api.github.com/users/ocefpaf/followers","following_url":"https://api.github.com/users/ocefpaf/following{/other_user}","gists_url":"https://api.github.com/users/ocefpaf/gists{/gist_id}","starred_url":"https://api.github.com/users/ocefpaf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocefpaf/subscriptions","organizations_url":"https://api.github.com/users/ocefpaf/orgs","repos_url":"https://api.github.com/users/ocefpaf/repos","events_url":"https://api.github.com/users/ocefpaf/events{/privacy}","received_events_url":"https://api.github.com/users/ocefpaf/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-11T18:55:22Z","updated_at":"2015-07-11T19:51:40Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/pyugrid/pyugrid/pulls/71","html_url":"https://github.com/pyugrid/pyugrid/pull/71","diff_url":"https://github.com/pyugrid/pyugrid/pull/71.diff","patch_url":"https://github.com/pyugrid/pyugrid/pull/71.patch"},"body":"That way we maintain the version number in only one file and we do not need to import `pyugrid` to get the version.\r\n\r\nNote that I also pep8'd `setup.py `."},"comment":{"url":"https://api.github.com/repos/pyugrid/pyugrid/issues/comments/120655087","html_url":"https://github.com/pyugrid/pyugrid/pull/71#issuecomment-120655087","issue_url":"https://api.github.com/repos/pyugrid/pyugrid/issues/71","id":120655087,"user":{"login":"ChrisBarker-NOAA","id":916576,"avatar_url":"https://avatars.githubusercontent.com/u/916576?v=3","gravatar_id":"","url":"https://api.github.com/users/ChrisBarker-NOAA","html_url":"https://github.com/ChrisBarker-NOAA","followers_url":"https://api.github.com/users/ChrisBarker-NOAA/followers","following_url":"https://api.github.com/users/ChrisBarker-NOAA/following{/other_user}","gists_url":"https://api.github.com/users/ChrisBarker-NOAA/gists{/gist_id}","starred_url":"https://api.github.com/users/ChrisBarker-NOAA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChrisBarker-NOAA/subscriptions","organizations_url":"https://api.github.com/users/ChrisBarker-NOAA/orgs","repos_url":"https://api.github.com/users/ChrisBarker-NOAA/repos","events_url":"https://api.github.com/users/ChrisBarker-NOAA/events{/privacy}","received_events_url":"https://api.github.com/users/ChrisBarker-NOAA/received_events","type":"User","site_admin":false},"created_at":"2015-07-11T19:51:40Z","updated_at":"2015-07-11T19:51:40Z","body":"The __init__version string should get replaces with a new one, which will now be there. So teh setup.py shoulud replace __version__ = \"any old thing\" with the new version:\r\n\r\nSomething like (untested):\r\n\r\ndef inplace_change(filename, new_version=__version__):\r\n    with open(filename) as f:\r\n        lines = f.readlines()\r\n        for i, enumerate( lines ):\r\n            if line.strip().replace(' ','').startswith(\"__version__=\"):\r\n                lines[i] = \"__version = %s\\n\"%new_version\r\n                break\r\n\r\n       f = open(filename, 'w').writelines(lines)\r\n"}}