-
Notifications
You must be signed in to change notification settings - Fork 37
switch to ruff and fix some typing #370
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
Conversation
ran `ruff check` and `ruff format`
See sphinx-doc/sphinx#12492 The mypy warning only applies to `sphinx>=v7.4`, but the code is only executed for `sphinx<v6.2.0`.
|
The docs' build error seems unrelated to these changes.
I suspect there's something different with Sphinx' |
|
I found the change in sphinx-doc/sphinx#11785. I'm not sure if there's something we need to do to compensate. |
|
I found the culprit. So, I'm not yet sure where to go from here. I'd prefer to skip displaying the |
|
I agree that the I don't think this problem necessarily has much to do with our monkey patching, which affects how Python attributes are displayed --- those same Annotated types could still occur elsewhere that would already be displayed using One trick I've used is to set some env var or other indication in Is there a way to do validation with pydantic that does not rely on Annotated types? Alternatively we could add some options to apidoc/python/type_annotation_transforms.py to exclude Annotations that match certain user-defined patterns. |
I think so. I haven't looked at their docs in a while. But I think this fix would only be specific to our docs. Like you said, this might already be affecting end-user doc projects.
This is the first place I started looking when trying to find the culprit. I would favor something similar to |
You're right. These warnings only surface because our docs use sphinx-immaterial/docs/conf.py Line 457 in 1c31f48
|
|
I can add to our conf.py's |
|
I opted for "avoid doc-ing This is being tracked upstream in sphinx-doc/sphinx#12601. Although, I must say it was difficult to determine if it is specific to our theme or not because of the various monkey-patching and my unfamiliarity with sphinx autodoc/domains API. |
|
@jbms could you install the CodeCov app on this repo? The CodeCov site is unable to list coverage differences between head and base branches. |
Replace tools black and pylint with ruff
# pylint: disablecomments# noqacoments to disable some checks in certain contextsNote
The
ruff checkcommand respects the project's metadatapython-requires. Whereas pylint would only focus on the version of python that was used to run it.See ruff docs for more detail.
Fix/abate typing
As per usual updates to mypy and sphinx, some typing warnings had to be suppressed in monkeypatching code.
The only change in sphinx that might need attention is the change in
sphinx.directivesuse ofsphinx.util.nodes.nested_parse_with_titles()which we are monkey patching forsphinx<6.2.0only. See sphinx-doc/sphinx#12492 for change in v7.4.0 and the fix that the monkey patch applies in sphinx-doc/sphinx#11147.