pallets-eco / pallets-eco/wtforms
Support for async validation mechanisms
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.6k
- Forks
- 409
- PR merge metrics
- No merged PRs in 30d
Description
I found myself wanting to add a custom validator to a form that makes an asynchronous HTTP request (using httpx) to confirm that a provided URL was valid - but realized that wtforms currently only supports blocking synchronous functions for validators.
There is a project that extends wtforms to work with async, but it's packaged for Starlette which I'm not using here: https://github.com/kubetail-org/starlette-wtf/blob/master/starlette_wtf/form.py
It would be great if wtforms provided an async validation mechanism in the default package. It's an increasingly common pattern thanks to the popularity of projects like Starlette and FastAPI. My own Datasette package uses async and has recently adopted wtforms for the enrichments feature, which is how I found this limitation.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing WTForms' existing synchronous validator behavior and the referenced starlette_wtf/form.py implementation. Compare how async validation is handled there with the needs described for httpx, Starlette, FastAPI, and Datasette. Done means the default package has a defined async validation mechanism without losing synchronous validator support.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100