pallets-eco / wtforms

A flexible forms validation and rendering library for Python.
https://wtforms.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.51k stars 395 forks source link

Pyright does not infer types for wtforms #848

Open ilkiri23 opened 3 months ago

ilkiri23 commented 3 months ago

I'm trying to create a FolderForm instance, but pyright infers the type as Any Also tried to install types-WTForms to solve the problem, but it didn't work for me

Actual Behavior

from wtforms import Form, StringField

class FolderForm(Form):
    name = StringField('Name')

form = FolderForm() # form is Any
Screenshot 2024-06-20 at 22 53 10

Expected Behavior

form has the FolderForm type

Environment

ultinvincible commented 2 months ago

I'm having the same problem with the VSCode extension Pylance, which uses Pyright. Versions 24.4.101 pre-release and earlier do not have this problem. Versions 24.4.102 pre-release, which updates Pyright from 1.1.358 to 1.1.359, and later have this problem.