Is `Annotated` compatible with `type[T]`?

But pydantic is attaching it to values in all of the examples that don’t work, not to types.

There’s nothing here that’s forbidding this, much more common form taken from an above example:

from typing import Annotated

from pydantic import BaseModel, Field

class Model(BaseModel):
    field: Annotated[int, Field(ge=0)]

The above is is still entirely specification compliant, this other example from above on the other hand is not:

from typing import Annotated

from pydantic import Field, TypeAdapter 

ta = TypeAdapter(Annotated[int, Field(ge=0)]) 

As a value, it should be fine to have a definition of TypeAdapter that takes the type and the extra data as separate arguments, but pydantic tried to do something that wasn’t specified rather than help write the specification that would allow it. I’m inclined to believe that this was not an intentional move, but a result of misunderstanding.

The below shows a use that would require a change for pydantic, but that is currently possible within specification and type-safe.

ta = TypeAdapter(int, constraints=[Field(ge=0)])

If you don’t want to change your API, I believe you can inform your users of the situation, recommend pinning mypy/pyright/etc to a version before the stronger enforcement and work on helping propse TypeForm so that your users can later unpin. I don’t think there’s a strong desire to have a runtime breaking change here, and I don’t think it’s necessary.