Skip to content

Regression: Docs no longer build with py27-sphinx since #2394 #2593

Closed

Description

@zmwangx

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.

Activity

  1. ambv commented on Dec 20, 2016

    @ambv
    Contributor

    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.

  2. ambv commented on Dec 20, 2016

    @ambv
    Contributor

    Turns out we don't even need typed-ast if we only evaluate the string found in the version assignment.

  3. gvanrossum commented on Dec 21, 2016

    @gvanrossum
    Member
  4. added a commit that references this issue on Dec 21, 2016
  5. gvanrossum commented on Dec 23, 2016

    @gvanrossum
    Member

    @ambv Since you closed your PR, did you intend this issue to be closed with "won't fix" as well?

  6. zmwangx commented on Dec 23, 2016

    @zmwangx
    Author

    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.

  7. ambv commented on Dec 23, 2016

    @ambv
    Contributor

    @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.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions