Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prep for 2.7 beta release 🚀 #9158

Merged
merged 5 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 131 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,134 @@
## v2.7.0b1 (2024-04-03)

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

### What's Changed

#### Packaging

* Reorganize `pyproject.toml` sections by @Viicos in [#8899](https://github.com/pydantic/pydantic/pull/8899)
* Bump `pydantic-core` to `v2.18.0` by @sydney-runkle in [#9153](https://github.com/pydantic/pydantic/pull/9153)
* Adopt `jiter` `v0.2.0` by @samuelcolvin in [pydantic/pydantic-core#1250](https://github.com/pydantic/pydantic-core/pull/1250)

#### New Features

* Extract attribute docstrings from `FieldInfo.description` by @Viicos in [#6563](https://github.com/pydantic/pydantic/pull/6563)
* Add a `with_config` decorator to comply with typing spec by @Viicos in [#8611](https://github.com/pydantic/pydantic/pull/8611)
* Allow an optional separator splitting the value and unit of the result of `ByteSize.human_readable` by @jks15satoshi in [#8706](https://github.com/pydantic/pydantic/pull/8706)
* Add generic `Secret` base type by @conradogarciaberrotaran in [#8519](https://github.com/pydantic/pydantic/pull/8519)
* Make use of `Sphinx` inventories for cross references in docs by @Viicos in [#8682](https://github.com/pydantic/pydantic/pull/8682)
* Add environment variable to disable plugins by @geospackle in [#8767](https://github.com/pydantic/pydantic/pull/8767)
* Add support for `deprecated` fields by @Viicos in [#8237](https://github.com/pydantic/pydantic/pull/8237)
* Allow `field_serializer('*')` by @ornariece in [#9001](https://github.com/pydantic/pydantic/pull/9001)
* Handle a case when `model_config` is defined as a model property by @alexeyt101 in [#9004](https://github.com/pydantic/pydantic/pull/9004)
* Update `create_model()` to support `typing.Annotated` as input by @wannieman98 in [#8947](https://github.com/pydantic/pydantic/pull/8947)
* Add `ClickhouseDsn` support by @solidguy7 in [#9062](https://github.com/pydantic/pydantic/pull/9062)
* Add support for `re.Pattern[str]` to `pattern` field by @jag-k in [#9053](https://github.com/pydantic/pydantic/pull/9053)
* Support for `serialize_as_any` runtime setting by @sydney-runkle in [#8830](https://github.com/pydantic/pydantic/pull/8830)
* Add support for `typing.Self` by @Youssefares in [#9023](https://github.com/pydantic/pydantic/pull/9023)
* Ability to pass `context` to serialization by @ornariece in [#8965](https://github.com/pydantic/pydantic/pull/8965)
* Add feedback widget to docs with flarelytics integration by @sydney-runkle in [#9129](https://github.com/pydantic/pydantic/pull/9129)
* Support for parsing partial JSON strings in Python by @samuelcolvin in [pydantic/jiter#66](https://github.com/pydantic/jiter/pull/66)

#### Changes

* Correct docs, logic for `model_construct` behavior with `extra` by @sydney-runkle in [#8807](https://github.com/pydantic/pydantic/pull/8807)
* Improve error message for improper `RootModel` subclasses by @sydney-runkle in [#8857](https://github.com/pydantic/pydantic/pull/8857)
* Use `PEP570` syntax by @Viicos in [#8940](https://github.com/pydantic/pydantic/pull/8940)
* Add `enum` and `type` to the JSON schema for single item literals by @dmontagu in [#8944](https://github.com/pydantic/pydantic/pull/8944)
* Deprecate `update_json_schema` internal function by @sydney-runkle in [#9125](https://github.com/pydantic/pydantic/pull/9125)
* Serialize duration to hour minute second, instead of just seconds by @kakilangit in [pydantic/speedate#50](https://github.com/pydantic/speedate/pull/50)
* Trimming str before parsing to int and float by @hungtsetse in [pydantic/pydantic-core#1203](https://github.com/pydantic/pydantic-core/pull/1203)

#### Performance

* `enum` validator improvements by @samuelcolvin in [#9045](https://github.com/pydantic/pydantic/pull/9045)
* Move `enum` validation and serialization to Rust by @samuelcolvin in [#9064](https://github.com/pydantic/pydantic/pull/9064)
* Improve schema generation for nested dataclasses by @sydney-runkle in [#9114](https://github.com/pydantic/pydantic/pull/9114)
* Fast path for ASCII python string creation in JSON by @samuelcolvin in in [pydantic/jiter#72](https://github.com/pydantic/jiter/pull/72)
* SIMD integer and string JSON parsing on `aarch64`(**Note:** SIMD on x86 will be implemented in a future release) by @samuelcolvin in in [pydantic/jiter#65](https://github.com/pydantic/jiter/pull/65)
* Support JSON `Cow<str>` from `jiter` by @davidhewitt in [pydantic/pydantic-core#1231](https://github.com/pydantic/pydantic-core/pull/1231)
* MAJOR performance improvement: update to PyO3 0.21 final by @davidhewitt in [pydantic/pydantic-core#1248](https://github.com/pydantic/pydantic-core/pull/1248)
* cache Python strings by @samuelcolvin in [pydantic/pydantic-core#1240](https://github.com/pydantic/pydantic-core/pull/1240)

#### Fixes

* Fix strict parsing for some `Sequence`s by @sydney-runkle in [#8614](https://github.com/pydantic/pydantic/pull/8614)
* Add a check on the existence of `__qualname__` by @anci3ntr0ck in [#8642](https://github.com/pydantic/pydantic/pull/8642)
* Handle `__pydantic_extra__` annotation being a string or inherited by @alexmojaki in [#8659](https://github.com/pydantic/pydantic/pull/8659)
* Fix json validation for `NameEmail` by @Holi0317 in [#8650](https://github.com/pydantic/pydantic/pull/8650)
* Fix type-safety of attribute access in `BaseModel` by @bluenote10 in [#8651](https://github.com/pydantic/pydantic/pull/8651)
* Fix bug with `mypy` plugin and `no_strict_optional = True` by @dmontagu in [#8666](https://github.com/pydantic/pydantic/pull/8666)
* Fix `ByteSize` error `type` change by @sydney-runkle in [#8681](https://github.com/pydantic/pydantic/pull/8681)
* Fix inheriting annotations in dataclasses by @sydney-runkle in [#8679](https://github.com/pydantic/pydantic/pull/8679)
* Fix regression in core schema generation for indirect definition references by @dmontagu in [#8702](https://github.com/pydantic/pydantic/pull/8702)
* Fix unsupported types bug with plain validator by @sydney-runkle in [#8710](https://github.com/pydantic/pydantic/pull/8710)
* Reverting problematic fix from 2.6 release, fixing schema building bug by @sydney-runkle in [#8718](https://github.com/pydantic/pydantic/pull/8718)
* fixes `__pydantic_config__` ignored for TypeDict by @13sin in [#8734](https://github.com/pydantic/pydantic/pull/8734)
* Fix test failures with `pytest v8.0.0` due to `pytest.warns()` starting to work inside `pytest.raises()` by @mgorny in [#8678](https://github.com/pydantic/pydantic/pull/8678)
* Use `is_valid_field` from 1.x for `mypy` plugin by @DanielNoord in [#8738](https://github.com/pydantic/pydantic/pull/8738)
* Better-support `mypy` strict equality flag by @dmontagu in [#8799](https://github.com/pydantic/pydantic/pull/8799)
* model_json_schema export with Annotated types misses 'required' parameters by @LouisGobert in [#8793](https://github.com/pydantic/pydantic/pull/8793)
* Fix default inclusion in `FieldInfo.__repr_args__` by @sydney-runkle in [#8801](https://github.com/pydantic/pydantic/pull/8801)
* Fix resolution of forward refs in dataclass base classes that are not present in the subclass module namespace by @matsjoyce-refeyn in [#8751](https://github.com/pydantic/pydantic/pull/8751)
* Fix `BaseModel` type annotations to be resolvable by `typing.get_type_hints` by @devmonkey22 in [#7680](https://github.com/pydantic/pydantic/pull/7680)
* Fix: allow empty string aliases with `AliasGenerator` by @sydney-runkle in [#8810](https://github.com/pydantic/pydantic/pull/8810)
* Fix test along with `date` -> `datetime` timezone assumption fix by @sydney-runkle in [#8823](https://github.com/pydantic/pydantic/pull/8823)
* Fix deprecation warning with usage of `ast.Str` by @Viicos in [#8837](https://github.com/pydantic/pydantic/pull/8837)
* Add missing `deprecated` decorators by @Viicos in [#8877](https://github.com/pydantic/pydantic/pull/8877)
* Fix serialization of `NameEmail` if name includes an email address by @NeevCohen in [#8860](https://github.com/pydantic/pydantic/pull/8860)
* Add information about class in error message of schema generation by @Czaki in [#8917](https://github.com/pydantic/pydantic/pull/8917)
* Make `TypeAdapter`'s typing compatible with special forms by @adriangb in [#8923](https://github.com/pydantic/pydantic/pull/8923)
* Fix issue with config behavior being baked into the ref schema for `enum`s by @dmontagu in [#8920](https://github.com/pydantic/pydantic/pull/8920)
* More helpful error re wrong `model_json_schema` usage by @sydney-runkle in [#8928](https://github.com/pydantic/pydantic/pull/8928)
* Fix nested discriminated union schema gen, pt 2 by @sydney-runkle in [#8932](https://github.com/pydantic/pydantic/pull/8932)
* Fix schema build for nested dataclasses / TypedDicts with discriminators by @sydney-runkle in [#8950](https://github.com/pydantic/pydantic/pull/8950)
* Remove unnecessary logic for definitions schema gen with discriminated unions by @sydney-runkle in [#8951](https://github.com/pydantic/pydantic/pull/8951)
* Fix handling of optionals in `mypy` plugin by @dmontagu in [#9008](https://github.com/pydantic/pydantic/pull/9008)
* Fix `PlainSerializer` usage with std type constructor by @sydney-runkle in [#9031](https://github.com/pydantic/pydantic/pull/9031)
* Remove unnecessary warning for config in plugin by @dmontagu in [#9039](https://github.com/pydantic/pydantic/pull/9039)
* Fix default value serializing by @NeevCohen in [#9066](https://github.com/pydantic/pydantic/pull/9066)
* Fix extra fields check in `Model.__getattr__()` by @NeevCohen in [#9082](https://github.com/pydantic/pydantic/pull/9082)
* Fix `ClassVar` forward ref inherited from parent class by @alexmojaki in [#9097](https://github.com/pydantic/pydantic/pull/9097)
* fix sequence like validator with strict `True` by @andresliszt in [#8977](https://github.com/pydantic/pydantic/pull/8977)
* Improve warning message when a field name shadows a field in a parent model by @chan-vince in [#9105](https://github.com/pydantic/pydantic/pull/9105)
* Do not warn about shadowed fields if they are not redefined in a child class by @chan-vince in [#9111](https://github.com/pydantic/pydantic/pull/9111)
* Fix discriminated union bug with unsubstituted type var by @sydney-runkle in [#9124](https://github.com/pydantic/pydantic/pull/9124)
* Support serialization of `deque` when passed to `Sequence[blah blah blah]` by @sydney-runkle in [#9128](https://github.com/pydantic/pydantic/pull/9128)
* Init private attributes from super-types in `model_post_init` by @Viicos in [#9134](https://github.com/pydantic/pydantic/pull/9134)
* fix `model_construct` with `validation_alias` by @ornariece in [#9144](https://github.com/pydantic/pydantic/pull/9144)
* Ensure json-schema generator handles `Literal` `null` types by @bruno-f-cruz in [#9135](https://github.com/pydantic/pydantic/pull/9135)

### New Contributors

* @hungtsetse made their first contribution in [#8546](https://github.com/pydantic/pydantic/pull/8546)
* @StrawHatDrag0n made their first contribution in [#8583](https://github.com/pydantic/pydantic/pull/8583)
* @anci3ntr0ck made their first contribution in [#8642](https://github.com/pydantic/pydantic/pull/8642)
* @Holi0317 made their first contribution in [#8650](https://github.com/pydantic/pydantic/pull/8650)
* @bluenote10 made their first contribution in [#8651](https://github.com/pydantic/pydantic/pull/8651)
* @ADSteele916 made their first contribution in [#8703](https://github.com/pydantic/pydantic/pull/8703)
* @musicinmybrain made their first contribution in [#8731](https://github.com/pydantic/pydantic/pull/8731)
* @jks15satoshi made their first contribution in [#8706](https://github.com/pydantic/pydantic/pull/8706)
* @13sin made their first contribution in [#8734](https://github.com/pydantic/pydantic/pull/8734)
* @DanielNoord made their first contribution in [#8738](https://github.com/pydantic/pydantic/pull/8738)
* @conradogarciaberrotaran made their first contribution in [#8519](https://github.com/pydantic/pydantic/pull/8519)
* @chris-griffin made their first contribution in [#8775](https://github.com/pydantic/pydantic/pull/8775)
* @LouisGobert made their first contribution in [#8793](https://github.com/pydantic/pydantic/pull/8793)
* @matsjoyce-refeyn made their first contribution in [#8751](https://github.com/pydantic/pydantic/pull/8751)
* @devmonkey22 made their first contribution in [#7680](https://github.com/pydantic/pydantic/pull/7680)
* @adamency made their first contribution in [#8847](https://github.com/pydantic/pydantic/pull/8847)
* @MamfTheKramf made their first contribution in [#8851](https://github.com/pydantic/pydantic/pull/8851)
* @ornariece made their first contribution in [#9001](https://github.com/pydantic/pydantic/pull/9001)
* @alexeyt101 made their first contribution in [#9004](https://github.com/pydantic/pydantic/pull/9004)
* @wannieman98 made their first contribution in [#8947](https://github.com/pydantic/pydantic/pull/8947)
* @solidguy7 made their first contribution in [#9062](https://github.com/pydantic/pydantic/pull/9062)
* @kloczek made their first contribution in [#9047](https://github.com/pydantic/pydantic/pull/9047)
* @jag-k made their first contribution in [#9053](https://github.com/pydantic/pydantic/pull/9053)
* @priya-gitTest made their first contribution in [#9088](https://github.com/pydantic/pydantic/pull/9088)
* @Youssefares made their first contribution in [#9023](https://github.com/pydantic/pydantic/pull/9023)
* @chan-vince made their first contribution in [#9105](https://github.com/pydantic/pydantic/pull/9105)
* @bruno-f-cruz made their first contribution in [#9135](https://github.com/pydantic/pydantic/pull/9135)

## v2.6.4 (2024-03-12)

[GitHub release](https://github.com/pydantic/pydantic/releases/tag/v2.6.4)
Expand Down
116 changes: 116 additions & 0 deletions pydantic/v1/v1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# NOTE This file aliases the pydantic namespace as pydantic.v1 for smoother v1 -> v2 transition
# flake8: noqa
from pydantic import *

# WARNING __all__ from .errors is not included here, it will be removed as an export here in v2
# please use "from pydantic.errors import ..." instead
__all__ = [
# annotated types utils
"create_model_from_namedtuple",
"create_model_from_typeddict",
# dataclasses
"dataclasses",
# class_validators
"root_validator",
"validator",
# config
"BaseConfig",
"ConfigDict",
"Extra",
# decorator
"validate_arguments",
# env_settings
"BaseSettings",
# error_wrappers
"ValidationError",
# fields
"Field",
"Required",
# main
"BaseModel",
"create_model",
"validate_model",
# network
"AnyUrl",
"AnyHttpUrl",
"FileUrl",
"HttpUrl",
"stricturl",
"EmailStr",
"NameEmail",
"IPvAnyAddress",
"IPvAnyInterface",
"IPvAnyNetwork",
"PostgresDsn",
"CockroachDsn",
"AmqpDsn",
"RedisDsn",
"MongoDsn",
"KafkaDsn",
"validate_email",
# parse
"Protocol",
# tools
"parse_file_as",
"parse_obj_as",
"parse_raw_as",
"schema_of",
"schema_json_of",
# types
"NoneStr",
"NoneBytes",
"StrBytes",
"NoneStrBytes",
"StrictStr",
"ConstrainedBytes",
"conbytes",
"ConstrainedList",
"conlist",
"ConstrainedSet",
"conset",
"ConstrainedFrozenSet",
"confrozenset",
"ConstrainedStr",
"constr",
"PyObject",
"ConstrainedInt",
"conint",
"PositiveInt",
"NegativeInt",
"NonNegativeInt",
"NonPositiveInt",
"ConstrainedFloat",
"confloat",
"PositiveFloat",
"NegativeFloat",
"NonNegativeFloat",
"NonPositiveFloat",
"FiniteFloat",
"ConstrainedDecimal",
"condecimal",
"ConstrainedDate",
"condate",
"UUID1",
"UUID3",
"UUID4",
"UUID5",
"FilePath",
"DirectoryPath",
"Json",
"JsonWrapper",
"SecretField",
"SecretStr",
"SecretBytes",
"StrictBool",
"StrictBytes",
"StrictInt",
"StrictFloat",
"PaymentCardNumber",
"PrivateAttr",
"ByteSize",
"PastDate",
"FutureDate",
# version
"compiled",
"VERSION",
]
2 changes: 1 addition & 1 deletion pydantic/v1/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
__all__ = 'compiled', 'VERSION', 'version_info'

VERSION = '1.10.14'
VERSION = '1.10.15'

try:
import cython # type: ignore
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.0a1'
VERSION = '2.7.0b1'
"""The version of Pydantic."""


Expand Down
Loading