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

Use of typing module introduced in python 3.5 #4725

Closed
analog-cbarber opened this issue Mar 8, 2018 · 8 comments
Closed

Use of typing module introduced in python 3.5 #4725

analog-cbarber opened this issue Mar 8, 2018 · 8 comments

Comments

@analog-cbarber
Copy link

It appears that starting with sphinx 1.7.1, the code uses the typing module that was introduced in python 3.5. This presumably means the code will no longer work with python 3.4, which is still documented as being the oldest supported version. Furthermore the use of the TYPE_CHECKING attribute means that versions prior to python 3.5.3 will not work (which is how I noticed this).

For instance, see here

It seems like you should either avoid the typing module entirely, conditionalize the imports somehow or update your documented dependencies to state that you require 3.5.3.

@tk0miya
Copy link
Member

tk0miya commented Mar 11, 2018

OMG.... I thought the TYPE_CHECKING is supported since 3.5. I'll check it ASAP.
Thank you for letting me know!

@tk0miya tk0miya added this to the 1.7.2 milestone Mar 11, 2018
@analog-cbarber
Copy link
Author

The doc for TYPE_CHECKING does not state that it was not in the original version of the typing module, so there would be no way to know if you didn't explicitly check older versions.

In any case, there is still the issue that the typing module itself was not present in 3.4. Is sphinx dropping 3.4 support?

@tk0miya
Copy link
Member

tk0miya commented Mar 11, 2018

Sphinx depends on typing backports package when <= 3.4. So py34 is still supported.
https://pypi.python.org/pypi/typing

@cocoatomo
Copy link
Contributor

cocoatomo commented Mar 12, 2018

typing.TYPE_CHECKING is introduced at this commit python/cpython@91185fe#diff-015978a768b517a38abbc0ecdea87f5aR72 (on 9 Jun 2016),
and the Python version at this point was 3.5.1.
3.5.1 final was released on December 6, 2015 according PEP 478, so Sphinx should use typing backports package when <= 3.5.0. (Maybe that case are rare.)

@analog-cbarber
Copy link
Author

For what its worth, I observed this problem on a system that says it has python 1.5.1, and I definitely did not install a prerelease. Furthermore, if you look at the online docs for the typing module the TYPE_CHECKING variable does not show up until 1.5.3. You should check actual deployments before making any conclusions about what versions work.

I just created conda environment for python 1.5.1 on Mac OSX and sure enough there is no TYPE_CHECKING. It does appear in the 1.5.2.

So you should use the backports package when <= 3.5.1

@cocoatomo
Copy link
Contributor

Sorry for my wrong comment. I had misunderstanding that 3.5.1 final was released on December 6, 2016.

typing.TYPE_CHECKING was released at Python 3.5.2, so your opinion is absolutely true.

@jdufresne
Copy link
Contributor

The typing PyPI page has the following disclaimer:

NOTE: in Python 3.5 and later, the typing module lives in the stdlib, and installing this package has NO EFFECT. To get a newer version of the typing module in Python 3.5 or later, you have to upgrade to a newer Python (bugfix) version. For example, typing in Python 3.6.0 is missing the definition of ‘Type’ – upgrading to 3.6.2 will fix this.

So with Python 3.5.1, even with the typing package installed, TYPE_CHECKING is not available. I have verified this locally. With this, it seems the latest Sphinx release simply isn't compatible with Python 3.5.0 & 3.5.1.

tk0miya added a commit that referenced this issue Mar 13, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
#4725: Sphinx does not work with python 3.5.0 and 3.5.1
@tk0miya
Copy link
Member

tk0miya commented Mar 14, 2018

Fixed by #4735.
Thank you for reporting!

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

No branches or pull requests

4 participants