{"action":"created","issue":{"url":"https://api.github.com/repos/zulip/zulip/issues/256","repository_url":"https://api.github.com/repos/zulip/zulip","labels_url":"https://api.github.com/repos/zulip/zulip/issues/256/labels{/name}","comments_url":"https://api.github.com/repos/zulip/zulip/issues/256/comments","events_url":"https://api.github.com/repos/zulip/zulip/issues/256/events","html_url":"https://github.com/zulip/zulip/issues/256","id":114965236,"number":256,"title":"Add support for using Zulip with Python 3","user":{"login":"timabbott","id":2746074,"avatar_url":"https://avatars.githubusercontent.com/u/2746074?v=3","gravatar_id":"","url":"https://api.github.com/users/timabbott","html_url":"https://github.com/timabbott","followers_url":"https://api.github.com/users/timabbott/followers","following_url":"https://api.github.com/users/timabbott/following{/other_user}","gists_url":"https://api.github.com/users/timabbott/gists{/gist_id}","starred_url":"https://api.github.com/users/timabbott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timabbott/subscriptions","organizations_url":"https://api.github.com/users/timabbott/orgs","repos_url":"https://api.github.com/users/timabbott/repos","events_url":"https://api.github.com/users/timabbott/events{/privacy}","received_events_url":"https://api.github.com/users/timabbott/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/zulip/zulip/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/zulip/zulip/labels/help%20wanted","name":"help wanted","color":"159818"},{"url":"https://api.github.com/repos/zulip/zulip/labels/Platform%20support","name":"Platform support","color":"d4c5f9"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2015-11-04T04:07:03Z","updated_at":"2016-03-09T19:12:14Z","closed_at":null,"body":"Python 3 enables a bunch of awesome stuff like optional static typing, and I think is actually pretty feasible to add.  I've already applied the fast majority of the futurize/modernize fixers to the repository in a way that preserves Python 2+3 support; for future work, we should continue using that approach.  Based on some hackish testing, we're about 100 LOC away from passing 90% of backend tests against Python 3 (well not including the #! lines that hardcode Python 2.7).  Based on that investigation, the main projects that remain are as follows.\r\n\r\nWe have some dependencies that don't support Python 3:\r\n* python-twitter (https://github.com/bear/python-twitter).  It looks like some work has been done for Python 3 support there (https://github.com/bear/python-twitter/issues/155) or we could switch to an alternative library; Zulip primarily uses it to render links to Tweets.\r\n* python-ldap and django-auth-ldap.  It appears there are Python 3 supporting libraries python-ldap3 and django-python3-ldap but they seem to have a different interface; so the challenges are (1) decide whether we want to switch to the python2+3 versions and (2) if so, actually do it.\r\n* Old django-pipeline.  We're using an old version but a newer version that supports Python 3 exists; this upgrade may be somewhat messy since it involves renaming things like \"load compressed\" and \"compressed_css\" in our Django templates.\r\n\r\n(We can update this list to add others but those are the main ones where we need to do more than a straightforward version upgrade).\r\n\r\nThere are also some changes needed to the Zulip code itself still:\r\n* Doing a few more Python 3 compatibility migrations (I've already done like 20 of them), in particular the file=>open change, .items() iteration, and several libraries like StringIO, urlparse.  For these, we can fix things and then add the fixers to the tests in #252 to avoid regressions.\r\n* Unicode transition fixes such as adding appropriate encode/decode usage where we use base-64 encoding, hash digests, etc.  \r\n\r\nIf anyone's interested in working on Python 3 support, feel free to claim one of these pieces on this issue's discussion thread!  \r\n\r\nI pushed https://github.com/timabbott/zulip/commits/tabbott-py3k-testing which has some total hack commits I wrote as part of the testing process for Python 3 support; with some library version installation work that branch passes 90% of our tests.  That could be helpful for anyone working on this.\r\n"},"comment":{"url":"https://api.github.com/repos/zulip/zulip/issues/comments/194457647","html_url":"https://github.com/zulip/zulip/issues/256#issuecomment-194457647","issue_url":"https://api.github.com/repos/zulip/zulip/issues/256","id":194457647,"user":{"login":"timabbott","id":2746074,"avatar_url":"https://avatars.githubusercontent.com/u/2746074?v=3","gravatar_id":"","url":"https://api.github.com/users/timabbott","html_url":"https://github.com/timabbott","followers_url":"https://api.github.com/users/timabbott/followers","following_url":"https://api.github.com/users/timabbott/following{/other_user}","gists_url":"https://api.github.com/users/timabbott/gists{/gist_id}","starred_url":"https://api.github.com/users/timabbott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timabbott/subscriptions","organizations_url":"https://api.github.com/users/timabbott/orgs","repos_url":"https://api.github.com/users/timabbott/repos","events_url":"https://api.github.com/users/timabbott/events{/privacy}","received_events_url":"https://api.github.com/users/timabbott/received_events","type":"User","site_admin":false},"created_at":"2016-03-09T19:12:14Z","updated_at":"2016-03-09T19:12:14Z","body":"Yeah probably you'll just want to replace that hardcoded python2.7 with\n\"python\" for this purpose :)\n\n\n        -Tim Abbott\n\nOn Wed, Mar 9, 2016 at 11:09 AM, Eklavya Sharma <notifications@github.com>\nwrote:\n\n> I realized that scripts start with #!/usr/bin/env python2.7. I thought\n> that I was running them with a python3 venv but that's not the case. Doing python\n> tools/lint-all gives this output:\n>\n>   File \"./tools/lint-all\", line 130\n>     print line\n>              ^\n> SyntaxError: Missing parentheses in call to 'print'\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/zulip/zulip/issues/256#issuecomment-194456718>.\n>\n"}}