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

Decorate Pack as dataclass #3215

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft

Conversation

HalfWhitt
Copy link
Contributor

@HalfWhitt HalfWhitt commented Feb 26, 2025

(Based off #3213 for now)

With the aliases all defined as class attribute descriptors as of #3213, Pack can be successfully decorated as a dataclass.

The only test that fails-as-is is test_mixin.py::test_constructor, because the auto-genereated dataclass __init__ throws a TypeError rather than a NameError when an erroneous property name is provided. I've changed what the test looks for, and also added a try/except to BaseStyle's fallback __init__ so that the same error is generated under Python 3.9.

Edit: Huh. What are the odds, it's been exactly one year, to the day, since I started this with beeware/travertino#141. I definitely didn't anticipate how long that would take 😄

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

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.

1 participant