Skip to content

Commit

Permalink
Update history, bump version to alpha on main (pydantic#9844)
Browse files Browse the repository at this point in the history
  • Loading branch information
sydney-runkle authored Jul 4, 2024
1 parent c1101a9 commit d654a07
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 34 deletions.
27 changes: 27 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
## v2.8.2 (2024-07-03)

[GitHub release](https://github.com/pydantic/pydantic/releases/tag/v2.8.2)

### What's Changed

#### Fixes

* Fix issue with assertion caused by pluggable schema validator by @dmontagu in [#9838](https://github.com/pydantic/pydantic/pull/9838)

## v2.8.1 (2024-07-03)

[GitHub release](https://github.com/pydantic/pydantic/releases/tag/v2.8.1)

### What's Changed

#### Packaging
* Bump `ruff` to `v0.5.0` and `pyright` to `v1.1.369` by @sydney-runkle in [#9801](https://github.com/pydantic/pydantic/pull/9801)
* Bump `pydantic-core` to `v2.20.1`, `pydantic-extra-types` to `v2.9.0` by @sydney-runkle in [#9832](https://github.com/pydantic/pydantic/pull/9832)

#### Fixes
* Fix breaking change in `to_snake` from v2.7 -> v2.8 by @sydney-runkle in [#9812](https://github.com/pydantic/pydantic/pull/9812)
* Fix list constraint json schema application by @sydney-runkle in [#9818](https://github.com/pydantic/pydantic/pull/9818)
* Support time duration more than 23 by @nix010 in [pydantic/speedate#64](https://github.com/pydantic/speedate/pull/64)
* Fix millisecond fraction being handled with the wrong scale by @davidhewitt in [pydantic/speedate#65](https://github.com/pydantic/speedate/pull/65)
* Handle negative fractional durations correctly by @sydney-runkle in [pydantic/speedate#71](https://github.com/pydantic/speedate/pull/71)

## v2.8.0 (2024-07-01)

[GitHub release](https://github.com/pydantic/pydantic/releases/tag/v2.8.0)
Expand Down
6 changes: 3 additions & 3 deletions pydantic/aliases.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

@dataclasses.dataclass(**_internal_dataclass.slots_true)
class AliasPath:
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/alias#aliaspath-and-aliaschoices
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/alias#aliaspath-and-aliaschoices
A data class used by `validation_alias` as a convenience to create aliases.
Expand Down Expand Up @@ -55,7 +55,7 @@ def search_dict_for_path(self, d: dict) -> Any:

@dataclasses.dataclass(**_internal_dataclass.slots_true)
class AliasChoices:
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/alias#aliaspath-and-aliaschoices
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/alias#aliaspath-and-aliaschoices
A data class used by `validation_alias` as a convenience to create aliases.
Expand Down Expand Up @@ -85,7 +85,7 @@ def convert_to_aliases(self) -> list[list[str | int]]:

@dataclasses.dataclass(**_internal_dataclass.slots_true)
class AliasGenerator:
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/alias#using-an-aliasgenerator
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/alias#using-an-aliasgenerator
A data class used by `alias_generator` as a convenience to create various aliases.
Expand Down
2 changes: 1 addition & 1 deletion pydantic/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,7 @@ class Model(BaseModel):


def with_config(config: ConfigDict) -> Callable[[_TypeT], _TypeT]:
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/config/#configuration-with-dataclass-from-the-standard-library-or-typeddict
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/config/#configuration-with-dataclass-from-the-standard-library-or-typeddict
A convenience decorator to set a [Pydantic configuration](config.md) on a `TypedDict` or a `dataclass` from the standard library.
Expand Down
2 changes: 1 addition & 1 deletion pydantic/dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def dataclass( # noqa: C901
kw_only: bool = False,
slots: bool = False,
) -> Callable[[type[_T]], type[PydanticDataclass]] | type[PydanticDataclass]:
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/dataclasses/
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/dataclasses/
A decorator used to create a Pydantic-enhanced dataclass, similar to the standard Python `dataclass`,
but with added validation.
Expand Down
6 changes: 3 additions & 3 deletions pydantic/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ def Field( # noqa: C901
fail_fast: bool | None = _Unset,
**extra: Unpack[_EmptyKwargs],
) -> Any:
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/fields
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/fields
Create a field for objects that can be configured.
Expand Down Expand Up @@ -965,7 +965,7 @@ def PrivateAttr(
default_factory: typing.Callable[[], Any] | None = None,
init: Literal[False] = False,
) -> Any:
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/models/#private-model-attributes
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/models/#private-model-attributes
Indicates that an attribute is intended for private use and not handled during normal validation/serialization.
Expand Down Expand Up @@ -1090,7 +1090,7 @@ def computed_field(
repr: bool | None = None,
return_type: Any = PydanticUndefined,
) -> PropertyT | typing.Callable[[PropertyT], PropertyT]:
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/fields#the-computed_field-decorator
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/fields#the-computed_field-decorator
Decorator to include `property` and `cached_property` when serializing models or dataclasses.
Expand Down
12 changes: 6 additions & 6 deletions pydantic/functional_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

@dataclasses.dataclass(frozen=True, **_internal_dataclass.slots_true)
class AfterValidator:
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/validators/#annotated-validators
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/validators/#annotated-validators
A metadata class that indicates that a validation should be applied **after** the inner validation logic.
Expand Down Expand Up @@ -83,7 +83,7 @@ def __get_pydantic_core_schema__(self, source_type: Any, handler: _GetCoreSchema

@dataclasses.dataclass(frozen=True, **_internal_dataclass.slots_true)
class BeforeValidator:
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/validators/#annotated-validators
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/validators/#annotated-validators
A metadata class that indicates that a validation should be applied **before** the inner validation logic.
Expand Down Expand Up @@ -127,7 +127,7 @@ def __get_pydantic_core_schema__(self, source_type: Any, handler: _GetCoreSchema

@dataclasses.dataclass(frozen=True, **_internal_dataclass.slots_true)
class PlainValidator:
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/validators/#annotated-validators
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/validators/#annotated-validators
A metadata class that indicates that a validation should be applied **instead** of the inner validation logic.
Expand Down Expand Up @@ -179,7 +179,7 @@ def __get_pydantic_core_schema__(self, source_type: Any, handler: _GetCoreSchema

@dataclasses.dataclass(frozen=True, **_internal_dataclass.slots_true)
class WrapValidator:
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/validators/#annotated-validators
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/validators/#annotated-validators
A metadata class that indicates that a validation should be applied **around** the inner validation logic.
Expand Down Expand Up @@ -298,7 +298,7 @@ def field_validator(
mode: FieldValidatorModes = 'after',
check_fields: bool | None = None,
) -> Callable[[Any], Any]:
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/validators/#field-validators
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/validators/#field-validators
Decorate methods on the class indicating that they should be used to validate fields.
Expand Down Expand Up @@ -540,7 +540,7 @@ def model_validator(
*,
mode: Literal['wrap', 'before', 'after'],
) -> Any:
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/validators/#model-validators
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/validators/#model-validators
Decorate model methods for validation purposes.
Expand Down
6 changes: 3 additions & 3 deletions pydantic/json_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def remap_json_schema(self, schema: Any) -> Any:


class GenerateJsonSchema:
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/json_schema/#customizing-the-json-schema-generation-process
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/json_schema/#customizing-the-json-schema-generation-process
A class for generating JSON schemas.
Expand Down Expand Up @@ -2353,7 +2353,7 @@ def _sort_json_schema(value: JsonSchemaValue, parent_key: str | None = None) ->

@dataclasses.dataclass(**_internal_dataclass.slots_true)
class WithJsonSchema:
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/json_schema/#withjsonschema-annotation
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/json_schema/#withjsonschema-annotation
Add this as an annotation on a field to override the (base) JSON schema that would be generated for that field.
This provides a way to set a JSON schema for types that would otherwise raise errors when producing a JSON schema,
Expand Down Expand Up @@ -2444,7 +2444,7 @@ def _get_all_json_refs(item: Any) -> set[JsonRef]:

@dataclasses.dataclass(**_internal_dataclass.slots_true)
class SkipJsonSchema:
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/json_schema/#skipjsonschema-annotation
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/json_schema/#skipjsonschema-annotation
Add this as an annotation on a field to skip generating a JSON schema for that field.
Expand Down
12 changes: 6 additions & 6 deletions pydantic/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@


class BaseModel(metaclass=_model_construction.ModelMetaclass):
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/models/
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/models/
A base class for creating Pydantic models.
Expand Down Expand Up @@ -296,7 +296,7 @@ def model_construct(cls, _fields_set: set[str] | None = None, **values: Any) ->
return m

def model_copy(self, *, update: dict[str, Any] | None = None, deep: bool = False) -> Self:
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/serialization/#model_copy
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/serialization/#model_copy
Returns a copy of the model.
Expand Down Expand Up @@ -338,7 +338,7 @@ def model_dump(
warnings: bool | Literal['none', 'warn', 'error'] = True,
serialize_as_any: bool = False,
) -> dict[str, Any]:
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/serialization/#modelmodel_dump
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/serialization/#modelmodel_dump
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
Expand Down Expand Up @@ -391,7 +391,7 @@ def model_dump_json(
warnings: bool | Literal['none', 'warn', 'error'] = True,
serialize_as_any: bool = False,
) -> str:
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/serialization/#modelmodel_dump_json
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/serialization/#modelmodel_dump_json
Generates a JSON representation of the model using Pydantic's `to_json` method.
Expand Down Expand Up @@ -577,7 +577,7 @@ def model_validate_json(
strict: bool | None = None,
context: Any | None = None,
) -> Self:
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/json/#json-parsing
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/json/#json-parsing
Validate the given JSON data against the Pydantic model.
Expand Down Expand Up @@ -1470,7 +1470,7 @@ def create_model( # noqa: C901
__slots__: tuple[str, ...] | None = None,
**field_definitions: Any,
) -> type[ModelT]:
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/models/#dynamic-model-creation
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/models/#dynamic-model-creation
Dynamically creates and returns a new Pydantic model, in other words, `create_model` dynamically creates a
subclass of [`BaseModel`][pydantic.BaseModel].
Expand Down
2 changes: 1 addition & 1 deletion pydantic/plugin/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/plugins#build-a-plugin
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/plugins#build-a-plugin
Plugin interface for Pydantic plugins, and related types.
"""
Expand Down
2 changes: 1 addition & 1 deletion pydantic/root_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class _RootModelMetaclass(_model_construction.ModelMetaclass): ...


class RootModel(BaseModel, typing.Generic[RootModelRootType], metaclass=_RootModelMetaclass):
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/models/#rootmodel-and-custom-root-types
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/models/#rootmodel-and-custom-root-types
A Pydantic `BaseModel` for the root object of the model.
Expand Down
6 changes: 3 additions & 3 deletions pydantic/type_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def wrapped(self: TypeAdapterT, *args: P.args, **kwargs: P.kwargs) -> R:

@final
class TypeAdapter(Generic[T]):
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/type_adapter/
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/type_adapter/
Type adapters provide a flexible way to perform validation and serialization based on a Python type.
Expand Down Expand Up @@ -376,7 +376,7 @@ def validate_python(
def validate_json(
self, data: str | bytes, /, *, strict: bool | None = None, context: dict[str, Any] | None = None
) -> T:
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/json/#json-parsing
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/json/#json-parsing
Validate a JSON string or bytes against the model.
Expand Down Expand Up @@ -488,7 +488,7 @@ def dump_json(
serialize_as_any: bool = False,
context: dict[str, Any] | None = None,
) -> bytes:
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/json/#json-serialization
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/json/#json-serialization
Serialize an instance of the adapted type to JSON.
Expand Down
8 changes: 4 additions & 4 deletions pydantic/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@

@_dataclasses.dataclass
class Strict(_fields.PydanticMetadata, BaseMetadata):
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/strict_mode/#strict-mode-with-annotated-strict
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/strict_mode/#strict-mode-with-annotated-strict
A field metadata class to indicate that a field should be validated in strict mode.
Expand Down Expand Up @@ -679,7 +679,7 @@ def conbytes(

@_dataclasses.dataclass(frozen=True)
class StringConstraints(annotated_types.GroupedMetadata):
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/fields/#string-constraints
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/fields/#string-constraints
Apply constraints to `str` types.
Expand Down Expand Up @@ -2596,7 +2596,7 @@ class Model(BaseModel):

@_dataclasses.dataclass(**_internal_dataclass.slots_true)
class GetPydanticSchema:
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/types/#using-getpydanticschema-to-reduce-boilerplate
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/types/#using-getpydanticschema-to-reduce-boilerplate
A convenience class for creating an annotation that provides pydantic custom type hooks.
Expand Down Expand Up @@ -2732,7 +2732,7 @@ def __get_pydantic_core_schema__(self, source_type: Any, handler: GetCoreSchemaH

@_dataclasses.dataclass(**_internal_dataclass.slots_true, frozen=True)
class Discriminator:
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/unions/#discriminated-unions-with-callable-discriminator
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/unions/#discriminated-unions-with-callable-discriminator
Provides a way to use a custom callable as the way to extract the value of a union discriminator.
Expand Down
2 changes: 1 addition & 1 deletion pydantic/validate_call_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def validate_call(
config: ConfigDict | None = None,
validate_return: bool = False,
) -> AnyCallableT | Callable[[AnyCallableT], AnyCallableT]:
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/validation_decorator/
"""Usage docs: https://docs.pydantic.dev/2.9/concepts/validation_decorator/
Returns a decorated wrapper around the function that validates the arguments and, optionally, the return value.
Expand Down
2 changes: 1 addition & 1 deletion pydantic/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

__all__ = 'VERSION', 'version_info'

VERSION = '2.8.0'
VERSION = '2.9.0a1'
"""The version of Pydantic."""


Expand Down

0 comments on commit d654a07

Please sign in to comment.