HypothesisWorks / HypothesisWorks/hypothesis

Rename some internals for clarity

Open
#4,166 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

internals legibility
Dominant language
Python
Stars
9k
Forks
675
Avg merge
4d 5h
Merged PRs (30d)
8

Description

Naming things is famously, uh, less easy than we might hope. This issue tracks two renames I'd like to do at some point:

  • Rename the conjecture.data.Example class to Span, as suggested in #4164. The word "example" is pretty badly overloaded in our codebase, and so using a short and distinct word should help - I think it's also more indicative of what this subsystem does. We'll wait for the IR changes to settle down first though.

  • Rename the "primary" and "secondary" database keys to indicate that they store minimal and non-minimal failing examples respectively. This has caused confusion before, see e.g. #4155, and should smooth out interoperability with e.g. HypoFuzz. I'm inclined to come up with canonical names + keys for covering examples (including un/shrunk, and location-vs-set-of-locations), and likely provide a helper function to compute said keys.

  • ChoiceNode.kwargs to ChoiceNode.constraints, and see if we can find more-specific names for "kwargs" anywhere else

  • Consider renaming the label argument in DataStrategy.draw, which has different meaning than the similarly named argument in ConjectureData.draw. Or rename the latter, which is more inconvenient but avoids public API change. (There's also .calc_label(), which relates to the ConjectureData semantics (?))

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with hypothesis-python/src/hypothesis/internal/conjecture/data.py and inspect the remaining references to the database keys, DataStrategy.draw, ConjectureData.draw, and calc_label(). Done means the unchecked naming decisions are resolved and affected symbols and references use consistent names.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.