pydantic API reference
300 public APIs from pydantic (pydantic/pydantic) — 120 classes, 97 functions, 83 methods. Signatures extracted by static analysis of the actual source.
Repository: pydantic/pydantic
| Kind | Count |
|---|---|
| Classes | 120 |
| Functions | 97 |
| Methods | 83 |
API list
class
.github.actions.people.people.AuthorRepresents a GitHub user with their basic information.
class
.github.actions.people.people.CommentsContainer for comment nodes.
class
.github.actions.people.people.DiscussionsContainer for discussion edges.
class
.github.actions.people.people.DiscussionsCommentsContainer for discussion comment nodes.
class
.github.actions.people.people.DiscussionsResponseComplete response structure for discussions query.
class
.github.actions.people.people.DiscussionsResponseDataTop-level container for discussions response data.
class
.github.actions.people.people.IssuesContainer for issue edges.
class
.github.actions.people.people.IssuesEdgeRepresents an edge in the GitHub GraphQL issues query.
class
.github.actions.people.people.IssuesNodeRepresents a GitHub issue with its metadata and comments.
class
.github.actions.people.people.IssuesResponseComplete response structure for issues query.
class
.github.actions.people.people.IssuesResponseDataTop-level container for issues response data.
class
.github.actions.people.people.LabelNodeRepresents a GitHub label.
class
.github.actions.people.people.LabelsContainer for label nodes.
class
.github.actions.people.people.PRsResponseComplete response structure for pull requests query.
class
.github.actions.people.people.PRsResponseDataTop-level container for pull requests response data.
class
.github.actions.people.people.PullRequestsContainer for pull request edges.
class
.github.actions.people.people.RepliesContainer for reply nodes in a discussion.
class
.github.actions.people.people.ReviewNodeRepresents a pull request review with author and state.
class
.github.actions.people.people.ReviewsContainer for review nodes.
class
.github.actions.people.people.SettingsConfiguration settings for the GitHub API interaction.
func
.github.actions.people.people.get_discussions_experts(settings:Settings) -> tuple[Counter, Counter, dict[str, Author]]Analyze discussions to identify expert contributors.
func
.github.actions.people.people.get_experts(settings:Settings) -> tuple[Counter, Counter, dict[str, Author]]Get combined expert contributors from discussions.
func
.github.actions.people.people.get_graphql_issue_edges(*settings:Settings, *after:str | None=None) -> list[IssuesEdge]Fetch issue edges from GitHub GraphQL API.
func
.github.actions.people.people.get_graphql_pr_edges(*settings:Settings, *after:str | None=None) -> list[PullRequestEdge]Fetch pull request edges from GitHub GraphQL API.
func
.github.actions.people.people.get_graphql_question_discussion_edges(*settings:Settings, *after:str | None=None) -> list[DiscussionsEdge]Fetch discussion edges from GitHub GraphQL API.
func
.github.actions.people.people.get_graphql_response(*settings:Settings, *query:str, *after:str | None=None) -> dict[str, Any]Make a GraphQL request to GitHub API.
func
.github.actions.people.people.get_issues_experts(settings:Settings) -> tuple[Counter, Counter, dict[str, Author]]Analyze issues to identify expert contributors.
class
pydantic-core.python.pydantic_core.ErrorTypeInfoGives information about errors.
class
pydantic-core.python.pydantic_core.MultiHostHostA host part of a multi-host URL.
class
pydantic-core.python.pydantic_core.core_schema.CoreConfigBase class for schema configuration options.
class
pydantic-core.python.pydantic_core.core_schema.FieldSerializationInfoExtra data used during field serialization.
class
pydantic-core.python.pydantic_core.core_schema.SerializationInfoExtra data used during serialization.
method
pydantic-core.python.pydantic_core.core_schema.SerializationInfo.context() -> ContextTThe current serialization context.
class
pydantic-core.python.pydantic_core.core_schema.ValidationInfoExtra data used during validation.
method
pydantic-core.python.pydantic_core.core_schema.ValidationInfo.context() -> ContextTThe current validation context.
method
pydantic-core.python.pydantic_core.core_schema.ValidationInfo.data() -> dict[str, Any]The data being validated for this model.
func
pydantic-core.python.pydantic_core.core_schema.iter_union_choices(union_schema:UnionSchema) -> Generator[CoreSchema]Iterate over the choices of a `'union'` schema.
func
pydantic-core.python.pydantic_core.core_schema.model_ser_schema(cls:type[Any], schema:CoreSchema) -> ModelSerSchemaReturns a schema for serialization using a model.
class
pydantic._internal._config.ConfigWrapperStackA stack of `ConfigWrapper` instances.
func
pydantic._internal._config.check_deprecated(config_dict:ConfigDict) -> NoneCheck for deprecated config keys and warn the user.
func
pydantic._internal._core_utils.get_ref(s:core_schema.CoreSchema) -> None | strGet the ref from the schema if it has one.
func
pydantic._internal._dataclasses.set_dataclass_fields(cls:type[StandardDataclass], config_wrapper:_config.ConfigWrapper, ns_resolver:NsResolver | None=None) -> NoneCollect and set `cls.__pydantic_fields__`.
method
pydantic._internal._decorators.Decorator.bind_to_cls(cls:Any) -> Decorator[DecoratorInfoType]Bind the decorator to a class.
method
pydantic._internal._decorators.Decorator.build(cls_:Any, *cls_var_name:str, *shim:Callable[[Any], Any] | None, *info:DecoratorInfoType) -> Decorator[DecoratorInfoType]Build a new decorator.
func
pydantic._internal._decorators.ensure_classmethod_based_on_signature(function:AnyDecoratorCallable) -> AnyApply the `@classmethod` decorator on the function.
func
pydantic._internal._decorators.get_attribute_from_base_dicts(tp:type[Any], name:str) -> AnyGet an attribute out of the `__dict__` following the MRO.
func
pydantic._internal._decorators.get_bases(tp:type[Any]) -> tuple[type[Any], ...]Get the base classes of a class or typeddict.
func
pydantic._internal._decorators.get_callable_return_type(callable_obj:Any, globalns:GlobalsNamespace | None=None, localns:MappingNamespace | None=None) -> Any | PydanticUndefinedTypeGet the callable return type.
func
pydantic._internal._decorators.is_instance_method_from_sig(function:AnyDecoratorCallable) -> boolWhether the function is an instance method.
func
pydantic._internal._decorators.mro(tp:type[Any]) -> tuple[type[Any], ...]Calculate the Method Resolution Order of bases using the C3 algorithm.
class
pydantic._internal._decorators_v1.V2CoreAfterRootValidatorV2 validator with mode='after'.
class
pydantic._internal._decorators_v1.V2CoreBeforeRootValidatorV2 validator with mode='before'.
class
pydantic._internal._fields.PydanticMetadataBase class for annotation markers like `Strict`.
func
pydantic._internal._fields.collect_dataclass_fields(cls:type[StandardDataclass], *config_wrapper:ConfigWrapper, *ns_resolver:NsResolver | None=None, *typevars_map:dict[Any, Any] | None=None) -> dict[str, FieldInfo]Collect the fields of a dataclass.
class
pydantic._internal._generate_schema.InvalidSchemaErrorThe core schema is invalid.
func
pydantic._internal._generate_schema.check_validator_fields_against_field_name(info:FieldDecoratorInfo, field:str) -> boolCheck if field name is in validator fields.
func
pydantic._internal._git.git_revision(dir:Path) -> strGet the SHA-1 of the HEAD of a git repository.
func
pydantic._internal._git.have_git() -> boolCan we run the git executable?
func
pydantic._internal._git.is_git_repo(dir:Path) -> boolIs the given directory version-controlled with git?
func
pydantic._internal._known_annotated_metadata.expand_grouped_metadata(annotations:Iterable[Any]) -> Iterable[Any]Expand the annotations.
func
pydantic._internal._model_construction.NoInitField(*init:Literal[False]=False) -> AnyOnly for typing purposes.
func
pydantic._internal._model_construction.set_deprecated_descriptors(cls:type[BaseModel]) -> NoneSet data descriptors on the class for deprecated fields.
func
pydantic._internal._namespace_utils.get_module_ns_of(obj:Any) -> dict[str, Any]Get the namespace of the module where the object is defined.
class
pydantic._internal._repr.PlainReprString class where repr doesn't include quotes.
class
pydantic._internal._schema_gather.GatherContextThe current context used during core schema traversing.
class
pydantic._internal._schema_gather.GatherResultSchema traversing result.
func
pydantic._internal._typing_extra.annotated_type(tp:Any) -> Any | NoneReturn the type of the `Annotated` special form, or `None`.
func
pydantic._internal._typing_extra.is_annotated(tp:Any) -> boolReturn whether the provided argument is a `Annotated` special form.
func
pydantic._internal._typing_extra.is_namedtuple(tp:Any) -> boolReturn whether the provided argument is a named tuple class.
func
pydantic._internal._typing_extra.unpack_type(tp:Any) -> Any | NoneReturn the type wrapped by the `Unpack` special form, or `None`.
func
pydantic._internal._utils.can_be_positional(param:Parameter) -> boolReturn whether the parameter accepts a positional argument.
func
pydantic._internal._utils.unique_list(input_list:list[T] | tuple[T, ...], *name_factory:Callable[[T], str]=str) -> list[T]Make a list unique while maintaining order.
func
pydantic._internal._validate_call.extract_function_name(func:ValidateCallSupportedTypes) -> strExtract the name of a `ValidateCallSupportedTypes` object.
func
pydantic._migration.wrapper(name:str) -> objectRaise an error if the object is not found, or warn if it was moved.
func
pydantic.alias_generators.to_camel(snake:str) -> strConvert a snake_case string to camelCase.
func
pydantic.alias_generators.to_pascal(snake:str) -> strConvert a snake_case string to PascalCase.
func
pydantic.alias_generators.to_snake(camel:str) -> strConvert a PascalCase, camelCase, or kebab-case string to snake_case.
class
pydantic.aliases.AliasChoices!!!
class
pydantic.aliases.AliasGenerator!!!
class
pydantic.aliases.AliasPath!!!
method
pydantic.aliases.AliasPath.search_dict_for_path(d:dict) -> AnySearches a dictionary for the path specified by the alias.
class
pydantic.color.ColorRepresents a color.
method
pydantic.color.Color.as_hex() -> strReturns the hexadecimal representation of the color.
method
pydantic.color.Color.as_hsl_tuple(*alpha:bool | None=None) -> HslColorTupleReturns the color as an HSL or HSLA tuple.
method
pydantic.color.Color.as_rgb_tuple(*alpha:bool | None=None) -> ColorTupleReturns the color as an RGB or RGBA tuple.
method
pydantic.color.Color.original() -> ColorTypeOriginal value passed to `Color`.
class
pydantic.color.RGBAInternal use only as a representation of a color.
func
pydantic.color.parse_color_value(value:int | str, max_val:int=255) -> floatParse the color value provided and return a number between 0 and 1.
func
pydantic.color.parse_str(value:str) -> RGBAParse a string representing a color to an RGBA tuple.
func
pydantic.color.parse_tuple(value:tuple[Any, ...]) -> RGBAParse a tuple or list to get RGBA values.
class
pydantic.config.ConfigDictA TypedDict for configuring Pydantic behaviour.
func
pydantic.dataclasses.create_dataclass(cls:type[Any]) -> type[PydanticDataclass]Create a Pydantic dataclass from a regular dataclass.
func
pydantic.dataclasses.is_pydantic_dataclass(class_:type[Any]) -> TypeGuard[type[PydanticDataclass]]Whether a class is a pydantic dataclass.
class
pydantic.deprecated.config.BaseConfigThis class is only retained for backwards compatibility.
func
pydantic.deprecated.json.timedelta_isoformat(td:datetime.timedelta) -> strISO 8601 encoding for Python timedelta object.
class
pydantic.errors.PydanticErrorMixinA mixin class for common functionality shared by all Pydantic-specific errors.
class
pydantic.errors.PydanticUserErrorAn error raised due to incorrect use of Pydantic.
class
pydantic.fields.FieldInfoThis class holds information about a field.
method
pydantic.fields.FieldInfo.apply_typevars_map(typevars_map:Mapping[TypeVar, Any] | None, globalns:GlobalsNamespace | None=None, localns:MappingNamespace | None=None) -> NoneApply a `typevars_map` to the annotation.
class
pydantic.fields.ModelPrivateAttrA descriptor for private attributes in class models.
class
pydantic.functional_validators.AfterValidator!!!
class
pydantic.functional_validators.BeforeValidator!!!
class
pydantic.functional_validators.FreeModelBeforeValidatorA `@model_validator` decorated function signature.
class
pydantic.functional_validators.ModelBeforeValidatorA `@model_validator` decorated function signature.
class
pydantic.functional_validators.ModelBeforeValidatorWithoutInfoA `@model_validator` decorated function signature.
class
pydantic.functional_validators.ModelWrapValidatorA `@model_validator` decorated function signature.
class
pydantic.functional_validators.ModelWrapValidatorWithoutInfoA `@model_validator` decorated function signature.
class
pydantic.functional_validators.PlainValidator!!!
class
pydantic.functional_validators.WrapValidator!!!
class
pydantic.json_schema.ExamplesAdd examples to a JSON schema.
class
pydantic.json_schema.GenerateJsonSchema!!!
method
pydantic.json_schema.GenerateJsonSchema.any_schema(schema:core_schema.AnySchema) -> JsonSchemaValueGenerates a JSON schema that matches any value.
method
pydantic.json_schema.GenerateJsonSchema.bool_schema(schema:core_schema.BoolSchema) -> JsonSchemaValueGenerates a JSON schema that matches a bool value.
method
pydantic.json_schema.GenerateJsonSchema.bytes_schema(schema:core_schema.BytesSchema) -> JsonSchemaValueGenerates a JSON schema that matches a bytes value.
method
pydantic.json_schema.GenerateJsonSchema.callable_schema(schema:core_schema.CallableSchema) -> JsonSchemaValueGenerates a JSON schema that matches a callable value.
method
pydantic.json_schema.GenerateJsonSchema.complex_schema(schema:core_schema.ComplexSchema) -> JsonSchemaValueGenerates a JSON schema that matches a complex number.
method
pydantic.json_schema.GenerateJsonSchema.date_schema(schema:core_schema.DateSchema) -> JsonSchemaValueGenerates a JSON schema that matches a date value.
method
pydantic.json_schema.GenerateJsonSchema.datetime_schema(schema:core_schema.DatetimeSchema) -> JsonSchemaValueGenerates a JSON schema that matches a datetime value.
method
pydantic.json_schema.GenerateJsonSchema.decimal_schema(schema:core_schema.DecimalSchema) -> JsonSchemaValueGenerates a JSON schema that matches a decimal value.
method
pydantic.json_schema.GenerateJsonSchema.dict_schema(schema:core_schema.DictSchema) -> JsonSchemaValueGenerates a JSON schema that matches a dict schema.
method
pydantic.json_schema.GenerateJsonSchema.encode_default(dft:Any) -> AnyEncode a default value to a JSON-serializable value.
method
pydantic.json_schema.GenerateJsonSchema.enum_schema(schema:core_schema.EnumSchema) -> JsonSchemaValueGenerates a JSON schema that matches an Enum value.
method
pydantic.json_schema.GenerateJsonSchema.float_schema(schema:core_schema.FloatSchema) -> JsonSchemaValueGenerates a JSON schema that matches a float value.
method
pydantic.json_schema.GenerateJsonSchema.fraction_schema(schema:core_schema.FractionSchema) -> JsonSchemaValueGenerates a JSON schema that matches a fraction value.
method
pydantic.json_schema.GenerateJsonSchema.generate_inner(schema:CoreSchemaOrField) -> JsonSchemaValueGenerates a JSON schema for a given core schema.
method
pydantic.json_schema.GenerateJsonSchema.get_argument_name(argument:core_schema.ArgumentsParameter | core_schema.ArgumentsV3Parameter) -> strRetrieves the name of an argument.
method
pydantic.json_schema.GenerateJsonSchema.get_title_from_name(name:str) -> strRetrieves a title from a name.
func
pydantic.json_schema.GenerateJsonSchema.handler_func(schema_or_field:CoreSchemaOrField) -> JsonSchemaValueGenerate a JSON schema based on the input schema.
method
pydantic.json_schema.GenerateJsonSchema.int_schema(schema:core_schema.IntSchema) -> JsonSchemaValueGenerates a JSON schema that matches an int value.
method
pydantic.json_schema.GenerateJsonSchema.invalid_schema(schema:core_schema.InvalidSchema) -> JsonSchemaValuePlaceholder - should never be called.
method
pydantic.json_schema.GenerateJsonSchema.list_schema(schema:core_schema.ListSchema) -> JsonSchemaValueReturns a schema that matches a list schema.
method
pydantic.json_schema.GenerateJsonSchema.literal_schema(schema:core_schema.LiteralSchema) -> JsonSchemaValueGenerates a JSON schema that matches a literal value.
method
pydantic.json_schema.GenerateJsonSchema.none_schema(schema:core_schema.NoneSchema) -> JsonSchemaValueGenerates a JSON schema that matches `None`.
method
pydantic.json_schema.GenerateJsonSchema.normalize_name(name:str) -> strNormalizes a name to be used as a key in a dictionary.
method
pydantic.json_schema.GenerateJsonSchema.set_schema(schema:core_schema.SetSchema) -> JsonSchemaValueGenerates a JSON schema that matches a set schema.
method
pydantic.json_schema.GenerateJsonSchema.str_schema(schema:core_schema.StringSchema) -> JsonSchemaValueGenerates a JSON schema that matches a string value.
method
pydantic.json_schema.GenerateJsonSchema.time_schema(schema:core_schema.TimeSchema) -> JsonSchemaValueGenerates a JSON schema that matches a time value.
method
pydantic.json_schema.GenerateJsonSchema.tuple_positional_schema(schema:core_schema.TupleSchema) -> JsonSchemaValueReplaced by `tuple_schema`.
method
pydantic.json_schema.GenerateJsonSchema.tuple_schema(schema:core_schema.TupleSchema) -> JsonSchemaValueGenerates a JSON schema that matches a tuple schema e.g.
method
pydantic.json_schema.GenerateJsonSchema.tuple_variable_schema(schema:core_schema.TupleSchema) -> JsonSchemaValueReplaced by `tuple_schema`.
method
pydantic.json_schema.GenerateJsonSchema.uuid_schema(schema:core_schema.UuidSchema) -> JsonSchemaValueGenerates a JSON schema that matches a UUID.
class
pydantic.json_schema.SkipJsonSchema!!!
class
pydantic.json_schema.WithJsonSchema!!!
class
pydantic.main.BaseModel!!!
method
pydantic.main.BaseModel.copy(*include:AbstractSetIntStr | MappingIntStrAny | None=None, *exclude:AbstractSetIntStr | MappingIntStrAny | None=None, *update:Dict[str, Any] | None=None, *deep:bool=False) -> SelfReturns a copy of the model.
method
pydantic.main.BaseModel.model_construct(_fields_set:set[str] | None=None, **values:Any) -> SelfCreates a new instance of the `Model` class with validated data.
method
pydantic.main.BaseModel.model_copy(*update:Mapping[str, Any] | None=None, *deep:bool=False) -> Self!!!
method
pydantic.main.BaseModel.model_extra() -> dict[str, Any] | NoneGet extra fields set during validation.
method
pydantic.main.BaseModel.model_parametrized_name(params:tuple[type[Any], ...]) -> strCompute the class name for parametrizations of generic classes.
method
pydantic.main.BaseModel.model_validate(obj:Any, *strict:bool | None=None, *extra:ExtraValues | None=None, *from_attributes:bool | None=None, *context:Any | None=None, *by_alias:bool | None=None, *by_name:bool | None=None) -> SelfValidate a pydantic model instance.
method
pydantic.main.BaseModel.model_validate_json(json_data:str | bytes | bytearray, *strict:bool | None=None, *extra:ExtraValues | None=None, *context:Any | None=None, *by_alias:bool | None=None, *by_name:bool | None=None) -> Self!!!
class
pydantic.mypy.ModelConfigDataPydantic mypy plugin model config class.
method
pydantic.mypy.ModelConfigData.get_values_dict() -> dict[str, Any]Returns a dict of Pydantic model config names to their values.
method
pydantic.mypy.ModelConfigData.update(config:ModelConfigData | None) -> NoneUpdate Pydantic model config values.
class
pydantic.mypy.PydanticModelClassVarBased on mypy.plugins.dataclasses.DataclassAttribute.
class
pydantic.mypy.PydanticModelFieldBased on mypy.plugins.dataclasses.DataclassAttribute.
class
pydantic.mypy.PydanticPluginThe Pydantic mypy plugin.
method
pydantic.mypy.PydanticPlugin.get_base_class_hook(fullname:str) -> Callable[[ClassDefContext], None] | NoneUpdate Pydantic model class.
method
pydantic.mypy.PydanticPlugin.get_metaclass_hook(fullname:str) -> Callable[[ClassDefContext], None] | NoneUpdate Pydantic `ModelMetaclass` definition.
method
pydantic.mypy.PydanticPlugin.get_method_hook(fullname:str) -> Callable[[MethodContext], Type] | NoneAdjust return type of `from_orm` method call.
method
pydantic.mypy.PydanticPlugin.report_config_data(ctx:ReportConfigContext) -> dict[str, Any]Return all plugin config data.
class
pydantic.mypy.PydanticPluginConfigA Pydantic mypy plugin config holder.
method
pydantic.mypy.PydanticPluginConfig.to_data() -> dict[str, Any]Returns a dict of config names to their values.
func
pydantic.mypy.error_invalid_config_value(name:str, api:SemanticAnalyzerPluginInterface, context:Context) -> NoneEmits an error when the config value is invalid.
func
pydantic.mypy.error_required_dynamic_aliases(api:SemanticAnalyzerPluginInterface, context:Context) -> NoneEmits required dynamic aliases error.
func
pydantic.mypy.error_unexpected_behavior(detail:str, api:CheckerPluginInterface | SemanticAnalyzerPluginInterface, context:Context) -> NoneEmits unexpected behavior error.
func
pydantic.mypy.error_untyped_fields(api:SemanticAnalyzerPluginInterface, context:Context) -> NoneEmits an error when there is an untyped field in the model.
func
pydantic.mypy.from_attributes_callback(ctx:MethodContext) -> TypeRaise an error if from_attributes is not enabled.
func
pydantic.mypy.parse_toml(config_file:str) -> dict[str, Any] | NoneReturns a dict of config keys to values.
func
pydantic.mypy.plugin(version:str) -> type[Plugin]`version` is the mypy version string.
class
pydantic.networks.AmqpDsnA type that will accept any AMQP DSN.
class
pydantic.networks.AnyHttpUrlA type that will accept any http or https URL.
class
pydantic.networks.AnyUrlBase type for all URLs.
class
pydantic.networks.AnyWebsocketUrlA type that will accept any ws or wss URL.
class
pydantic.networks.ClickHouseDsnA type that will accept any ClickHouse DSN.
class
pydantic.networks.CockroachDsnA type that will accept any Cockroach DSN.
method
pydantic.networks.CockroachDsn.host() -> strThe required URL host.
class
pydantic.networks.FileUrlA type that will accept any file URL.
class
pydantic.networks.FtpUrlA type that will accept ftp URL.
class
pydantic.networks.HttpUrlA type that will accept any http or https URL.
class
pydantic.networks.IPvAnyAddressValidate an IPv4 or IPv6 address.
class
pydantic.networks.IPvAnyInterfaceValidate an IPv4 or IPv6 interface.
class
pydantic.networks.IPvAnyNetworkValidate an IPv4 or IPv6 network.
class
pydantic.networks.KafkaDsnA type that will accept any Kafka DSN.
class
pydantic.networks.MariaDBDsnA type that will accept any MariaDB DSN.
class
pydantic.networks.MongoDsnA type that will accept any MongoDB DSN.
class
pydantic.networks.MySQLDsnA type that will accept any MySQL DSN.
class
pydantic.networks.NatsDsnA type that will accept any NATS DSN.
class
pydantic.networks.PostgresDsnA type that will accept any Postgres DSN.
method
pydantic.networks.PostgresDsn.host() -> strThe required URL host.
class
pydantic.networks.RedisDsnA type that will accept any Redis DSN.
method
pydantic.networks.RedisDsn.host() -> strThe required URL host.
class
pydantic.networks.SnowflakeDsnA type that will accept any Snowflake DSN.
method
pydantic.networks.SnowflakeDsn.host() -> strThe required URL host.
class
pydantic.networks.UrlConstraintsUrl constraints.
class
pydantic.networks.WebsocketUrlA type that will accept any ws or wss URL.
class
pydantic.plugin.BaseValidateHandlerProtocolBase class for plugin callbacks protocols.
method
pydantic.plugin.BaseValidateHandlerProtocol.on_error(error:ValidationError) -> NoneCallback to be notified of validation errors.
method
pydantic.plugin.BaseValidateHandlerProtocol.on_exception(exception:Exception) -> NoneCallback to be notified of validation exceptions.
method
pydantic.plugin.BaseValidateHandlerProtocol.on_success(result:Any) -> NoneCallback to be notified of successful validation.
class
pydantic.plugin.PydanticPluginProtocolProtocol defining the interface for Pydantic plugins.
class
pydantic.plugin.ValidateJsonHandlerProtocolEvent handler for `SchemaValidator.validate_json`.
class
pydantic.plugin.ValidatePythonHandlerProtocolEvent handler for `SchemaValidator.validate_python`.
class
pydantic.plugin.ValidateStringsHandlerProtocolEvent handler for `SchemaValidator.validate_strings`.
func
pydantic.plugin._loader.get_plugins() -> Iterable[PydanticPluginProtocol]Load plugins for Pydantic.
class
pydantic.plugin._schema_validator.PluggableSchemaValidatorPluggable schema validator.
class
pydantic.root_model.RootModel!!!
class
pydantic.type_adapter.TypeAdapter!!!
method
pydantic.type_adapter.TypeAdapter.get_default_value(*strict:bool | None=None, *context:Any | None=None) -> Some[T] | NoneGet the default value for the wrapped type.
method
pydantic.type_adapter.TypeAdapter.validate_json(data:str | bytes | bytearray, *strict:bool | None=None, *extra:ExtraValues | None=None, *context:Any | None=None, *experimental_allow_partial:bool | Literal['off', 'on', 'trailing-strings']=False, *by_alias:bool | None=None, *by_name:bool | None=None) -> T!!!
class
pydantic.types.AwareDatetimeA datetime that requires timezone info.
class
pydantic.types.Base64EncoderStandard (non-URL-safe) Base64 encoder.
method
pydantic.types.Base64Encoder.decode(data:bytes) -> bytesDecode the data from base64 encoded bytes to original bytes data.
method
pydantic.types.Base64Encoder.encode(value:bytes) -> bytesEncode the data from bytes to a base64 encoded bytes.
method
pydantic.types.Base64Encoder.get_json_format() -> Literal['base64']Get the JSON format for the encoded data.
class
pydantic.types.Base64UrlEncoderURL-safe Base64 encoder.
method
pydantic.types.Base64UrlEncoder.decode(data:bytes) -> bytesDecode the data from base64 encoded bytes to original bytes data.
method
pydantic.types.Base64UrlEncoder.encode(value:bytes) -> bytesEncode the data from bytes to a base64 encoded bytes.
method
pydantic.types.Base64UrlEncoder.get_json_format() -> Literal['base64url']Get the JSON format for the encoded data.
class
pydantic.types.Discriminator!!!
class
pydantic.types.EncoderProtocolProtocol for encoding and decoding data to and from bytes.
method
pydantic.types.EncoderProtocol.decode(data:bytes) -> bytesDecode the data using the encoder.
method
pydantic.types.EncoderProtocol.encode(value:bytes) -> bytesEncode the data using the encoder.
method
pydantic.types.EncoderProtocol.get_json_format() -> strGet the JSON format for the encoded data.
class
pydantic.types.FutureDateA date in the future.
class
pydantic.types.FutureDatetimeA datetime that must be in the future.
class
pydantic.types.GetPydanticSchema!!!
class
pydantic.types.JsonA special type wrapper which loads JSON before parsing.
class
pydantic.types.NaiveDatetimeA datetime that doesn't require timezone info.
class
pydantic.types.PastDateA date in the past.
class
pydantic.types.PastDatetimeA datetime that must be in the past.
class
pydantic.types.PaymentCardNumberBased on: https://en.wikipedia.org/wiki/Payment_card_number.
method
pydantic.types.PaymentCardNumber.masked() -> strMask all but the last 4 digits of the card number.
method
pydantic.types.PaymentCardNumber.validate_digits(card_number:str) -> NoneValidate that the card number is all digits.
method
pydantic.types.PaymentCardNumber.validate_luhn_check_digit(card_number:str) -> strBased on: https://en.wikipedia.org/wiki/Luhn_algorithm.
class
pydantic.types.Strict!!!
class
pydantic.types.StringConstraints!!!
func
pydantic.types.condate(*strict:bool | None=None, *gt:date | None=None, *ge:date | None=None, *lt:date | None=None, *le:date | None=None) -> type[date]A wrapper for date that adds constraints.
func
pydantic.types.condecimal(*strict:bool | None=None, *gt:int | Decimal | None=None, *ge:int | Decimal | None=None, *lt:int | Decimal | None=None, *le:int | Decimal | None=None, *multiple_of:int | Decimal | None=None, *max_digits:int | None=None, *decimal_places:int | None=None, *allow_inf_nan:bool | None=None) -> type[Decimal]!!!
func
pydantic.types.confloat(*strict:bool | None=None, *gt:float | None=None, *ge:float | None=None, *lt:float | None=None, *le:float | None=None, *multiple_of:float | None=None, *allow_inf_nan:bool | None=None) -> type[float]!!!
func
pydantic.types.conint(*strict:bool | None=None, *gt:int | None=None, *ge:int | None=None, *lt:int | None=None, *le:int | None=None, *multiple_of:int | None=None) -> type[int]!!!
func
pydantic.types.constr(*strip_whitespace:bool | None=None, *to_upper:bool | None=None, *to_lower:bool | None=None, *strict:bool | None=None, *min_length:int | None=None, *max_length:int | None=None, *pattern:str | Pattern[str] | None=None, *ascii_only:bool | None=None) -> type[str]!!!
method
pydantic.v1.color.Color.as_hsl_tuple(*alpha:Optional[bool]=None) -> HslColorTupleColor as an HSL or HSLA tuple, e.g.
method
pydantic.v1.color.Color.original() -> ColorTypeOriginal value passed to Color
class
pydantic.v1.color.RGBAInternal use only as a representation of a color.
func
pydantic.v1.color.parse_float_alpha(value:Union[None, str, float, int]) -> Optional[float]Parse a value checking it's a valid float in the range 0 to 1
func
pydantic.v1.color.parse_tuple(value:Tuple[Any, ...]) -> RGBAParse a tuple or list as a color.
method
pydantic.v1.config.BaseConfig.prepare_field(field:'ModelField') -> NoneOptional hook to check or modify fields during model creation.
func
pydantic.v1.datetime_parse.parse_date(value:Union[date, StrBytesIntFloat]) -> dateParse a date/int/float/string and return a datetime.date.
func
pydantic.v1.datetime_parse.parse_time(value:Union[time, StrBytesIntFloat]) -> timeParse a time/string and return a datetime.time.
class
pydantic.v1.fields.FieldInfoCaptures extra information about a field.
func
pydantic.v1.json.timedelta_isoformat(td:datetime.timedelta) -> strISO 8601 encoding for Python timedelta object.
func
pydantic.v1.main.validate_model(model:Type[BaseModel], input_data:'DictStrAny', cls:'ModelOrDc'=None) -> Tuple['DictStrAny', 'SetStr', Optional[ValidationError]]validate data against a model.
method
pydantic.v1.mypy.PydanticPlugin.get_class_decorator_hook(fullname:str) -> Optional[Callable[[ClassDefContext], None]]Mark pydantic.dataclasses as dataclass.
method
pydantic.v1.mypy.PydanticPlugin.report_config_data(ctx:ReportConfigContext) -> Dict[str, Any]Return all plugin config data.
func
pydantic.v1.mypy.add_method(ctx:ClassDefContext, name:str, args:List[Argument], return_type:Type, self_type:Optional[Type]=None, tvar_def:Optional[TypeVarDef]=None, is_classmethod:bool=False, is_new:bool=False) -> NoneAdds a new method to a class.
func
pydantic.v1.mypy.from_orm_callback(ctx:MethodContext) -> TypeRaise an error if orm_mode is not enabled
method
pydantic.v1.networks.AnyUrl.validate_parts(parts:'Parts', validate_port:bool=True) -> 'Parts'A method used to validate parts of a URL.
func
pydantic.v1.networks.multi_host_url_regex() -> Pattern[str]Compiled multi host url regex.
class
pydantic.v1.schema.SkipFieldUtility exception used to exclude fields from schema.
func
pydantic.v1.schema.enum_process_schema(enum:Type[Enum], *field:Optional[ModelField]=None) -> Dict[str, Any]Take a single `enum` and generate its schema.
func
pydantic.v1.schema.model_schema(model:Union[Type['BaseModel'], Type['Dataclass']], by_alias:bool=True, ref_prefix:Optional[str]=None, ref_template:str=default_ref_template) -> Dict[str, Any]Generate a JSON Schema for one model.
func
pydantic.v1.schema.normalize_name(name:str) -> strNormalizes the given name.
class
pydantic.v1.types.PaymentCardNumberBased on: https://en.wikipedia.org/wiki/Payment_card_number
method
pydantic.v1.types.PaymentCardNumber.validate_luhn_check_digit(card_number:str) -> strBased on: https://en.wikipedia.org/wiki/Luhn_algorithm
class
pydantic.v1.types.StrictBoolStrictBool to allow for bools which are not type-coerced.
method
pydantic.v1.types.StrictBool.validate(value:Any) -> boolEnsure that we only allow bools.
func
pydantic.v1.typing.convert_generics(tp:Type[Any]) -> Type[Any]Python 3.9 and older only supports generics from `typing` module.
func
pydantic.v1.typing.get_args(t:Type[Any]) -> Tuple[Any, ...]Compatibility version of get_args for python 3.7.
func
pydantic.v1.typing.get_class(type_:Type[Any]) -> Union[None, bool, Type[Any]]Tries to get the class of a Type[T] annotation.
func
pydantic.v1.typing.is_namedtuple(type_:Type[Any]) -> boolCheck if a given class is a named tuple.
func
pydantic.v1.typing.is_new_type(type_:Type[Any]) -> boolCheck whether type_ was created using typing.NewType
func
pydantic.v1.typing.is_typeddict_special(type_:Any) -> boolCheck if type is a TypedDict special form (Required or NotRequired).
func
pydantic.v1.typing.resolve_annotations(raw_annotations:Dict[str, Type[Any]], module_name:Optional[str]) -> Dict[str, Type[Any]]Partially taken from typing.get_type_hints.
class
pydantic.v1.utils.ClassAttributeHide class attribute from its instances
class
pydantic.v1.utils.PyObjectStrString class where repr doesn't include quotes.
class
pydantic.v1.utils.RepresentationMixin to provide __str__, __repr__, and __pretty__ methods.
func
pydantic.v1.utils.almost_equal_floats(value_1:float, value_2:float, *delta:float=1e-08) -> boolReturn True if two floats are almost equal
func
pydantic.v1.utils.assert_never(obj:NoReturn, msg:str) -> NoReturnHelper to make sure that we have covered all possible types.
func
pydantic.v1.utils.generate_model_signature(init:Callable[..., None], fields:Dict[str, 'ModelField'], config:Type['BaseConfig']) -> 'Signature'Generate signature for model based on its fields
func
pydantic.v1.utils.import_string(dotted_path:str) -> AnyStolen approximately from django.
func
pydantic.v1.utils.is_valid_identifier(identifier:str) -> boolChecks that a string is a valid identifier and not a Python keyword.
func
pydantic.v1.utils.path_type(p:'Path') -> strFind out what sort of thing a path is.
func
pydantic.v1.utils.unique_list(input_list:Union[List[T], Tuple[T, ...]], *name_factory:Callable[[T], str]=str) -> List[T]Make a list unique while maintaining order.
func
pydantic.v1.validators.callable_validator(v:Any) -> AnyCallablePerform a simple check if the value is callable.
func
pydantic.v1.validators.constant_validator(v:'Any', field:'ModelField') -> 'Any'Validate ``const`` fields.
func
pydantic.version.parse_mypy_version(version:str) -> tuple[int, int, int]Parse `mypy` string version to a 3-tuple of ints.
func
pydantic.version.version_short() -> strReturn the `major.minor` part of Pydantic version.
class
pydantic.warnings.CoreSchemaGenerationWarningA warning raised during core schema generation.
class
pydantic.warnings.PydanticDeprecationWarningA Pydantic specific deprecation warning.
class
pydantic.warnings.PydanticExperimentalWarningA Pydantic specific experimental functionality warning.
func
release.prepare.get_notes(new_version:str) -> strFetch auto-generated release notes from github.
func
release.prepare.update_history(new_version:str, dry_run:bool, force_update:bool) -> NoneGenerate release notes and prepend them to HISTORY.md.
func
release.prepare.update_version(new_version:str, dry_run:bool) -> NoneUpdate the version in the giving py version file.
func
release.push.commit_and_push_changes(rl_version:str) -> NoneCommit and push changes to a new branch.
func
release.push.create_github_release(new_version:str, notes:str)Create a new release on GitHub.
func
release.push.create_github_release_draft(rl_version:str, rl_release_notes:str)Create a GitHub release draft.
func
release.push.create_version_tag(rl_version:str)Create a version tag.
func
release.push.open_pull_request(rl_version:str)Open a pull request on GitHub.
func
release.shared.run_command(*args:str) -> strRun a shell command and return the output.
About this data
These signatures were extracted from the public source of pydantic/pydantic
using Python's ast module. Argument names, default values,
type annotations and return types are taken verbatim from the code.
Implementation bodies are never stored. See
how it works for details.