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

Parser is unset when a static analysis cannot find a docstring, but dynamic can #364

Open
machow opened this issue Sep 11, 2024 · 0 comments

Comments

@machow
Copy link
Owner

machow commented Sep 11, 2024

From this ibis comment (cc @cpcloud , @jcrist): https://github.com/ibis-project/ibis/pull/10079/files/152f15265038453bd34a4742a1c34ac913ced186#r1752391475

When a user dynamically loads a docstring, quartodoc does the following:

  • loads object statically (as griffe data)
  • loads object dynamically (as an import)
  • replaces the static object's docstring with the dynamic one

quartodoc tries to preserve the parser settings when doing this, by copying the settings from the static docstring. However, when there's no static docstring, it accidentally sets things like parser to None. This means that tools like griffe don't know it's parsing a numpy docstring.

See

  • old = obj.docstring
    new = dc.Docstring(
    value=f.__doc__,
    lineno=getattr(old, "lineno", None),
    endlineno=getattr(old, "endlineno", None),
    parent=getattr(old, "parent", None),
    parser=getattr(old, "parser", None),
    parser_options=getattr(old, "parser_options", None),
    )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant