Cool. Yeah this seems like a specific shape of type we need to handle in a
general fashion. i.e. built in type handling -- is that a fair comment?

On Sat, Oct 31, 2026 at 8:17 PM 3796320131 via dev <[email protected]>
wrote:

> Hi Stefan,
>
> Thanks for the question. I agree that Pydantic can be a better fit for
> application-specific structured objects, and I don't think every
> application should necessarily use tuples or sets in its state.
>
> A representative use case is a multi-turn Burr application that persists
> and resumes state across requests.
>
> For example, an application might keep:
>
>
> list[tuple[str, str]]&nbsp;for conversation messages represented as (role,
> content)&nbsp;pairs;
>
>
>
> set[str]&nbsp;for document IDs that have already been processed;
>
>
>
> frozenset[str]&nbsp;for immutable permission scopes or configuration keys.
>
>
> These values have different semantics from strings and lists. After
> persistence and restoration, the application may need to unpack each
> message tuple, add a newly processed document ID, or use a frozenset as a
> hashable key.
>
> With the current fallback serialization, these values become strings. The
> application can therefore restore successfully at the persistence level
> while losing the data semantics required by subsequent actions.
>
> Regarding Pydantic, I think it is an excellent choice when users have
> explicit domain models. However, I see it as complementary rather than a
> complete replacement for built-in container support.
>
> There are two distinctions:
>
>
> Requiring Pydantic models means users must introduce and maintain explicit
> schemas for values that may otherwise be ordinary Python containers nested
> inside lists and dictionaries.
>
>
>
> Burr's current Pydantic serializer uses model_dump()&nbsp;and
> model_validate(). In particular, sets and frozensets still require
> appropriate JSON conversion or custom serialization to survive persistence.
>
>
> My intention with the original issue is not to support every arbitrary
> Python type, but to preserve the semantics of a small set of common
> built-in containers that Burr users may reasonably place in State.
>
> The compatibility follow-up has a narrower purpose: once these envelope
> formats are introduced, their persistence and cross-version reading
> behavior should be documented and protected by regression tests.
>
> I would be happy to provide a small executable application example to make
> this distinction clearer.
>
> Thanks again for taking the time to discuss the design.
>
> Best regards,
> An external contributor

Reply via email to