Comments (2)
Ooooh boy, getting nice docs for type annotations is going to be harder than I'd hoped.
maximum_signature_line_length
makes signatures pretty ugly via readthedocs/sphinx_rtd_theme#1529 / readthedocs/sphinx_rtd_theme#1450.- I'd also want the blue shading to span the column, like an
.. info::
box, rather than stopping at the signature width. - Both might be fixable with custom CSS downstream?
- I'd also want the blue shading to span the column, like an
autodoc_type_aliases
only works withfrom __future__ import annotations
... i.e. PEP-563, which in Python 3.13 will be replaced by PEP-649. In any case, this is pretty painful - we'll want to have some way of post-processing the annotation strings and that'll probably need a custom Sphinx plugin (though not a huge one)- The type annotations get autolinked, which is fine, but then nitpicky mode complains that the type annotations aren't documented and this is pretty annoying.
- Fortunately we can break out
nitpick_ignore = [...]
for whatever we don't want to document, such as typevars - There are also a few strings which just seem to be resolution errors.
- Fortunately we can break out
- maybe https://github.com/tox-dev/sphinx-autodoc-typehints would be helpful, going to see if I can get away without it first
from hypothesis.
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, ...]]",
+ ),
+]
from hypothesis.
Related Issues (20)
- Can one tune run time of RuleBasedStateMachine? HOT 2
- Improve discrimination of database keys HOT 5
- Random failures with hypothesis.errors.StopTest exception raised HOT 7
- Die Hard example uses outdated style of defining settings HOT 2
- Logging each test before running it HOT 1
- Can we consider optionally disabling automatic repr-printing and jsonification when `TESTCASE_CALLBACKS` are present? HOT 2
- How to exclude property? for `hypothesis.errors.ResolutionFailed: Could not infer a strategy for <django.db.models.fields.AutoField: id>` HOT 1
- Fix missing imports for `hypothesis write numpy.save`
- from_type fails on nested annotated type with mysterious error HOT 7
- `hypothesis.strategies.text` fails if min_size is (unreasonably) large HOT 2
- hypothesis.errors.InvalidArgument: min_size=8_640 is larger than Hypothesis is designed to handle HOT 1
- numpy arrays() strategy does not respect (unsigned) dtype (anymore) HOT 1
- Some type annotations for `hypothesis.extra.pandas` are missing HOT 1
- Generate `st.fixed_dictionaries()` with varied iteration orders
- Empty dictionaries generated with st.dictionaries and st.just despite expected behavior HOT 2
- Implement an Atheris fuzzing backend HOT 2
- Stable support for symbolic execution HOT 15
- TypeError on CPython 3.13 for 6.99.2 HOT 1
- Investigate and fix lambda bug on Python 3.13
- Migrate our core representation to an IR layer HOT 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hypothesis.