Skip to content

Commit c302f00

Browse files
committed
update sphinx config
1 parent 7b63483 commit c302f00

File tree

9 files changed

+49
-12
lines changed

9 files changed

+49
-12
lines changed

hypothesis-python/RELEASE.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
RELEASE_TYPE: patch
2+
3+
This patch improves formatting and adds some cross-references to our docs.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/* don't use italics for param names; looks bad with "|" for unions */
2+
.rst-content dl .sig-param {
3+
font-style: normal;
4+
}
5+
6+
/* Take out pointless vertical whitespace in the signatures.
7+
* See also https://github.com/readthedocs/sphinx_rtd_theme/pull/1450 */
8+
.rst-content dl .sig dl,
9+
.rst-content dl .sig dd {
10+
margin-bottom: 0;
11+
}
12+
13+
/* Make signature boxes full-width, with view-source and header links right-aligned. */
14+
.rst-content dl .sig {
15+
width: -webkit-fill-available;
16+
}
17+
.rst-content .viewcode-link {
18+
display: inline-flex;
19+
float: inline-end;
20+
margin-right: 1.5em;
21+
}
22+
.rst-content .headerlink {
23+
position: absolute;
24+
right: 0.5em;
25+
}

hypothesis-python/docs/changes.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7261,7 +7261,7 @@ This release makes it an explicit error to call
72617261
as there are no possible values that can be generated (:issue:`1859`).
72627262

72637263
:func:`floats(min_value=0.0, max_value=-0.0) <hypothesis.strategies.floats>`
7264-
is now deprecated. While `0. == -0.` and we could thus generate either if
7264+
is now deprecated. While ``0. == -0.`` and we could thus generate either if
72657265
comparing by value, violating the sequence ordering of floats is a special
72667266
case we don't want or need.
72677267

@@ -7593,7 +7593,7 @@ one. These shapes are rare and have some odd behavior, but are particularly
75937593
important to test for just that reason!
75947594

75957595
In a related bigfix, :func:`~hypothesis.extra.numpy.arrays` now supports generating
7596-
zero-dimensional arrays with `dtype=object` and a strategy for iterable elements.
7596+
zero-dimensional arrays with ``dtype=object`` and a strategy for iterable elements.
75977597
Previously, the array element would incorrectly be set to the first item in the
75987598
generated iterable.
75997599

@@ -8058,7 +8058,7 @@ This release has no user visible changes but updates our URLs to use HTTPS.
80588058
-------------------
80598059

80608060
Hypothesis can now automatically generate values for Django models with a
8061-
`URLfield`, thanks to a new provisional strategy for URLs (:issue:`1388`).
8061+
`~django.db.models.URLField`, thanks to a new provisional strategy for URLs (:issue:`1388`).
80628062

80638063
.. _v3.86.6:
80648064

hypothesis-python/docs/conf.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
# obtain one at https://mozilla.org/MPL/2.0/.
1010

1111
import datetime
12+
import re
1213
import sys
1314
import types
1415
from pathlib import Path
@@ -18,9 +19,15 @@
1819
root = Path(__file__).parent.parent
1920
sys.path.append(str(root / "src"))
2021

22+
needs_sphinx = re.search(
23+
r"sphinx==([0-9\.]+)", root.joinpath("../requirements/tools.txt").read_text()
24+
).group(1)
25+
default_role = "py:obj"
26+
nitpicky = True
2127

2228
autodoc_member_order = "bysource"
2329
autodoc_typehints = "none"
30+
maximum_signature_line_length = 60 # either one line, or one param per line
2431

2532
extensions = [
2633
"sphinx.ext.autodoc",
@@ -113,6 +120,7 @@ def setup(app):
113120
"attrs": ("https://www.attrs.org/en/stable/", None),
114121
"sphinx": ("https://www.sphinx-doc.org/en/master/", None),
115122
"IPython": ("https://ipython.readthedocs.io/en/stable/", None),
123+
"lark": ("https://lark-parser.readthedocs.io/en/stable/", None),
116124
}
117125

118126
autodoc_mock_imports = ["numpy", "pandas", "redis", "django", "pytz"]
@@ -148,7 +156,7 @@ def setup(app):
148156

149157
html_static_path = ["_static"]
150158

151-
html_css_files = ["wrap-in-tables.css"]
159+
html_css_files = ["better-signatures.css", "wrap-in-tables.css"]
152160

153161
htmlhelp_basename = "Hypothesisdoc"
154162

hypothesis-python/docs/settings.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ specific tests.
230230
231231
Optionally, you may define the environment variable to load a profile for you.
232232
This is the suggested pattern for running your tests on CI.
233-
The code below should run in a `conftest.py` or any setup/initialization section of your test suite.
233+
The code below should run in a ``conftest.py`` or any setup/initialization section of your test suite.
234234
If this variable is not defined the Hypothesis defined defaults will be loaded.
235235

236236
.. code-block:: pycon

hypothesis-python/src/hypothesis/database.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,8 @@ class GitHubArtifactDatabase(ExampleDatabase):
349349
You must provide ``GITHUB_TOKEN`` as an environment variable. In CI, Github Actions provides
350350
this automatically, but it needs to be set manually for local usage. In a developer machine,
351351
this would usually be a `Personal Access Token <https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token>`_.
352-
If the repository is private, it's necessary for the token to have `repo` scope
353-
in the case of a classic token, or `actions:read` in the case of a fine-grained token.
352+
If the repository is private, it's necessary for the token to have ``repo`` scope
353+
in the case of a classic token, or ``actions:read`` in the case of a fine-grained token.
354354
355355
356356
In most cases, this will be used
@@ -400,9 +400,9 @@ class GitHubArtifactDatabase(ExampleDatabase):
400400
does not support downloading artifacts from previous workflow runs.
401401
402402
The database automatically implements a simple file-based cache with a default expiration period
403-
of 1 day. You can adjust this through the `cache_timeout` property.
403+
of 1 day. You can adjust this through the ``cache_timeout`` property.
404404
405-
For mono-repo support, you can provide a unique `artifact_name` (e.g. `hypofuzz-example-db-frontend`).
405+
For mono-repo support, you can provide a unique ``artifact_name`` (e.g. ``hypofuzz-example-db-frontend``).
406406
"""
407407

408408
def __init__(

hypothesis-python/src/hypothesis/extra/ghostwriter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1610,7 +1610,7 @@ def binary_operation(
16101610
16111611
While :wikipedia:`binary operations <Binary_operation>` are not particularly
16121612
common, they have such nice properties to test that it seems a shame not to
1613-
demonstrate them with a ghostwriter. For an operator `f`, test that:
1613+
demonstrate them with a ghostwriter. For an operator ``f``, test that:
16141614
16151615
- if :wikipedia:`associative <Associative_property>`,
16161616
``f(a, f(b, c)) == f(f(a, b), c)``

hypothesis-python/src/hypothesis/strategies/_internal/core.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2124,6 +2124,8 @@ def __init__(self, data):
21242124
self.count = 0
21252125
self.conjecture_data = data
21262126

2127+
__signature__ = Signature() # hide internals from Sphinx introspection
2128+
21272129
def __repr__(self):
21282130
return "data(...)"
21292131

@@ -2182,7 +2184,7 @@ def data() -> SearchStrategy[DataObject]:
21822184
complete information.
21832185
21842186
Examples from this strategy do not shrink (because there is only one),
2185-
but the result of calls to each draw() call shrink as they normally would.
2187+
but the result of calls to each ``data.draw()`` call shrink as they normally would.
21862188
"""
21872189
return DataStrategy()
21882190

tooling/src/hypothesistooling/projects/hypothesispython.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ def build_docs(builder="html"):
6565
# (unfortunately most options only have the short flag version)
6666
tools.scripts.pip_tool(
6767
"sphinx-build",
68-
"-n",
6968
"-W",
7069
"--keep-going",
7170
"-T",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy