Skip to content
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

Reorganize code for the typed choice sequence #4254

Merged
merged 1 commit into from
Feb 1, 2025

Conversation

tybug
Copy link
Member

@tybug tybug commented Jan 26, 2025

  • Move providers to providers.py, including HypothesisProvider and PrimitiveProvider. I'm trying to structure things better than sticking everything into data.py, which has become massive (2k lines)
  • AVAILABLE_PROVIDERS has moved from data.py to providers.py, so (@pschanely) crosshair should update its registration code - or we could leave a compatibility alias in data.py?
  • NodeTemplate -> ChoiceTemplate
  • ...a few other obviously-correct renamings
  • no actual behavioral changes

@Zac-HD
Copy link
Member

Zac-HD commented Jan 26, 2025

Nice!

  • AVAILABLE_PROVIDERS has moved from data.py to providers.py, so (@pschanely) crosshair should update its registration code - or we could leave a compatibility alias in data.py?

Let's leave an alias for now - it's an unstable but public-ish interface and so I think the small effort is justified. We could use the __getattr__ trick as for MultipleFailures to issue a deprecation warning.

@tybug
Copy link
Member Author

tybug commented Jan 26, 2025

something tells me mypyc will be very unhappy with getattr 😄

(e: both surprised and happy to discover that mypyc behaves correctly here, though I'll have to double check later that we don't lose performance on the entire file as a result)

@tybug tybug force-pushed the tcs-cleanup branch 2 times, most recently from 74b86bd to 5fd3349 Compare January 31, 2025 21:08
@@ -124,7 +114,6 @@ def __repr__(self) -> str:
return f"Status.{self.name}"


@dataclass_transform()
@attr.s(slots=True, frozen=True)
class StructuralCoverageTag:
Copy link
Member Author

@tybug tybug Feb 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming dataclass_transform isn't necessary on our side nowadays - hopefully attrs is applying it to all attrs classes themselves?

@Zac-HD Zac-HD merged commit 63bb80c into HypothesisWorks:master Feb 1, 2025
50 checks passed
@Zac-HD
Copy link
Member

Zac-HD commented Feb 1, 2025

This also reminded me that primary/secondary are rather non-descriptive names for database keys; per #4155 maybe we can rename to use more-descriptive names? (no suggestions for that yet, though)

@tybug tybug deleted the tcs-cleanup branch February 1, 2025 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants