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

Sphinx doesn't support python 3.10 #9562

Closed
Itotutona opened this issue Aug 19, 2021 · 8 comments
Closed

Sphinx doesn't support python 3.10 #9562

Itotutona opened this issue Aug 19, 2021 · 8 comments
Labels
type:enhancement enhance or introduce a new feature

Comments

@Itotutona
Copy link

Problem

Recently, I updated Python 3.9.6 to Python 3.10 RC. No problems. When I want to compile my Sphinx documentation (make html), I see:

$ make build
sphinx-build -b html -d _build/doctrees . _build/html
Traceback (most recent call last):
File "/home/titouan/.local/bin/sphinx-build", line 5, in
from sphinx.cmd.build import main
File "/home/titouan/.local/lib/python3.10/site-packages/sphinx/cmd/build.py", line 25, in
from sphinx.application import Sphinx
File "/home/titouan/.local/lib/python3.10/site-packages/sphinx/application.py", line 32, in
from sphinx.config import Config
File "/home/titouan/.local/lib/python3.10/site-packages/sphinx/config.py", line 21, in
from sphinx.util import logging
File "/home/titouan/.local/lib/python3.10/site-packages/sphinx/util/init.py", line 41, in
from sphinx.util.typing import PathMatcher
File "/home/titouan/.local/lib/python3.10/site-packages/sphinx/util/typing.py", line 37, in
from types import Union as types_Union
ImportError: cannot import name 'Union' from 'types' (/usr/lib64/python3.10/types.py)
make: *** [Makefile:53 : html] Erreur 1

Union is no longer in types

I suggest you update the sphinx code to be usable with oython 3.10 as it will be released very soon
If you want some help, I can contribute to sphinx.

Solution

I suggest you update the sphinx code to be usable with python 3.10 as it will be released very soon ( 4 october )
If you want some help, I can contribute to sphinx.

Additional context

@Itotutona Itotutona added the type:enhancement enhance or introduce a new feature label Aug 19, 2021
@astrojuanlu
Copy link
Contributor

Hi @Itotutona , you forgot to say what version of Sphinx are you using. I see that this error should be fixed at least on master:

try:
from types import UnionType # type: ignore # python 3.10 or above
except ImportError:
UnionType = None

@Itotutona
Copy link
Author

@astrojuanlu I use 4.1.2

@jaraco
Copy link

jaraco commented Aug 29, 2021

I just attempted to build docs using Sphinx and Python 3.10 and the issue still exists. I can work around it by building docs on Python 3.9. If the issue is fixed on master, maybe consider cutting a release with the fix so that others like me don't have to encounter the issue.

@psss
Copy link

psss commented Sep 1, 2021

Confirm the problem is still present when testing with the latest Fedora (35 and Rawhide).

@astrojuanlu
Copy link
Contributor

From my understanding, the problem is present in Sphinx 4.1.2:

if sys.version_info > (3, 10):
from types import Union as types_Union
else:
types_Union = None

but it was fixed on the master and 4.1.x branches:

try:
from types import UnionType # type: ignore # python 3.10 or above
except ImportError:
UnionType = None

Can folks try to reproduce the problem with the development version?

@astrojuanlu
Copy link
Contributor

In principle, this issue is a duplicate of #9512, which was fixed in #9513.

@jaraco
Copy link

jaraco commented Sep 4, 2021

I just attempted to build docs using Sphinx and Python 3.10 and the issue still exists. I can work around it by building docs on Python 3.9. If the issue is fixed on master, maybe consider cutting a release with the fix so that others like me don't have to encounter the issue.

This issue cause a failed release of Setuptools requiring a workaround to be committed to the repo and adding debt to remove that workaround later. Please consider cutting a release so that there is a working published version of Sphinx for Python 3.10.

@tk0miya tk0miya reopened this Sep 5, 2021
@tk0miya tk0miya closed this as completed Sep 5, 2021
@tk0miya
Copy link
Member

tk0miya commented Sep 5, 2021

4.2.0 will be released the next weekend. Please wait a moment more.

clrpackages pushed a commit to clearlinux-pkgs/setuptools that referenced this issue Sep 7, 2021
…on 58.0.0

Alan Fregtman (6):
      Implement "glob:" directive for declarative "data_files" option.
      Add changelog entry for PR #2712.
      Update globbing for [options.data_files] to be implicit, not requiring a custom directive.
      globbing for [options.data_files]: Remove special treatment for filenames with globby characters that exist literally.
      Satisfy some flake8 style checks for the previous commit.
      config.py: Fix line-too-long warning in _parse_list_glob()

Ian Wienand (1):
      build_meta: Clarify the reasons for project requirements in pyproject.toml

Jason R. Coombs (13):
      Trim back chaneglog.
      👹 Feed the hobgoblins (delint).
      Rely on setuptools 56 and drop the explicit mention of the license file in favor of simple discovery.
      Remove workaround for python/typed_ast#156.
      Use line continuations to indicate which exclusions are for which workarounds.
      Remove blacken docs as it cannot honor Python's default repr. Ref asotille/blacken-docs#62.
      Remove blacken docs as it cannot honor Python's default repr. Ref adamchainz/blacken-docs#62.
      Restore whitespace and single quotes after blacken-docs.
      Bump version: 57.4.0 → 57.5.0
      Fix broken Sphinx builds on Python 3.10. Fixes #2763. Ref sphinx-doc/sphinx#9562.
      👹 Feed the hobgoblins (delint).
      Prefer "command" to "function". Use direct imperative voice.
      Bump version: 57.5.0 → 58.0.0

Louis Maddox (1):
      Remove repeated information in same sentence

SeungMin Lee (1):
      Fix broken links in easy_install.py

Thomas Grainger (13):
      run pre-commit in ci
      blacken docs
      disable unused black pre-commit hook
      Delete pre-commit.yml
      add newsfragment
      remove magci trailing commas
      Delete .pre-commit-config.yaml
      readme: update to reflect the cpython distutils status (#48)
      remove 2to3
      add python_requires example
      add python_requires example
      remove lib2to3 usage
      add newsfragment
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type:enhancement enhance or introduce a new feature
Projects
None yet
Development

No branches or pull requests

5 participants