Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1913266 - mkdocs fails to build with Python 3.10: ImportError: cannot import name 'Sequence' from 'collections'
Summary: mkdocs fails to build with Python 3.10: ImportError: cannot import name 'Sequ...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: mkdocs
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Robin Lee
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.10
TreeView+ depends on / blocked
 
Reported: 2021-01-06 11:49 UTC by Tomáš Hrnčiar
Modified: 2021-06-14 10:41 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-06-14 10:38:26 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2021-01-06 11:49:21 UTC
mkdocs fails to build with Python 3.10.0a4.

======================================================================
ERROR: tests.utils.ghp_import_tests (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: tests.utils.ghp_import_tests
Traceback (most recent call last):
  File "/usr/lib64/python3.10/unittest/loader.py", line 436, in _find_test_path
    module = self._get_module_from_name(name)
  File "/usr/lib64/python3.10/unittest/loader.py", line 377, in _get_module_from_name
    __import__(name)
  File "/builddir/build/BUILD/mkdocs-1.1.2/mkdocs/tests/utils/ghp_import_tests.py", line 13, in <module>
    class UtilsTests(unittest.TestCase):
  File "/builddir/build/BUILD/mkdocs-1.1.2/mkdocs/tests/utils/ghp_import_tests.py", line 15, in UtilsTests
    @mock.patch('subprocess.call', auto_spec=True)
  File "/usr/lib64/python3.10/unittest/mock.py", line 1736, in patch
    return _patch(
  File "/usr/lib64/python3.10/unittest/mock.py", line 1275, in __init__
    _check_spec_arg_typos(kwargs)
  File "/usr/lib64/python3.10/unittest/mock.py", line 1251, in _check_spec_arg_typos
    raise RuntimeError(
RuntimeError: 'auto_spec' might be a typo; use unsafe=True if this is intended

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.10/fedora-rawhide-x86_64/01859956-mkdocs/

For all our attempts to build mkdocs with Python 3.10, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/package/mkdocs/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.10:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/

Let us know here if you have any questions.

Python 3.10 will be included in Fedora 35. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.10.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Ben Cotton 2021-02-09 15:37:26 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 34 development cycle.
Changing version to 34.

Comment 2 Karthikeyan Singaravelan 2021-02-17 15:36:09 UTC
The vendored copy of the file seems to have been removed in https://github.com/mkdocs/mkdocs/commit/5c2b4f13536009852046c89aadd63ac46eacbaaa and should fix the issue. This is due to some validations done from mock in Python 3.10 to catch typos : https://github.com/python/cpython/pull/23737

Comment 3 Tomáš Hrnčiar 2021-03-26 12:15:13 UTC
(In reply to Karthikeyan Singaravelan from comment #2)
> The vendored copy of the file seems to have been removed in
> https://github.com/mkdocs/mkdocs/commit/
> 5c2b4f13536009852046c89aadd63ac46eacbaaa and should fix the issue. This is
> due to some validations done from mock in Python 3.10 to catch typos :
> https://github.com/python/cpython/pull/23737

Backporting this commit indeed fixes the issue with Python 3.10. This commit also introduces a new dependency on ghp-import. We have only ghp-import2 in Fedora, so it would be good to communicate with the maintainer to switch to ghp-import (https://pypi.org/project/ghp-import/).

Comment 4 Miro Hrončok 2021-03-26 12:23:51 UTC
To clarify, ghp-import2 was created long time ago as an active fork of (dead at the time) ghp-import. But now the situation is reversed and ghp-import is active, ghp-import2 is dead.

In Fedora, we have ghp-import2 packaged, for nikola, but nikola already switched as well: https://github.com/getnikola/nikola/commit/6bafa5f28e1a96411bbd85c0e9fd4309d82ba5e3

CCing the Fedora maintainer of nikola and ghp-import2

Comment 5 Miro Hrončok 2021-06-04 20:16:02 UTC
This is a mass-posted update. Sorry if it is not 100% accurate to this bugzilla.


The Python 3.10 rebuild is in progress in a Koji side tag. If you manage to fix the problem, please commit the fix in the rawhide branch, but don't build the package in regular rawhide.

You can either build the package in the side tag, with:

    $ fedpkg build --target=f35-python

Or you can the build and we will eventually build it for you.

Note that the rebuild is still in progress, so not all (build) dependencies of this package might be available right away.

Thanks.

See also https://fedoraproject.org/wiki/Changes/Python3.10

If you have general questions about the rebuild, please use this mailing list thread: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/G47SGOYIQLRDTWGOSLSWERZSSHXDEDH5/

Comment 6 Miro Hrončok 2021-06-07 09:29:38 UTC
The current failure is:

+ /usr/bin/python3 -m mkdocs build
Traceback (most recent call last):
  File "/usr/lib64/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib64/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/builddir/build/BUILD/mkdocs-1.1.2/mkdocs/__main__.py", line 15, in <module>
    from mkdocs import config                                 # noqa: E402
  File "/builddir/build/BUILD/mkdocs-1.1.2/mkdocs/config/__init__.py", line 2, in <module>
    from mkdocs.config.defaults import DEFAULT_SCHEMA
  File "/builddir/build/BUILD/mkdocs-1.1.2/mkdocs/config/defaults.py", line 1, in <module>
    from mkdocs.config import config_options
  File "/builddir/build/BUILD/mkdocs-1.1.2/mkdocs/config/config_options.py", line 2, in <module>
    from collections import Sequence, namedtuple
ImportError: cannot import name 'Sequence' from 'collections' (/usr/lib64/python3.10/collections/__init__.py)


Upstream fix: https://github.com/mkdocs/mkdocs/commit/72f506dcce8db268ae4b3798cd30c8afd378d076

Comment 7 Ben Beasley 2021-06-07 10:55:02 UTC
I have submitted a PR that resolves this (https://src.fedoraproject.org/rpms/mkdocs/pull-request/2).

- It includes the commit you referenced as a patch.
- It also backports another upstream commit to fix an IP address parsing bug with python 3.9.5 and later, not previously reported in this issue, which was causing a test failure.
- Finally, it includes a temporary downstream patch for the “auto_spec” problem mentioned above, which simply changes the keyword argument to “autospec” without introducing the new “ghp-import” dependency.

All of these patches can be dropped after the next upstream release.

Collectively, this resolves all of the test failures and other issues on Python 3.10.

Comment 8 Miro Hrončok 2021-06-07 23:00:21 UTC
The f35-python side tag has been merged to Rawhide. From now on, build as you would normally build.

Comment 9 Miro Hrončok 2021-06-14 10:38:26 UTC
This package was successfully rebuilt with Python 3.10.

If you need this bugzilla open for tracking purposes, sorry for the automatic closing: feel free to reopen it.

Comment 10 Miro Hrončok 2021-06-14 10:41:18 UTC
This package was successfully rebuilt with Python 3.10.

If you need this bugzilla open for tracking purposes, sorry for the automatic closing: feel free to reopen it.


Note You need to log in before you can comment on or make changes to this bug.