{"action":"created","issue":{"url":"https://api.github.com/repos/gambitproject/gambit/issues/242","repository_url":"https://api.github.com/repos/gambitproject/gambit","labels_url":"https://api.github.com/repos/gambitproject/gambit/issues/242/labels{/name}","comments_url":"https://api.github.com/repos/gambitproject/gambit/issues/242/comments","events_url":"https://api.github.com/repos/gambitproject/gambit/issues/242/events","html_url":"https://github.com/gambitproject/gambit/pull/242","id":358231413,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE0MDU0NTYy","number":242,"title":"Ongoing attempt at Python 3 support (progress towards #203)","user":{"login":"rhalbersma","id":951511,"node_id":"MDQ6VXNlcjk1MTUxMQ==","avatar_url":"https://avatars2.githubusercontent.com/u/951511?v=4","gravatar_id":"","url":"https://api.github.com/users/rhalbersma","html_url":"https://github.com/rhalbersma","followers_url":"https://api.github.com/users/rhalbersma/followers","following_url":"https://api.github.com/users/rhalbersma/following{/other_user}","gists_url":"https://api.github.com/users/rhalbersma/gists{/gist_id}","starred_url":"https://api.github.com/users/rhalbersma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhalbersma/subscriptions","organizations_url":"https://api.github.com/users/rhalbersma/orgs","repos_url":"https://api.github.com/users/rhalbersma/repos","events_url":"https://api.github.com/users/rhalbersma/events{/privacy}","received_events_url":"https://api.github.com/users/rhalbersma/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-09-07T22:34:16Z","updated_at":"2019-01-03T21:58:19Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/gambitproject/gambit/pulls/242","html_url":"https://github.com/gambitproject/gambit/pull/242","diff_url":"https://github.com/gambitproject/gambit/pull/242.diff","patch_url":"https://github.com/gambitproject/gambit/pull/242.patch"},"body":"**Introduction**\r\nThese 6 commits hopefully prepare the ground for a full Python 2 / 3 compatible code base. \r\n\r\n**Rationale**\r\nThe commits do the following:\r\n1. I  have set up [Travis CI](https://travis-ci.org/rhalbersma/gambit) and [Codecov](https://codecov.io/gh/rhalbersma/gambit/branch/future) on my fork in the `future` branch.\r\n2. I followed the `futurize` best practices by running the automated `--stage1` and `--stage2` steps, keeping all tests green. \r\n3. `futurize` does not touch Cython files, so `functools.reduce` needs to be manually imported.\r\n4. Running the nosetests with `python2 -3` signalled quite a few deprecated warnings concerning user-defined `__eq__` functions without an accompanying `__hash__` function. I have added hash support consistent with equality: if equality is on a tuple/list of class members, then the hashing will be on the same data structure (tuple or list of the data members of `self`).\r\n5. Running `python3 setup.py build` because of the new Python 3 class system (see this [Q&A on StackOverflow](https://stackoverflow.com/questions/40367569/dictionary-not-writable-generic-old-setup-py)). \r\n\r\n**Status**\r\n- The project builds correctly under python2 and runs all unit tests without error.\r\n- Running the unit tests with `python2 -3 nosetests` gives no warnings in code from `gambit`, and only a handful about system code. \r\n- Running `python3 setup.py build` also builds without errors.\r\n- Running `nosetests` in Python3 mode fails on all unit tests, mostly because of `byte` / `str` incompatibility.\r\n\r\n**Guidance needed**\r\n- How would you like to tackle Python2 / Python3 string compatibility? My preferred option would be to treat the current `cython` interface of talking to the C++ code through `std::string` or `char *`. This will keep callers using Python2 happy, but requires converting Python3 unicode string literals to `byte`, e.g. using a `.encode('utf-8')` member function call.\r\n- Gambit also produces quite a bit of `char *` strings from `c_str()` member functions. When those talk to users, then they need to be marshalled through `.decode()`. Separating the internal `c_str()` calls from the ones bubbling up to the interface seems quite a bit of work.\r\n- There are also bound to be some issues with `file()` and `open()` incompatibilities between Python2 and Python3. The way forward is to use `open()` everywhere, with the appropriate `b` flags for byte stream reading. \r\n\r\nIf you agree with the approach taken so far, I can try and plough ahead with the string and file issues. Merging the pull request would eventually be best done in one squashed commit, or piece meal, whatever your preference is.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/gambitproject/gambit/issues/comments/451290726","html_url":"https://github.com/gambitproject/gambit/pull/242#issuecomment-451290726","issue_url":"https://api.github.com/repos/gambitproject/gambit/issues/242","id":451290726,"node_id":"MDEyOklzc3VlQ29tbWVudDQ1MTI5MDcyNg==","user":{"login":"rhalbersma","id":951511,"node_id":"MDQ6VXNlcjk1MTUxMQ==","avatar_url":"https://avatars2.githubusercontent.com/u/951511?v=4","gravatar_id":"","url":"https://api.github.com/users/rhalbersma","html_url":"https://github.com/rhalbersma","followers_url":"https://api.github.com/users/rhalbersma/followers","following_url":"https://api.github.com/users/rhalbersma/following{/other_user}","gists_url":"https://api.github.com/users/rhalbersma/gists{/gist_id}","starred_url":"https://api.github.com/users/rhalbersma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhalbersma/subscriptions","organizations_url":"https://api.github.com/users/rhalbersma/orgs","repos_url":"https://api.github.com/users/rhalbersma/repos","events_url":"https://api.github.com/users/rhalbersma/events{/privacy}","received_events_url":"https://api.github.com/users/rhalbersma/received_events","type":"User","site_admin":false},"created_at":"2019-01-03T21:58:19Z","updated_at":"2019-01-03T21:58:19Z","author_association":"NONE","body":"Python 2 itself will no longer be maintained in 12 months time: https://pythonclock.org/"}}
{"actor":{"display_login":"rhalbersma"}}