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

Yields not supported in numpydocstring #338

Open
griff-rees opened this issue Mar 11, 2024 · 0 comments
Open

Yields not supported in numpydocstring #338

griff-rees opened this issue Mar 11, 2024 · 0 comments
Labels
api:renderer type:bug Something isn't working

Comments

@griff-rees
Copy link

griff-rees commented Mar 11, 2024

Thanks for the great project!

I'm using version 0.7.2. I initially thought this would be a griffe feature request but it looks like numpydocstring yield is supported and it's listed in the docs here:

* Parameters
* Returns
* Yields
* Receives
* Other Parameters
* Raises
* Warns
* Warnings
* Notes
* References
* Examples

Would that mean some of this could then be addressed here? Though I assume this is actually just excluding singular rather than plural terms (and I'm using Yields) and perhaps that should raise a different error?

@dispatch.multi(
(ds.DocstringAdmonition,),
(ds.DocstringDeprecated,),
(ds.DocstringWarn,),
(ds.DocstringYield,),
(ds.DocstringReceive,),
(ds.DocstringAttribute,),
)
def render(self, el):
raise NotImplementedError(f"{type(el)}")

Below is a minimal example inspired by griffe docs:

from typing import Iterator


def yielder(max: int = 10) -> Iterator[int]:
    """`Yield` `ints` from 0 to `max`.

    Parameters
    ----------
    max
        `int` to iterate `yields` starting from 0.

    Yields
    ------
    :
        `int`s ascending to `max`

    Examples
    --------
    >>> ints = yielder()
    >>> next(ints)
    1

    """
    for i in range(max):
        yield i
$ quartodoc build
Traceback (most recent call last):
  File "/home/user/example/.venv/bin/quartodoc", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/home/user/example/.venv/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/example/.venv/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/user/example/.venv/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/example/.venv/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/example/.venv/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/example/.venv/lib/python3.11/site-packages/quartodoc/__main__.py", line 218, in build
    doc_build()
  File "/home/user/example/.venv/lib/python3.11/site-packages/quartodoc/autosummary.py", line 568, in build
    self.write_doc_pages(pages, filter)
  File "/home/user/example/.venv/lib/python3.11/site-packages/quartodoc/autosummary.py", line 614, in write_doc_pages
    rendered = self.renderer.render(page)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/example/.venv/lib/python3.11/site-packages/plum/function.py", line 484, in __call__
    return self._f(self._instance, *args, **kw_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/example/.venv/lib/python3.11/site-packages/plum/function.py", line 368, in __call__
    return _convert(method(*args, **kw_args), return_type)
                    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/example/.venv/lib/python3.11/site-packages/quartodoc/renderers/md_renderer.py", line 212, in render
    return "\n\n".join([*header, *result])
                       ^^^^^^^^^^^^^^^^^^
  File "/home/user/example/.venv/lib/python3.11/site-packages/plum/function.py", line 484, in __call__
    return self._f(self._instance, *args, **kw_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/example/.venv/lib/python3.11/site-packages/plum/function.py", line 368, in __call__
    return _convert(method(*args, **kw_args), return_type)
                    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/example/.venv/lib/python3.11/site-packages/quartodoc/renderers/md_renderer.py", line 335, in render
    [self.render(x) for x in raw_meths if isinstance(x, layout.Doc)]
  File "/home/user/example/.venv/lib/python3.11/site-packages/quartodoc/renderers/md_renderer.py", line 335, in <listcomp>
    [self.render(x) for x in raw_meths if isinstance(x, layout.Doc)]
     ^^^^^^^^^^^^^^
  File "/home/user/example/.venv/lib/python3.11/site-packages/plum/function.py", line 484, in __call__
    return self._f(self._instance, *args, **kw_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/example/.venv/lib/python3.11/site-packages/plum/function.py", line 368, in __call__
    return _convert(method(*args, **kw_args), return_type)
                    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/example/.venv/lib/python3.11/site-packages/quartodoc/renderers/md_renderer.py", line 354, in render
    return "\n\n".join([title, *sig_part, self.render(el.obj)])
                                          ^^^^^^^^^^^^^^^^^^^
  File "/home/user/example/.venv/lib/python3.11/site-packages/plum/function.py", line 484, in __call__
    return self._f(self._instance, *args, **kw_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/example/.venv/lib/python3.11/site-packages/plum/function.py", line 368, in __call__
    return _convert(method(*args, **kw_args), return_type)
                    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/example/.venv/lib/python3.11/site-packages/quartodoc/renderers/md_renderer.py", line 369, in render
    body = self.render(section)
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/user/example/.venv/lib/python3.11/site-packages/plum/function.py", line 484, in __call__
    return self._f(self._instance, *args, **kw_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/example/.venv/lib/python3.11/site-packages/plum/function.py", line 368, in __call__
    return _convert(method(*args, **kw_args), return_type)
                    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/example/.venv/lib/python3.11/site-packages/quartodoc/renderers/md_renderer.py", line 194, in render
    raise NotImplementedError(f"Unsupported type: {type(el)}")
NotImplementedError: Unsupported type: <class 'griffe.docstrings.dataclasses.DocstringSectionYields'>
@griff-rees griff-rees changed the title Yields not supported in a numpydocstring Yields not supported in numpydocstring Mar 11, 2024
@machow machow added this to quartodoc Aug 20, 2024
@machow machow added type:bug Something isn't working api:renderer labels Aug 20, 2024
@machow machow moved this to Todo in quartodoc Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api:renderer type:bug Something isn't working
Projects
Status: Todo
Development

No branches or pull requests

2 participants