Skip to content

Commit

Permalink
Version related housekeeping (#9517)
Browse files Browse the repository at this point in the history
  • Loading branch information
sydney-runkle committed May 28, 2024
1 parent e874535 commit 7102ff5
Show file tree
Hide file tree
Showing 16 changed files with 134 additions and 116 deletions.
18 changes: 18 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
## v2.7.2 (2024-05-28)

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

### What's Changed

#### Packaging

* Bump `pydantic-core` to `v2.18.3` by @sydney-runkle in [#9515](https://github.com/pydantic/pydantic/pull/9515)

#### Fixes

* Replace `__spec__.parent` with `__package__` by @hramezani in [#9331](https://github.com/pydantic/pydantic/pull/9331)
* Fix validation of `int`s with leading unary minus by @RajatRajdeep in [pydantic/pydantic-core#1291](https://github.com/pydantic/pydantic-core/pull/1291)
* Fix `str` subclass validation for enums by @sydney-runkle in [pydantic/pydantic-core#1273]https://github.com/pydantic/pydantic-core/pull/1273
* Support `BigInt`s in `Literal`s and `Enum`s by @samuelcolvin in [pydantic/pydantic-core#1297]https://github.com/pydantic/pydantic-core/pull/1297
* Fix: uuid - allow `str` subclass as input by @davidhewitt in [pydantic/pydantic-core#1296]https://github.com/pydantic/pydantic-core/pull/1296

## v2.7.1 (2024-04-23)

[GitHub release](https://github.com/pydantic/pydantic/releases/tag/v2.7.1)
Expand Down
162 changes: 81 additions & 81 deletions pdm.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions pydantic/aliases.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

@dataclasses.dataclass(**_internal_dataclass.slots_true)
class AliasPath:
"""Usage docs: https://docs.pydantic.dev/2.7/concepts/alias#aliaspath-and-aliaschoices
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/alias#aliaspath-and-aliaschoices
A data class used by `validation_alias` as a convenience to create aliases.
Expand Down Expand Up @@ -54,7 +54,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.7/concepts/alias#aliaspath-and-aliaschoices
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/alias#aliaspath-and-aliaschoices
A data class used by `validation_alias` as a convenience to create aliases.
Expand Down Expand Up @@ -84,7 +84,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.7/concepts/alias#using-an-aliasgenerator
"""Usage docs: https://docs.pydantic.dev/2.8/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 @@ -993,7 +993,7 @@ class Model(BaseModel):


def with_config(config: ConfigDict) -> Callable[[_TypeT], _TypeT]:
"""Usage docs: https://docs.pydantic.dev/2.7/concepts/config/#configuration-with-dataclass-from-the-standard-library-or-typeddict
"""Usage docs: https://docs.pydantic.dev/2.8/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 @@ -108,7 +108,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.7/concepts/dataclasses/
"""Usage docs: https://docs.pydantic.dev/2.8/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 @@ -699,7 +699,7 @@ def Field( # noqa: C901
union_mode: Literal['smart', 'left_to_right'] = _Unset,
**extra: Unpack[_EmptyKwargs],
) -> Any:
"""Usage docs: https://docs.pydantic.dev/2.7/concepts/fields
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/fields
Create a field for objects that can be configured.
Expand Down Expand Up @@ -936,7 +936,7 @@ def PrivateAttr(
default_factory: typing.Callable[[], Any] | None = None,
init: Literal[False] = False,
) -> Any:
"""Usage docs: https://docs.pydantic.dev/2.7/concepts/models/#private-model-attributes
"""Usage docs: https://docs.pydantic.dev/2.8/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 @@ -1059,7 +1059,7 @@ def computed_field(
repr: bool | None = None,
return_type: Any = PydanticUndefined,
) -> PropertyT | typing.Callable[[PropertyT], PropertyT]:
"""Usage docs: https://docs.pydantic.dev/2.7/concepts/fields#the-computed_field-decorator
"""Usage docs: https://docs.pydantic.dev/2.8/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.7/concepts/validators/#annotated-validators
"""Usage docs: https://docs.pydantic.dev/2.8/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.7/concepts/validators/#annotated-validators
"""Usage docs: https://docs.pydantic.dev/2.8/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.7/concepts/validators/#annotated-validators
"""Usage docs: https://docs.pydantic.dev/2.8/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.7/concepts/validators/#annotated-validators
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/validators/#annotated-validators
A metadata class that indicates that a validation should be applied **around** the inner validation logic.
Expand Down Expand Up @@ -303,7 +303,7 @@ def field_validator(
mode: FieldValidatorModes = 'after',
check_fields: bool | None = None,
) -> Callable[[Any], Any]:
"""Usage docs: https://docs.pydantic.dev/2.7/concepts/validators/#field-validators
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/validators/#field-validators
Decorate methods on the class indicating that they should be used to validate fields.
Expand Down Expand Up @@ -552,7 +552,7 @@ def model_validator(
*,
mode: Literal['wrap', 'before', 'after'],
) -> Any:
"""Usage docs: https://docs.pydantic.dev/2.7/concepts/validators/#model-validators
"""Usage docs: https://docs.pydantic.dev/2.8/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 @@ -228,7 +228,7 @@ def remap_json_schema(self, schema: Any) -> Any:


class GenerateJsonSchema:
"""Usage docs: https://docs.pydantic.dev/2.7/concepts/json_schema/#customizing-the-json-schema-generation-process
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/json_schema/#customizing-the-json-schema-generation-process
A class for generating JSON schemas.
Expand Down Expand Up @@ -2333,7 +2333,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.7/concepts/json_schema/#withjsonschema-annotation
"""Usage docs: https://docs.pydantic.dev/2.8/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 @@ -2422,7 +2422,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.7/concepts/json_schema/#skipjsonschema-annotation
"""Usage docs: https://docs.pydantic.dev/2.8/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 @@ -77,7 +77,7 @@


class BaseModel(metaclass=_model_construction.ModelMetaclass):
"""Usage docs: https://docs.pydantic.dev/2.7/concepts/models/
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/models/
A base class for creating Pydantic models.
Expand Down Expand Up @@ -294,7 +294,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.7/concepts/serialization/#model_copy
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/serialization/#model_copy
Returns a copy of the model.
Expand Down Expand Up @@ -336,7 +336,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.7/concepts/serialization/#modelmodel_dump
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/serialization/#modelmodel_dump
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
Expand Down Expand Up @@ -389,7 +389,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.7/concepts/serialization/#modelmodel_dump_json
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/serialization/#modelmodel_dump_json
Generates a JSON representation of the model using Pydantic's `to_json` method.
Expand Down Expand Up @@ -575,7 +575,7 @@ def model_validate_json(
strict: bool | None = None,
context: Any | None = None,
) -> Self:
"""Usage docs: https://docs.pydantic.dev/2.7/concepts/json/#json-parsing
"""Usage docs: https://docs.pydantic.dev/2.8/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.7/concepts/models/#dynamic-model-creation
"""Usage docs: https://docs.pydantic.dev/2.8/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.7/concepts/plugins#build-a-plugin
"""Usage docs: https://docs.pydantic.dev/2.8/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 @@ -34,7 +34,7 @@ class _RootModelMetaclass(_model_construction.ModelMetaclass):


class RootModel(BaseModel, typing.Generic[RootModelRootType], metaclass=_RootModelMetaclass):
"""Usage docs: https://docs.pydantic.dev/2.7/concepts/models/#rootmodel-and-custom-root-types
"""Usage docs: https://docs.pydantic.dev/2.8/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 @@ -147,7 +147,7 @@ def wrapped(self: TypeAdapterT, *args: P.args, **kwargs: P.kwargs) -> R:

@final
class TypeAdapter(Generic[T]):
"""Usage docs: https://docs.pydantic.dev/2.7/concepts/type_adapter/
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/type_adapter/
Type adapters provide a flexible way to perform validation and serialization based on a Python type.
Expand Down Expand Up @@ -375,7 +375,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.7/concepts/json/#json-parsing
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/json/#json-parsing
Validate a JSON string or bytes against the model.
Expand Down Expand Up @@ -483,7 +483,7 @@ def dump_json(
warnings: bool | Literal['none', 'warn', 'error'] = True,
serialize_as_any: bool = False,
) -> bytes:
"""Usage docs: https://docs.pydantic.dev/2.7/concepts/json/#json-serialization
"""Usage docs: https://docs.pydantic.dev/2.8/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 @@ -117,7 +117,7 @@

@_dataclasses.dataclass
class Strict(_fields.PydanticMetadata, BaseMetadata):
"""Usage docs: https://docs.pydantic.dev/2.7/concepts/strict_mode/#strict-mode-with-annotated-strict
"""Usage docs: https://docs.pydantic.dev/2.8/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 @@ -677,7 +677,7 @@ def conbytes(

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

@_dataclasses.dataclass(**_internal_dataclass.slots_true)
class GetPydanticSchema:
"""Usage docs: https://docs.pydantic.dev/2.7/concepts/types/#using-getpydanticschema-to-reduce-boilerplate
"""Usage docs: https://docs.pydantic.dev/2.8/concepts/types/#using-getpydanticschema-to-reduce-boilerplate
A convenience class for creating an annotation that provides pydantic custom type hooks.
Expand Down Expand Up @@ -2730,7 +2730,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.7/concepts/unions/#discriminated-unions-with-callable-discriminator
"""Usage docs: https://docs.pydantic.dev/2.8/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 @@ -33,7 +33,7 @@ def validate_call(
config: ConfigDict | None = None,
validate_return: bool = False,
) -> AnyCallableT | Callable[[AnyCallableT], AnyCallableT]:
"""Usage docs: https://docs.pydantic.dev/2.7/concepts/validation_decorator/
"""Usage docs: https://docs.pydantic.dev/2.8/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 @@ -3,7 +3,7 @@

__all__ = 'VERSION', 'version_info'

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


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ requires-python = '>=3.8'
dependencies = [
'typing-extensions>=4.6.1',
'annotated-types>=0.4.0',
"pydantic-core==2.18.2",
"pydantic-core==2.18.3",
]
dynamic = ['version', 'readme']

Expand Down

0 comments on commit 7102ff5

Please sign in to comment.