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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support attrs alias and private attributes in st.builds #3807

Merged
merged 2 commits into from Dec 8, 2023

Conversation

tybug
Copy link
Member

@tybug tybug commented Dec 7, 2023

Closes #3791.

More generally, adds support for attr's alias parameter. On master, the following errors, for instance:

@attr.s
class HasAliasedAttribute:
    x: int = attr.ib(alias="crazyname")

st.builds(HasAliasedAttribute)

Attrs also helpfully fills in alias with the correctly-stripped version of private attributes, which is why this fixes the linked issue.

attrs only added alias in 22.2.0. I probably could have thrown a if attrs.__version__ in here and made things backwards compatible, but it would have complicated things, so I've taken the easier option of bumping the dependency. There is precedence for this, but if this is a tough sell I can work on continuing to support previous versions.

P.S. I thought I would take a small break from IR pulls to do some good ol' bug fixing. I'm continuing to work on migrating the datatree to the IR, though! 馃檪

Copy link
Member

@Zac-HD Zac-HD left a comment

Choose a reason for hiding this comment

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

Nice work!

"attrs>=19.2.0",
"attrs>=22.2.0",
Copy link
Member

Choose a reason for hiding this comment

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

I was pretty nervous about this, but checking download stats it seems likely to be fine 馃檪

@Zac-HD Zac-HD merged commit 650adc9 into HypothesisWorks:master Dec 8, 2023
47 checks passed
@tybug tybug deleted the attrs-private-bug branch December 8, 2023 03:58
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.

builds fails when used with attrs classes containing private attributes
2 participants