celery / billiard

Multiprocessing Pool Extensions
Other
419 stars 252 forks source link

3.6.4.0: sphinx warnings #332

Closed kloczek closed 1 year ago

kloczek commented 3 years ago

On generate man page sphinx reports some warnings:

+ sphinx-build -b man -d billiard Doc .
Running Sphinx v3.5.3
WARNING: Support for evaluating Python 2 syntax is deprecated and will be removed in Sphinx 4.0. Convert /home/tkloczko/rpmbuild/BUILD/billiard-3.6.4.0/Doc/conf.py to Python 3 syntax.
WARNING: html_static_path entry 'static' does not exist
building [mo]: targets for 0 po files that are out of date
building [man]: all manpages
updating environment: [new config] 3 added, 0 changed, 0 removed
reading sources... [100%] library/multiprocessing
/home/tkloczko/rpmbuild/BUILD/billiard-3.6.4.0/Doc/library/multiprocessing.rst:21: WARNING: Unknown interpreted text role "issue".
/home/tkloczko/rpmbuild/BUILD/billiard-3.6.4.0/Doc/library/multiprocessing.rst:451: WARNING: Unknown directive type "doctest".

.. doctest::

    >>> import multiprocessing, time, signal
    >>> p = multiprocessing.Process(target=time.sleep, args=(1000,))
    >>> print(p, p.is_alive())
    <Process(Process-1, initial)> False
    >>> p.start()
    >>> print(p, p.is_alive())
    <Process(Process-1, started)> True
    >>> p.terminate()
    >>> time.sleep(0.1)
    >>> print(p, p.is_alive())
    <Process(Process-1, stopped[SIGTERM])> False
    >>> p.exitcode == -signal.SIGTERM
    True
/home/tkloczko/rpmbuild/BUILD/billiard-3.6.4.0/Doc/library/multiprocessing.rst:838: WARNING: Unknown directive type "doctest".

.. doctest::

    >>> from multiprocessing import Pipe
    >>> a, b = Pipe()
    >>> a.send([1, 'hello', None])
    >>> b.recv()
    [1, 'hello', None]
    >>> b.send_bytes(b'thank you')
    >>> a.recv_bytes()
    b'thank you'
    >>> import array
    >>> arr1 = array.array('i', range(5))
    >>> arr2 = array.array('i', [0] * 10)
    >>> a.send_bytes(arr1)
    >>> count = b.recv_bytes_into(arr2)
    >>> assert count == len(arr1) * arr1.itemsize
    >>> arr2
    array('i', [0, 1, 2, 3, 4, 0, 0, 0, 0, 0])
/home/tkloczko/rpmbuild/BUILD/billiard-3.6.4.0/Doc/library/multiprocessing.rst:1363: WARNING: Unknown directive type "doctest".

.. doctest::

   >>> manager = multiprocessing.Manager()
   >>> Global = manager.Namespace()
   >>> Global.x = 10
   >>> Global.y = 'hello'
   >>> Global._z = 12.3    # this is an attribute of the proxy
   >>> print(Global)
   Namespace(x=10, y='hello')
/home/tkloczko/rpmbuild/BUILD/billiard-3.6.4.0/Doc/library/multiprocessing.rst:1475: WARNING: Unknown directive type "doctest".

.. doctest::

   >>> from multiprocessing import Manager
   >>> manager = Manager()
   >>> l = manager.list([i*i for i in range(10)])
   >>> print(l)
   [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
   >>> print(repr(l))
   <ListProxy object, typeid 'list' at 0x...>
   >>> l[4]
   16
   >>> l[2:5]
   [4, 9, 16]
/home/tkloczko/rpmbuild/BUILD/billiard-3.6.4.0/Doc/library/multiprocessing.rst:1498: WARNING: Unknown directive type "doctest".

.. doctest::

   >>> a = manager.list()
   >>> b = manager.list()
   >>> a.append(b)         # referent of a now contains referent of b
   >>> print(a, b)
   [[]] []
   >>> b.append('hello')
   >>> print(a, b)
   [['hello']] ['hello']
/home/tkloczko/rpmbuild/BUILD/billiard-3.6.4.0/Doc/library/multiprocessing.rst:1514: WARNING: Unknown directive type "doctest".

.. doctest::

    >>> manager.list([1,2,3]) == [1,2,3]
    False
/home/tkloczko/rpmbuild/BUILD/billiard-3.6.4.0/Doc/library/multiprocessing.rst:1553: WARNING: Unknown directive type "doctest".

.. doctest::

   >>> l = manager.list(range(10))
   >>> l._callmethod('__len__')
   10
   >>> l._callmethod('__getslice__', (2, 7))   # equiv to `l[2:7]`
   [2, 3, 4, 5, 6]
   >>> l._callmethod('__getitem__', (20,))     # equiv to `l[20]`
   Traceback (most recent call last):
   ...
   IndexError: list index out of range
/home/tkloczko/rpmbuild/BUILD/billiard-3.6.4.0/Doc/library/multiprocessing.rst:2305: WARNING: Unknown interpreted text role "issue".
/home/tkloczko/rpmbuild/BUILD/billiard-3.6.4.0/Doc/library/multiprocessing.rst:2305: WARNING: Unknown interpreted text role "issue".
/home/tkloczko/rpmbuild/BUILD/billiard-3.6.4.0/Doc/library/multiprocessing.rst:2305: WARNING: Unknown interpreted text role "issue".
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
writing... python-billiard.3 { library/multiprocessing glossary } /home/tkloczko/rpmbuild/BUILD/billiard-3.6.4.0/Doc/library/multiprocessing.rst:123: WARNING: undefined label: threaded-imports
done
build succeeded, 14 warnings.
kloczek commented 3 years ago

Looks like setuptools<>sphinx integration is not finished. Here is the patch

--- a/setup.cfg~        2021-04-01 10:21:32.000000000 +0100
+++ b/setup.cfg 2021-09-05 13:35:26.899272873 +0100
@@ -12,3 +12,6 @@

 [metadata]
 license_file = LICENSE.txt
+
+[build_sphinx]
+source-dir = Doc

With that patch is possible to execute:

+ /usr/bin/python3 setup.py build_sphinx -b man --build-dir build/sphinx
running build_sphinx
Running Sphinx v4.1.2
making output directory... done
WARNING: html_static_path entry 'static' does not exist
building [mo]: targets for 0 po files that are out of date
building [man]: all manpages
updating environment: [new config] 3 added, 0 changed, 0 removed
reading sources... [100%] library/multiprocessing
/home/tkloczko/rpmbuild/BUILD/billiard-3.6.4.0/Doc/library/multiprocessing.rst:21: WARNING: Unknown interpreted text role "issue".
/home/tkloczko/rpmbuild/BUILD/billiard-3.6.4.0/Doc/library/multiprocessing.rst:451: WARNING: Unknown directive type "doctest".

.. doctest::

    >>> import multiprocessing, time, signal
    >>> p = multiprocessing.Process(target=time.sleep, args=(1000,))
    >>> print(p, p.is_alive())
    <Process(Process-1, initial)> False
    >>> p.start()
    >>> print(p, p.is_alive())
    <Process(Process-1, started)> True
    >>> p.terminate()
    >>> time.sleep(0.1)
    >>> print(p, p.is_alive())
    <Process(Process-1, stopped[SIGTERM])> False
    >>> p.exitcode == -signal.SIGTERM
    True
/home/tkloczko/rpmbuild/BUILD/billiard-3.6.4.0/Doc/library/multiprocessing.rst:838: WARNING: Unknown directive type "doctest".

.. doctest::

    >>> from multiprocessing import Pipe
    >>> a, b = Pipe()
    >>> a.send([1, 'hello', None])
    >>> b.recv()
    [1, 'hello', None]
    >>> b.send_bytes(b'thank you')
    >>> a.recv_bytes()
    b'thank you'
    >>> import array
    >>> arr1 = array.array('i', range(5))
    >>> arr2 = array.array('i', [0] * 10)
    >>> a.send_bytes(arr1)
    >>> count = b.recv_bytes_into(arr2)
    >>> assert count == len(arr1) * arr1.itemsize
    >>> arr2
    array('i', [0, 1, 2, 3, 4, 0, 0, 0, 0, 0])
/home/tkloczko/rpmbuild/BUILD/billiard-3.6.4.0/Doc/library/multiprocessing.rst:1363: WARNING: Unknown directive type "doctest".

.. doctest::

   >>> manager = multiprocessing.Manager()
   >>> Global = manager.Namespace()
   >>> Global.x = 10
   >>> Global.y = 'hello'
   >>> Global._z = 12.3    # this is an attribute of the proxy
   >>> print(Global)
   Namespace(x=10, y='hello')
/home/tkloczko/rpmbuild/BUILD/billiard-3.6.4.0/Doc/library/multiprocessing.rst:1475: WARNING: Unknown directive type "doctest".

.. doctest::

   >>> from multiprocessing import Manager
   >>> manager = Manager()
   >>> l = manager.list([i*i for i in range(10)])
   >>> print(l)
   [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
   >>> print(repr(l))
   <ListProxy object, typeid 'list' at 0x...>
   >>> l[4]
   16
   >>> l[2:5]
   [4, 9, 16]
/home/tkloczko/rpmbuild/BUILD/billiard-3.6.4.0/Doc/library/multiprocessing.rst:1498: WARNING: Unknown directive type "doctest".

.. doctest::

   >>> a = manager.list()
   >>> b = manager.list()
   >>> a.append(b)         # referent of a now contains referent of b
   >>> print(a, b)
   [[]] []
   >>> b.append('hello')
   >>> print(a, b)
   [['hello']] ['hello']
/home/tkloczko/rpmbuild/BUILD/billiard-3.6.4.0/Doc/library/multiprocessing.rst:1514: WARNING: Unknown directive type "doctest".

.. doctest::

    >>> manager.list([1,2,3]) == [1,2,3]
    False
/home/tkloczko/rpmbuild/BUILD/billiard-3.6.4.0/Doc/library/multiprocessing.rst:1553: WARNING: Unknown directive type "doctest".

.. doctest::

   >>> l = manager.list(range(10))
   >>> l._callmethod('__len__')
   10
   >>> l._callmethod('__getslice__', (2, 7))   # equiv to `l[2:7]`
   [2, 3, 4, 5, 6]
   >>> l._callmethod('__getitem__', (20,))     # equiv to `l[20]`
   Traceback (most recent call last):
   ...
   IndexError: list index out of range
/home/tkloczko/rpmbuild/BUILD/billiard-3.6.4.0/Doc/library/multiprocessing.rst:2305: WARNING: Unknown interpreted text role "issue".
/home/tkloczko/rpmbuild/BUILD/billiard-3.6.4.0/Doc/library/multiprocessing.rst:2305: WARNING: Unknown interpreted text role "issue".
/home/tkloczko/rpmbuild/BUILD/billiard-3.6.4.0/Doc/library/multiprocessing.rst:2305: WARNING: Unknown interpreted text role "issue".
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
writing... python-billiard.3 { library/multiprocessing glossary } /home/tkloczko/rpmbuild/BUILD/billiard-3.6.4.0/Doc/library/multiprocessing.rst:123: WARNING: undefined label: threaded-imports
done
build succeeded, 13 warnings.
auvipy commented 3 years ago

can you please send a PR?

kloczek commented 3 years ago

Sorry but I'm busy working on other things ..

kloczek commented 3 years ago

You may try to change that semi automatically using https://github.com/schollii/nose2pytest/

auvipy commented 3 years ago

ok thanks for report & suggestions

kloczek commented 1 year ago

As I've alredy presented fix to move 100% to pytest and sphinx warnings are submitted in https://github.com/celery/billiard/issues/366 this ticket can be closed as duplicated 😄