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

Setting unsafeHash with attrs raises exception #601

Closed
pashashocky opened this issue Nov 2, 2021 · 6 comments
Closed

Setting unsafeHash with attrs raises exception #601

pashashocky opened this issue Nov 2, 2021 · 6 comments

Comments

@pashashocky
Copy link
Contributor

When setting:

<Format ... unsafeHash="true">attrs</Format>

as part of .xsdata.xml, binding get generated, but on runtime we get a TypeError:

attrs() got an unexpected keyword argument 'unsafe_hash'

since attrs works a little differently to how dataclasses does this.

Reporting this for now, happy to hear your thoughts, I don't feel like freezing my data model right now, but would like to stick with using attrs.

@tefra
Copy link
Owner

tefra commented Nov 2, 2021

yeah the xsdata-attrs should map the dataclasses unsafe_hash property to the the attrs hash property, will update the plugin

@tefra
Copy link
Owner

tefra commented Nov 2, 2021

closed in tefra/xsdata-attrs#8

Thanks for reporting, look out for the next release of the plugin

@tefra tefra closed this as completed Nov 2, 2021
@pashashocky
Copy link
Contributor Author

@tefra thanks! I'm curious - what do you do for a job? Why do you maintain xsdata?
It's awesome and helped my project so much!

@tefra
Copy link
Owner

tefra commented Nov 2, 2021

Thank you @pashashocky ,

At my current workplace I am working exclusively with java but I started xsdata in order to keep up to date with python to be honest and it turned out great! It's the kind of project I wish it was available 8 years ago, but without the typing module and projects like the attrs and dataclasses it wasn't really possible.

@pashashocky
Copy link
Contributor Author

@tefra - sounds awesome! One of the cleanest codebases I've seen in git in a while - massive hats off, learning things from you here as well. Will try to contribute if I find some features I'm missing :)

@pashashocky
Copy link
Contributor Author

@tefra - one of the things I would find very useful as part of xsdata is nested attrs-serde, so the ability to be able to map one data model into another in a more simple way.

Right now it's difficult to translate a complicated xml schema into something more simple while having the ability to filter/aggregate nested fields.

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

No branches or pull requests

2 participants