Skip to content

Python 3 support. #168

Closed
Closed

Description

@JornVernee

Is python 3 support planned at all?

I was having a problem with paths exceeding max path length on Windows, and this is apparently fixed in python 3.6 (I worked around the problem by moving the suite directory closer to drive root)

I'm not a python expert, but I've seen applications supporting both python 2 and 3 before by using import __future__. Would that be a possible migration path?

Activity

  1. dougxc commented on Nov 10, 2018

    @dougxc
    Member

    We don't have any current plans for supporting python 3. However, we're open to anyone who wants to put together a plan and PR for adding python 3 support while ensuring mx will continue to work on 2.7.

  2. JornVernee commented on Nov 11, 2018

    @JornVernee
    ContributorAuthor

    @dougxc I've looked into this once in the past. There were 6 issues I ran into;

    1. print is a function in python 3, but you can get forward compatibility by using import __future__ in python 2.
    2. python 3 doesn't have a cmp function, but there are easy workaround for this.
    3. some issue around OrderedDict
    4. octal literals having a different syntax
    5. results from subprocess.check_output needing to be decoded into strings manually.
    6. modules, types and functions being renamed.

    I can see not much problems for 1-5, but 6 might be tricky to get to work with both versions.

    I think 1 by far touches the most code, but it's also the most straight forward to do, as long as you don't mind using a print function instead of statement. I think that's a good place to start.

  3. dougxc commented on Nov 12, 2018

    @dougxc
    Member

    Thanks for the summary. I also just saw that Python 2.7 will no longer be supported as of Jan 1st 2020 so that's one more very good reason to adopt Python 3.

    Are you planning to submit a PR that makes some of the changes you outlined above?

  4. JornVernee commented on Nov 12, 2018

    @JornVernee
    ContributorAuthor

    @dougxc I have a patch to move to using print function in the mx repo, and it turned out there's no need to install an extra package after all, so clients don't need to update anything. Are you OK with submitting changes one by one instead of one big patch that adds python 3 support?

    I've looked a little more into getting mx to work with python 2 & 3, but some of the other changes I made in the past were changing some of the default encodings used, which meant that the XML parser couldn't recognize the encoding any more when running on python 2, since its went from ascii to unicode. (I haven't found a solution yet for that).

    I think that with portable changes (like print function) we can at the very least get as close as possible to python 3 while still supporting python 2, and then if needed create a separate python 3 fork/branch to do the last few changes that are not compatible with python 2.

  5. dougxc commented on Nov 12, 2018

    @dougxc
    Member

    While adding python 3 support to mx, I think fine grained pull requests to the master branch is the best way to go to avoid regressions.

  6. JornVernee commented on Nov 27, 2018

    @JornVernee
    ContributorAuthor

    Been looking into this some more today.

    The train seems to stop at some point because the current version of astroid 1.1.0 does not support new python 3 versions.

    What is the reason for not updating to the latest version currently?

  7. dougxc commented on Nov 27, 2018

    @dougxc
    Member

    There no reason apart from no one having tested a more recent version ;-)

  8. JornVernee commented on Nov 27, 2018

    @JornVernee
    ContributorAuthor

    Well... now somebody has: #176 ;)

  9. JornVernee commented on Nov 30, 2018

    @JornVernee
    ContributorAuthor

    I currently have mx --strict-compliance gate --strict-mode passing on the mx suite with both python 2.7.15 and 3.6.5

    You can find the changes here: https://github.com/JornVernee/mx/tree/p3_other

    I will split up the branch into several PRs. I haven't posted all of them yet since some are not orthogonal and might conflict, so I'm waiting for some of the PRs to get merged first.

  10. dougxc commented on Nov 30, 2018

    @dougxc
    Member

    Hi @JornVernee sorry for delays on your PRs related to mx moving to Python 3 and Windows support. They are definitely very welcome and we will try and move them along.

  11. JornVernee commented on Nov 30, 2018

    @JornVernee
    ContributorAuthor

    @dougxc I thought the internal gating/process was just taking a while. I know there's been some conferences lately (e.g. devoxx) and I guess people have been going there as well?

    It's no problem for me, I just made a bunch of PRs just to get them out there and make progress on that for myself :-)

  12. dougxc commented on Nov 30, 2018

    @dougxc
    Member

    Ok, thanks for your understanding. The internal gating/process is currently quite manual.

  13. JornVernee commented on Jan 15, 2019

    @JornVernee
    ContributorAuthor

    I will close this now since #184 was merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions