{"action":"created","issue":{"url":"https://api.github.com/repos/GalSim-developers/GalSim/issues/761","repository_url":"https://api.github.com/repos/GalSim-developers/GalSim","labels_url":"https://api.github.com/repos/GalSim-developers/GalSim/issues/761/labels{/name}","comments_url":"https://api.github.com/repos/GalSim-developers/GalSim/issues/761/comments","events_url":"https://api.github.com/repos/GalSim-developers/GalSim/issues/761/events","html_url":"https://github.com/GalSim-developers/GalSim/pull/761","id":160871288,"number":761,"title":"#534 Support Python 3","user":{"login":"rmjarvis","id":623887,"avatar_url":"https://avatars.githubusercontent.com/u/623887?v=3","gravatar_id":"","url":"https://api.github.com/users/rmjarvis","html_url":"https://github.com/rmjarvis","followers_url":"https://api.github.com/users/rmjarvis/followers","following_url":"https://api.github.com/users/rmjarvis/following{/other_user}","gists_url":"https://api.github.com/users/rmjarvis/gists{/gist_id}","starred_url":"https://api.github.com/users/rmjarvis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmjarvis/subscriptions","organizations_url":"https://api.github.com/users/rmjarvis/orgs","repos_url":"https://api.github.com/users/rmjarvis/repos","events_url":"https://api.github.com/users/rmjarvis/events{/privacy}","received_events_url":"https://api.github.com/users/rmjarvis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":21,"created_at":"2016-06-17T11:49:42Z","updated_at":"2016-06-23T19:27:36Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/GalSim-developers/GalSim/pulls/761","html_url":"https://github.com/GalSim-developers/GalSim/pull/761","diff_url":"https://github.com/GalSim-developers/GalSim/pull/761.diff","patch_url":"https://github.com/GalSim-developers/GalSim/pull/761.patch"},"body":"This PR converts the GalSim code to work with Python 3.  So if you have access to a Python 3 installation, please test that everything works for you there.  And if not, at least check that I didn't break your Python 2 installation with anything here.\r\n\r\nI added a new dependency, called future, to help enable this.  While I didn't technically need it (I could have rolled my own versions of the features I use from there), it's a pretty easy dependency, so hopefully it won't be a significant hardship for anyone.  But it means you'll probably need to run `pip install future` before installing GalSim on this branch.\r\n\r\nFor reference, I used this handy [cheat sheet](http://python-future.org/compatible_idioms.html) extensively for writing the Python 2-3 compatible code.  This [guide](http://python3porting.com/noconv.html#noconv-chapter) also had some useful advice, but it was not nearly as comprehensive.\r\n\r\nFinally, Python 3 added a ResourceWarning that lets you know when you've forgotten to close files.  I'm not sure if this only happens when running in nosetests or what (I didn't get them when I ran individual test files), but it helped me track down a lot of places where we were doing that.  The biggest culprit was `python.getdata`, which seems to not (or not always) close the input file.  So I switched all of those to `with python.open(..)` blocks, which fixed those errors.  There were a number of others that were our fault.  \r\n\r\nThe trickiest one was that `galsim.fits.read` could raise an exception before getting to the place where it closes the files.  It turns out, this is precisely what the python `try... finally` construct is for, so I used that, which makes for nicer code there."},"comment":{"url":"https://api.github.com/repos/GalSim-developers/GalSim/issues/comments/228158036","html_url":"https://github.com/GalSim-developers/GalSim/pull/761#issuecomment-228158036","issue_url":"https://api.github.com/repos/GalSim-developers/GalSim/issues/761","id":228158036,"user":{"login":"rmjarvis","id":623887,"avatar_url":"https://avatars.githubusercontent.com/u/623887?v=3","gravatar_id":"","url":"https://api.github.com/users/rmjarvis","html_url":"https://github.com/rmjarvis","followers_url":"https://api.github.com/users/rmjarvis/followers","following_url":"https://api.github.com/users/rmjarvis/following{/other_user}","gists_url":"https://api.github.com/users/rmjarvis/gists{/gist_id}","starred_url":"https://api.github.com/users/rmjarvis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmjarvis/subscriptions","organizations_url":"https://api.github.com/users/rmjarvis/orgs","repos_url":"https://api.github.com/users/rmjarvis/repos","events_url":"https://api.github.com/users/rmjarvis/events{/privacy}","received_events_url":"https://api.github.com/users/rmjarvis/received_events","type":"User","site_admin":false},"created_at":"2016-06-23T19:27:36Z","updated_at":"2016-06-23T19:27:36Z","body":"> Would you be willing to update https://github.com/GalSim-developers/GalSim/wiki/Checklist-for-making-a-pull-request with the few most important things to watch out for with respect to python 3 compatibility, for people like me who don't have a python 3 setup to use for testing? \r\n\r\nDone.  I'll make sure I test with Python 2.6 and 3.4 before any release, but I won't typically test it for every PR.  Similar to how I try to test releases on lots of different compilers, OS's, etc., but sometimes it goes a while before I catch the incompatibilities on master.\r\n\r\n> Now Travis has an even weirder problem - I have no idea...\r\n\r\nI pushed a dummy commit to trigger another Travis run, and it worked.  I guess Travis just bonks from time to time.  I can relate..."}}
{"actor":{"display_login":"rmjarvis"}}