sphinx-contrib / napoleon

Other
148 stars 48 forks source link

DeprecationWarning re: importing Callable from collections #9

Closed anntzer closed 2 years ago

anntzer commented 5 years ago

python -Wall -c 'import sphinxcontrib.napoleon' gives

.../lib/python3.7/site-packages/sphinxcontrib/napoleon/docstring.py:16: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Callable

Applying https://github.com/sphinx-doc/sphinx/commit/bc081e44f8b438fa1e02b17bf6c4f4ea9c91126c#diff-9030d0e02ccc211fcd348c14eb2e7488 should be enough to fix the issue.

JosephRyanPeterson commented 2 years ago

Python 3.10 finally made this breaking change. sphinxcontrib.napoleon now breaks on Python 3.10 (in a sphinx build script) with:

Could not import extension sphinxcontrib.napoleon (exception: cannot import name 'Callable' from 'collections' (/usr/local/lib/python3.10/collections/__init__.py))
JosephRyanPeterson commented 2 years ago

Should be fixed in #36

anntzer commented 2 years ago

Closed by #36, afaict.

parmentelat commented 2 years ago

Hi there

has this change been released yet ?

[apssh] sphinx (devel $=) $ python -c 'import sphinxcontrib.napoleon'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/tparment/miniconda3/envs/apssh/lib/python3.10/site-packages/sphinxcontrib/napoleon/__init__.py", line 13, in <module>
    from sphinxcontrib.napoleon.docstring import GoogleDocstring, NumpyDocstring
  File "/Users/tparment/miniconda3/envs/apssh/lib/python3.10/site-packages/sphinxcontrib/napoleon/docstring.py", line 16, in <module>
    from collections import Callable
ImportError: cannot import name 'Callable' from 'collections' (/Users/tparment/miniconda3/envs/apssh/lib/python3.10/collections/__init__.py)

my environment

[apssh] sphinx (devel $=) $ python --version
Python 3.10.4

[apssh] sphinx (devel $=) $ pip install -U sphinxcontrib-napoleon
Requirement already satisfied: sphinxcontrib-napoleon in /Users/tparment/miniconda3/envs/apssh/lib/python3.10/site-packages (0.7)
Requirement already satisfied: six>=1.5.2 in /Users/tparment/miniconda3/envs/apssh/lib/python3.10/site-packages (from sphinxcontrib-napoleon) (1.16.0)
Requirement already satisfied: pockets>=0.3 in /Users/tparment/miniconda3/envs/apssh/lib/python3.10/site-packages (from sphinxcontrib-napoleon) (0.9.1)

[apssh] sphinx (devel $=) $ pip show sphinxcontrib-napoleon
Name: sphinxcontrib-napoleon
Version: 0.7
Summary: Sphinx "napoleon" extension.
Home-page: https://sphinxcontrib-napoleon.readthedocs.io
Author: Rob Ruana
Author-email: rob@robruana.com
License: BSD
Location: /Users/tparment/miniconda3/envs/apssh/lib/python3.10/site-packages
Requires: pockets, six
Required-by:
vsoch commented 2 years ago

+1 - just hit this issue (and have to disable napolean to use Python 3.10). Could we get an update if it's released / re-open the issue / request to make an new issue (I'd be happy to).

IOANNIS1234 commented 1 year ago

+1 just hit the same issue as well for python 3.10.6.

revaapriyan-ta commented 1 year ago

when installed from pip the #36 is not reflected.

Haaroon commented 1 year ago

This is fixed in prod, In your conf.py file use sphinx.exts.napolean

revaapriyan-ta commented 1 year ago

@Haaroon this helped