You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched Google & GitHub for similar requests and couldn't find anything
I have read and followed the docs and still think this feature is missing
Description
I'd like to see instances of the pydantic class SecretStr to be hashable like instances of the str class are hashable.
I use it mainly in instances of BaseSettings and during startup of a server application, I add settings classes which I can successfully construct in a set. This gives me an indication of missing configuration values.
But models containing fields annotated with SecretStr currently cannot be added to a set as Python complains about the SecretStr type: TypeError: unhashable type: 'SecretStr'
Initial Checks
Description
I'd like to see instances of the pydantic class
SecretStr
to be hashable like instances of thestr
class are hashable.I use it mainly in instances of
BaseSettings
and during startup of a server application, I add settings classes which I can successfully construct in a set. This gives me an indication of missing configuration values.But models containing fields annotated with
SecretStr
currently cannot be added to a set as Python complains about theSecretStr
type:TypeError: unhashable type: 'SecretStr'
Example snippet:
Affected Components
.dict()
and.json()
construct()
, pickling, private attributes, ORM modeThe text was updated successfully, but these errors were encountered: