You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Regression: Docs no longer build with py27-sphinx since #2394 #2593
Docs used to build just fine with Sphinx under Python 2.7. #2394 introduced an import mypy.git to mypy.version (which is imported by Sphinx's conf.py), and since mypy.git contains function annotations not supported by Python 2.7, trying to build the docs with py27-sphinx now causes an error:
$ make html
sphinx-build -b html -d build/doctrees source build/html
Running Sphinx v1.5.1
Configuration error:
There is a syntax error in your configuration file: invalid syntax (git.py, line 10)
make: *** [html] Error 1
This unfortunately is causing some trouble for Homebrew (see Homebrew/homebrew-core#7143), since our sphinx-doc formula is py27 only at the moment.
We'll of course try to fix this on Homebrew's side, but maybe py27-sphinx compatibility could be restored? One solution I can think of is to add something like mypy/version_static.py with the plain old version declaration:
__version__='0.4.7-dev'
then import mypy.version_static in docs/source/conf.py instead. The downside is it needs to be bumped alongside version.py at the same time, and when building from a git tree, the commit hash won't be included in the docs.
We'd need typed-ast instead to be able to generate the AST on Python 2 as well and we should be all set. Let me see how much work it is to prepare a PR for this.
While I'm not sure I care about Sphinx-2.7 given that mypy solidly requires
Python 3 to run, the hackery in version.py is definitely not ideal (and may
even have some broken edge cases, search the tracker). But I'm not sure
that just opening the file instead of importing it is really better (the
import machinery is *sooo* much subtler than that...).
As the OP I'm okay with wont fix. I've patched the Homebrew formula (with the version_static hack mentioned above, only at build time) and no one's mad at me so far.
Activity
ambv commentedon Dec 20, 2016
I personally like what Pallets' projects are doing: AST analyzing the version string, without really importing it, like: https://github.com/pallets/click/blob/master/setup.py#L11.
We'd need typed-ast instead to be able to generate the AST on Python 2 as well and we should be all set. Let me see how much work it is to prepare a PR for this.
ambv commentedon Dec 20, 2016
Turns out we don't even need typed-ast if we only evaluate the string found in the version assignment.
gvanrossum commentedon Dec 21, 2016
mypy 0.4.6
gvanrossum commentedon Dec 23, 2016
@ambv Since you closed your PR, did you intend this issue to be closed with "won't fix" as well?
zmwangx commentedon Dec 23, 2016
As the OP I'm okay with wont fix. I've patched the Homebrew formula (with the version_static hack mentioned above, only at build time) and no one's mad at me so far.
ambv commentedon Dec 23, 2016
@ambv GitHub closed it since I mistakenly put it on master in my fork :)
But yeah, if wontfix is okay for @zmwangx, it's better for us to keep things simple.