-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Custom Fields not recognised by PyCharm #87
Comments
I think this is expected; the only alternative would be to drop the type-checking for the This has been discussed before, but I think it makes sense to make this a plugin config setting. Alternatively, the @koxudaxi Maybe we could add a pycharm-plugin-specific model It would be very easy to add similar behavior to the mypy plugin... |
Yes, We expect the behavior. We should add a panel of settings to control the warnings. @dmontagu |
FYI,
addr = Address(email='foo@example.com') the plugin raises a warning on editor. addr = Address(email=EmailStr('foo@example.com')) This code is type checking safe, but running it on Linux raises ValidationError. |
I write a workaround. If you want to remove warning then, you should change pyproject.toml: [tool.pydantic-pycharm-plugin]
# You can select higlith level from "warning", "weak_warning", "disable"
parsable-type-highlight = "warning"
acceptable-type-highlight = "weak_warning"
[tool.pydantic-pycharm-plugin.acceptable-types]
"main.NonEmptyString" = ["str"] |
I think the workaround is good. |
I have the following custom Field:
and a model using it:
but when I instantiate
MyModel
:I get the following warning from pycharm's linter:
Expected type 'NonEmptyString' got 'str' instead
Is this behaviour expected?
Versions
pydantic 1.1.1
pycharm-pydantic-plugin: 0.0.27
The text was updated successfully, but these errors were encountered: