https://github.com/lukasturcani/debug_annotations
https://github.com/lukasturcani/debug_annotations
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/lukasturcani/debug_annotations
- Owner: lukasturcani
- Created: 2023-09-11T13:47:30.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2023-09-11T14:19:02.000Z (about 2 years ago)
- Last Synced: 2025-01-10T17:17:47.026Z (9 months ago)
- Language: Python
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
This repo demonstrates a weird bug with ``.. autosummary::``.
Steps to reproduce:
#. Clone the repo
#. ``pip install -e .``
#. ``make -C docs doctest``At this point you will see output like::
**********************************************************************
File "index.rst", line 35, in default
Failed example:
import debug_annotationsraise RuntimeError(debug_annotations.B.__annotations__)
Exception raised:
Traceback (most recent call last):
File "/home/lukas/projects/debug-annotations/.venv/lib/python3.11/doctest.py", line 1351, in __run
exec(compile(example.source, filename, "single",
File "", line 3, in
raise RuntimeError(debug_annotations.B.__annotations__)
RuntimeError: {'y': , 'x': 'int'}
**********************************************************************So, why is this weird? Well, the annotations of the class ``B``
should be ``{'y': }`` -- because the ``x`` attribute is
inherited from ``A``.let run the code again!
#. ``make -C docs doctest``
now our output will be::
**********************************************************************
File "index.rst", line 35, in default
Failed example:
import debug_annotationsraise RuntimeError(debug_annotations.B.__annotations__)
Exception raised:
Traceback (most recent call last):
File "/home/lukas/projects/debug-annotations/.venv/lib/python3.11/doctest.py", line 1351, in __run
exec(compile(example.source, filename, "single",
File "", line 3, in
raise RuntimeError(debug_annotations.B.__annotations__)
RuntimeError: {'y': }
**********************************************************************This is correct! In fact if we continue to re-run the ``doctest`` --
our annotations will be correct. However if we do#. ``rm -r docs/source/_autosummary``
#. ``make -C docs doctest``our error will return! is this some kind of caching issue?