Skip to content

Conversation

@patrick91
Copy link
Owner

No description provided.

@github-actions
Copy link

github-actions bot commented Nov 19, 2025

Thanks for adding the RELEASE.md file!

Below is the changelog that will be used for the release.


Add Pydantic v1/v2 compatibility for Input validators using a Protocol-based approach.

The Input component now accepts any object with a validate_python method through the new Validator protocol, making it compatible with both Pydantic v1 and v2.

Usage with Pydantic v2:

from pydantic import TypeAdapter

validator = TypeAdapter(int)
app.input("Enter a number:", validator=validator)

Usage with Pydantic v1:

from pydantic import parse_obj_as

class V1Validator:
    def __init__(self, type_):
        self.type_ = type_

    def validate_python(self, value):
        return parse_obj_as(self.type_, value)

validator = V1Validator(int)
app.input("Enter a number:", validator=validator)

Changes:

  • Added Validator protocol that accepts any object with a validate_python method
  • Improved error message extraction from Pydantic validation errors
  • Added cross-version compatibility tests
  • Updated CI to test both Pydantic v1 and v2 across Python 3.8-3.14

This release was contributed by @patrick91 in #39

@patrick91 patrick91 merged commit da9fc52 into main Nov 19, 2025
13 checks passed
@github-actions
Copy link

This PR was published as 0.16.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants