Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Python3 Timeline #1602

Closed
tqchen opened this issue Aug 14, 2018 · 14 comments
Closed

[RFC] Python3 Timeline #1602

tqchen opened this issue Aug 14, 2018 · 14 comments

Comments

@tqchen
Copy link
Member

tqchen commented Aug 14, 2018

We plan to do some improvements to the IR in this release cycle, and one such question that comes up is the dependency on python version. Up until now, TVM has always been compatible to both python2 and python3. However, there are language features in python3 that we like, in particular:

  • Type annotations like def myfunc(x:int) -> int introduced python3.5
  • Class type annotations that decorate fields are introduced python3.6

Introducing these type annotations to the code will make the program cleaner, but that also means the code will not be python2 compatible. If we introduce class type annotation, we can only use python3.6. One of the major benefits is that adopting type annotation allows the introduction of typed DSLs

Some of the options are:

  • Keep support python2
  • For a new set of features, require python3.5+
  • Enforce python3.6

For background, currently, ubuntu support(14.04 python3.4, 16.04 python3.5, 18.04 python3.6). Most packages plan to stop supporting python2 on 2019

@tqchen
Copy link
Member Author

tqchen commented Aug 14, 2018

cc @dmlc/tvm-team

@nhynes
Copy link
Member

nhynes commented Aug 14, 2018

+1 for python3.6

In terms of package support, the ones TVM requires (numpy and decorator) already support 3.7. Even pypy nightly has 3.6 support!

also f-strings are pretty okay :)

@yzhliu
Copy link
Member

yzhliu commented Aug 14, 2018

FYI https://python3statement.org/

I tend to have a conservative timeline. Python2 is still installed by default in most Linux distro, supporting py2 is friendly to those just want to have a try. And I'm not sure how many enterprise users are stuck on py2 at the moment.

@nhynes
Copy link
Member

nhynes commented Aug 14, 2018

FWIW, TVM de facto requires LLVM 4+ for CPU support, but LLVM isn't in any of the current distros. Python compiles much faster than LLVM, so I wouldn't take what's in the default repos to be a constraint.

@tmoreau89
Copy link
Contributor

+1 for 3.6, it seems like the way forward. We already test script compatibility in integration tests right?

@yzhliu
Copy link
Member

yzhliu commented Aug 14, 2018

Another option is to keep runtime apis compatible with py2, so that enterprise users won't face problems integrating tvm into their serving pipeline.

@masahi
Copy link
Member

masahi commented Aug 14, 2018

Dropping py2 completely seems too aggressive to me. I often see error logs on the discussion forum where people are still using python 2.7.

So I'm +1 for requiring py3 for new features only for now. In the meantime, we should encourage users to switch to py3, in the next release note for example.

@tqchen
Copy link
Member Author

tqchen commented Aug 16, 2018

The conclusion seems to be we should always enforce py2 compatibility for the runtime. We might consider requiring py3 for new features

@FrozenGene
Copy link
Member

+1 For a new set of features, require python3.5+. Enforce python3.6 is too aggressive. Many Linux distro are Python 3.5.

@zhreshold
Copy link
Member

+1 for 3.5, it's too early to drop 3.5 at this time.

@junrushao
Copy link
Member

I am a big fan of python 3.6+, just a question out of curiosity: typed_ast in mypy seems to support python 2.7 as well, using grammar like

some_list = []  # type: List[int]

So what prevents us supporting python 2.7?

Thanks!

@tqchen
Copy link
Member Author

tqchen commented Aug 20, 2018

@junrushao1994 I agree that we could use the comment callback for backward compat with 2.7

@tqchen
Copy link
Member Author

tqchen commented Sep 21, 2018

this is closed for now, we have decided to keep python2 compact for the new core relay IR

@tqchen
Copy link
Member Author

tqchen commented Mar 1, 2019

see #2715

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

No branches or pull requests

8 participants