- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Autodoc attempts to resolves strings in Literal() to references in 5.0 #10497
Labels
Milestone
Comments
Might be identical to: #9775 |
Running the following import shutil
from pathlib import Path
from sphinx.cmd.make_mode import run_make_mode
def write(filename, text): Path(filename).write_text(text, encoding="utf-8")
write("bug.py", '''\
from typing import Literal
def write_deltalake(mode: Literal["error", "append"] = "error"): ...
''')
write("conf.py", '''\
import os, sys
sys.path.insert(0, os.path.abspath("."))
extensions = ['sphinx.ext.autodoc']
nitpicky = True
''')
write("index.rst", '''\
.. autofunction:: bug.write_deltalake
''')
shutil.rmtree("_build", ignore_errors=True)
run_make_mode(["html", ".", "_build", "-T", "-W"]) as A |
Thanks for the script @AA-Turner. I confirm that your script doesn't reproduce the error, but if I add the line import shutil
from pathlib import Path
from sphinx.cmd.make_mode import run_make_mode
def write(filename, text): Path(filename).write_text(text, encoding="utf-8")
write("bug.py", '''\
from typing import Literal
def write_deltalake(mode: Literal["error", "append"] = "error"): ...
''')
write("conf.py", '''\
import os, sys
sys.path.insert(0, os.path.abspath("."))
extensions = ['sphinx.ext.autodoc']
autodoc_typehints = "description"
nitpicky = True
''')
write("index.rst", '''\
.. autofunction:: bug.write_deltalake
''')
shutil.rmtree("_build", ignore_errors=True)
run_make_mode(["html", ".", "_build", "-T", "-W"]) Does that also work for you? full output
|
This was referenced Jun 2, 2022
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Describe the bug
Starting in 5.0, we get an error processing these lines for autodoc:
https://github.com/delta-io/delta-rs/blob/5a293dd5e899167944cdb447599ed5f3f8916a22/python/deltalake/writer.py#L65
with the warning (treated as error):
If I modify the function signature to
I get the error
so I feel pretty sure it's looking at those string values.
How to Reproduce
See CI run:
https://github.com/delta-io/delta-rs/runs/6659471490?check_suite_focus=true
Expected behavior
Renders without warning, not attempting to resolve those strings as some class reference. I've tested locally on MacOS and Linux and it works fine on versions 4.3 and 4.5. We have not changed that line since it was last published: https://delta-io.github.io/delta-rs/python/api_reference.html#writing-deltatables
Your project
https://delta-io.github.io/delta-rs/python/api_reference.html#writing-deltatables
Screenshots
No response
OS
Linux and MacOS
Python version
3.10
Sphinx version
5.0.0
Sphinx extensions
sphinx.ext.autodoc
Extra tools
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: