-
Notifications
You must be signed in to change notification settings - Fork 590
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
Add new Sphinx configuration options #3860
Labels
docs
documentation could *always* be better
Comments
Ooooh boy, getting nice docs for type annotations is going to be harder than I'd hoped.
|
OK, I'm just going to abandon the type-annotations part because I'm not sure whether it's net-positive for readers, and want to ship the rest of the stuff above quickly. If we revisit in future, you can jumpstart with: autodoc_member_order = "bysource"
-autodoc_typehints = "none"
+autodoc_typehints = "signature"
maximum_signature_line_length = 60 # either one line, or one param per line
+nitpick_ignore = [
+ # CPython docs limitations
+ ("py:class", "module"),
+ ("py:class", "ellipsis"),
+ # TypeVars we don't want to document
+ ("py:class", "P"),
+ ("py:class", "hypothesis.core.TestFunc"),
+ ("py:class", "hypothesis.extra.array_api.DataType"),
+ ("py:class", "hypothesis.extra.django._fields.F"),
+ ("py:class", "hypothesis.extra.django._impl.ModelT"),
+ ("py:class", "hypothesis.extra.ghostwriter.X"),
+ ("py:class", "hypothesis.extra.ghostwriter.Y"),
+ ("py:class", "hypothesis.extra.numpy.D"),
+ ("py:class", "hypothesis.strategies._internal.strategies.Ex"),
+ ("py:class", "hypothesis.strategies._internal.strategies.Ex_Inv"),
+ ("py:class", "hypothesis.strategies._internal.strategies.T"),
+ # Other internal classes we don't want to document
+ ("py:class", "Verbosity"),
+ ("py:class", "hypothesis.extra._array_helpers.BroadcastableShapes"),
+ ("py:class", "hypothesis.stateful.Bundle"),
+ ("py:class", "hypothesis.stateful.MultipleResults"),
+ ("py:class", "hypothesis.stateful._OmittedArgument"),
+ ("py:class", "hypothesis.strategies._internal.core.RandomSeeder"),
+ ("py:class", "hypothesis.utils.conventions.UniqueIdentifier"),
+ # Random other issues
+ ("py:class", "hypothesis.strategies.SearchStrategy[numpy.typing.NDArray.~D]"),
+ (
+ "py:class",
+ "hypothesis.strategies.SearchStrategy[~typing.Tuple[numpy.typing.NDArray.~D, ...]]",
+ ),
+] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From this page on Sphinx configuration options, I think there are some new ones we should try out:
nitpicky = True
to warn about more missing references. Also set thedefault_role
topy:obj
, which will ensure the most common cases work out after all. (main effect: CI will now warn when people use single instead of double-backticks for monospace)needs_sphinx
- dynamically load this fromrequirements/tools.txt
so it stays up-to-date with our pins? We install from pins on readthedocs so this should work fine. Convert the==
to>=
so that checking out an old branch doesn't force a downgrade to build docs.maximum_signature_line_length
andpython_...
- going to one argument per line will enable us to show type annotations again (changingautodoc_typehints
from none to signature); we'll also want to setautodoc_type_aliases
and perhaps load this dynamically from the source code (matching on_: TypeAlias = _
lines - actually this would be a great feature to upstream!)The text was updated successfully, but these errors were encountered: