erhosen-libs / pydjantic

Use Pydantic Settings in your Django application.
MIT License
36 stars 9 forks source link

Type support #29

Closed Zenthae closed 8 months ago

Zenthae commented 8 months ago

Hello, from what I can see, types are implemented, so, would it be possible to add the py.typed file for pylance, mypy and other type checker to work with this lib ?

erhosen commented 8 months ago

For BaseDBConfig? Or what kind of types do you mean?

erhosen commented 8 months ago

It would be nice to have types (and auto-completions in IDE) for:

from django.conf import settings

settings.                        # <- here

But I'm afraid it's not possible by Django design.

@q0w @andrey-lepekhin do you have idea how to implement that?

q0w commented 8 months ago

You can typecheck settings.* by https://github.com/typeddjango/django-stubs special mypy plugin, but no auto-completion

Zenthae commented 8 months ago

What i meant is that without the py.typed file, you get error messages from MyPy and Pylance telling you that this package doesn't support types while it's not true, things are typed, it's just missing this file to tell them it's enabled

Without the file: image

With the file: image