Pycharm highlights "Unexpected argument in ConfigDict
For Djantic2 we need model_config = ConfigDict(model = ... , include = ....) pycharm flags this with a warning that model and include are not expected.
I think something needs doing to let the type system know that this is OK.
Since ConfigDict belongs to pydantic, could please let me know what version of pydantic you're running? I'm also assuming that you're running latest version of djantic2.
Good point -
pydantic 2.11.4 djantic2 1.0.5
I guess it does belong to pydantic, but I don't think they have a way of adding fields (I wish they did), so maybe djantic needs it it's own ConfigDict ?
Another question, can you replicate this with mypy or similar? I appreciate that you're seeing this in pycharm. But pycharm is also proprietary so it would be good to know where this comes from more explicitly.
Hey folks @stuaxo @jonathan-s I can confirm that the same happens on mypy. I was just now using this lib (which is awesome, by the way) and got the following:
mypy: Extra key "model" for TypedDict "ConfigDict" [typeddict-unknown-key]
Versions of what I have here:
pydantic==2.11.1
Django==5.2
djantic2==1.0.5
The solution for now is to include a comment # type: ignore[typeddict-unknown-key].
Thanks, the reason I didn't get to this is that I have yet to try mypy in a project.
I wonder what the solution is, should Djantic2 include it's own versions of these that have the extra type annotations ?
@stuaxo I think that would be the most appropriate/fast solution. Right now I'm in a mess of job applications/interviews, but as soon as I get some time I can give it a shot. If it works well I can then open a PR for you all take a look
@stuaxo I think that would be the most appropriate/fast solution. Right now I'm in a mess of job applications/interviews, but as soon as I get some time I can give it a shot. If it works well I can then open a PR for you all take a look
Yeah, that seems like a sensible approach, probably the djantic config dict should inherit from the pydantic.