litestar-org/polyfactory

Enhancement: Add AttrsFactory

Closed this issue · 13 comments

Summary

We should support attrs based models generation. This would be a largist contribution but would be very much appreciated.

Basic Example

No response

Drawbacks and Impact

No response

Unresolved questions

No response

Fund with Polar

I have never built something like this, but if no one is working on this can I pick this up want to learn.

great, go ahead

guacs commented

@r4gesingh47 are you working on this? If not, I'd like to take a crack at it

@guacs I am but with slow progress, if you want to take it up you could. I will anyway do it for learning.

guacs commented

@guacs I am but with slow progress, if you want to take it up you could. I will anyway do it for learning.

No no go ahead and do it then. If you want any help let me know.

@guacs you can pick it up, I am not able to give it that much time.

@guacs are you willing to take this one on? it shouldn't be complex to do.

guacs commented

@guacs are you willing to take this one on? it shouldn't be complex to do.

Yeah I'm willing to take this. I'll try to get the PR for it ready this week.

great

guacs commented

@Goldziher is the default value passed to the FieldMeta ever used? I couldn't find any place where the default value is used in cases where default is not Null.

The reason this came up is that attrs allows for passing self to the default factory callable and I was trying to figure out how to implement that. However, that is used for being able to set the default factory callable as a decorator on the class itself as shown here.

@Goldziher is the default value passed to the FieldMeta ever used? I couldn't find any place where the default value is used in cases where default is not Null.

The reason this came up is that attrs allows for passing self to the default factory callable and I was trying to figure out how to implement that. However, that is used for being able to set the default factory callable as a decorator on the class itself as shown here.

Not at present. I would like to have __prefer_default_values__ option on the base factory and then use it.

guacs commented

Aah gotcha. Would you like me to raise a PR implementing that, or has that already been planned?

Aah gotcha. Would you like me to raise a PR implementing that, or has that already been planned?

Sure, go ahead