Skip to content

Latest commit

 

History

History
454 lines (248 loc) · 21.5 KB

CHANGELOG.md

File metadata and controls

454 lines (248 loc) · 21.5 KB

Changelog

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

1.0.2 - 2024-04-26

Fixed

Internals

1.0.1 - 2024-03-18

Fixed

  • Optional and Union generic types definition issues (#416 by @netomi)

  • Remove continuously changing example for DateTime objects (#406 by @Mokto)

Added

  • Support the examples property in Field descriptors (#404 by @Mokto)

Internals

1.0.0 - 2023-12-13

I'm excited to announce ODMantic v1.0.0, with Pydantic v2 support! 🎉

This release brings a range of changes that are aligned with the new Pydantic architecture. Keeping a maintainable and healthy codebase was especially important. Thus from now on, ODMantic will not support Python 3.7, Pydantic V1, and Motor 2.x anymore.

Overall, integrating with Pydantic v2 brings around 30% performance improvements on common operations. ⚡️⚡️⚡️

We have a lot of room to improve the performance further now that we only support Pydantic v2. There is also a 300% 👀 improvement on the bulk saves crafted by @tiangolo that will be merged soon! 🚀

Special thanks to @tiangolo for his help on this release and for saving me a lot of time figuring out a particularly annoying bug!

Check out the migration guide to upgrade your codebase and enjoy this new release!

Breaking changes

  • Support for Python 3.7, Pydantic v1 and Motor 2.x has been dropped

  • Optional[T] doesn't have a None implicit default value anymore

  • Model.copy doesn't support the exclude and include kwargs anymore

  • odmantic.Field doesn't accept extra kwargs anymore since it's slated to be removed in Pydantic

  • The Config class is no longer supported and the model_config dict should be used instead

  • DocumentParsingError is no longer a subclass of ValidationError

  • The __bson__ class method is no longer supported to define BSON encoders on custom types. The new method to customize BSON encoding is to use the WithBSONSerializer annotation.

  • Decimals (decimal.Decimal and bson.Decimal128) are now serialized as strings in JSON documents

  • Custom JSON encoders(defined with the json_encoders config option) are no longer effective on odmantic.bson types. Annotated types with pydantic.PlainSerializer should be used instead.

Removals

  • AIOEngineDependency has been removed since it was deprecated in v0.2.0 in favor of a global engine object

  • Defining the collection with __collection__ has been removed since it was deprecated in v0.3.0 in favor of the collection config option

Deprecations

We comply with the new Pydantic method naming, prefixing them with model_

  • Model.dict has been deprecated in favor of Model.model_dump

  • Model.doc has been deprecated in favor of Model.model_dump_doc

  • Model.parse_doc has been deprecated in favor of Model.model_validate_doc

  • Model.update has been deprecated in favor of Model.model_update

  • Model.copy has been deprecated in favor of Model.model_copy


Details

  • Integrate with Pydantic V2(#361 and #377 by @art049)

  • Update CI to use GitHub Actions matrix instead of tox, upgrade minimum Pydantic to 1.10.8 as needed by the tests (#376 by @tiangolo)

  • Add benchmarks on common sync operations (#362 by @art049)

0.9.2 - 2023-01-03

Fixed

  • Properly handle literals among generic types (#313 by @art049)

Internals

0.9.1 - 2022-11-24

Fixed

Internals

0.9.0 - 2022-09-25

Added

  • Create new generic types to support generic collection types (#240 by @erny & @art049)

    Thus, it's now possible to define models like this in python 3.9+ 🚀:

    class User(Model):
        scopes: list[str]
        friendsIds: list[ObjectId]
        skills: set[str]
  • Allow using generators with in_ and not_in (#270 by @art049)

Fixed

  • Fix EmbeddedModel generics definition with a custom key_name (#269 by @art049)

  • Raise a TypeError when defining a Reference in a generic(List, Dict, Tuple, ...) containing EmbeddedModels (#269 by @art049)

0.8.0 - 2022-09-09

Added

Fixed

  • Fix embedded models parsing with custom key_name (#262 by @iXB3)

  • Fix engine.save using an embedded model as a primary key (#258 by @art049)

  • Fix engine creation typo in the documentation (#257 by @art049)

0.7.1 - 2022-09-02

Fixed

  • Fix dataclass transform constructor type hints (#249 by @art049)

Internals

  • Update Mongo version in the CI build matrix (#247 by @art049)

0.7.0 - 2022-08-30

Added

Internals

  • Remove unnecessary Python 3.6 type fixes (#243 by @art049)

  • Switch Mongo action to art049/mongodb-cluster-action (#245 by @art049)

  • Add Realworld API integrated test (#246 by @art049)

0.6.0 - 2022-08-24

Breaking Changes

Added

  • Upgrade types and add support for instance autocompletion with dataclass_transform (VS Code autocompletion) (#230 by @tiangolo)

  • Support Python 3.10 (#235 by @art049)

Fixed

  • Fix using the shared session when updating a document (#227 by @tiangolo)

  • Fix EmbeddedModel deep copy mutability (#239 by @art049)

  • Allow models to contain string-based datetime fields that indicate UTC (#136 by @kfox)

  • Fix Reference usage with non the non default primary key (#184 by @dynalz)

  • Fix key_name use on EmbeddedModels (#195 by @jvanegmond)

Internals

0.5.0 - 2022-06-01

0.4.0 - 2022-04-23

Added

Fixed

Internals

0.3.5 - 2021-05-12

Security

0.3.4 - 2021-03-04

Fixed

  • Fix modified mark clearing on save for nested models (#88 by @Olegt0rr)

  • Don't replace default field description for ObjectId (#82 by @Olegt0rr)

Internals

0.3.3 - 2021-02-13

Fixed

  • Remove bypass_document_validation save option to avoid Not Authorized errors (#85 by @Olegt0rr)

  • Fix microseconds issue: use truncation instead of round (#100 by @erny)

  • Add py.typed to ship typing information for mypy (#101 by @art049)

  • Fix datetime field default example value naiveness (#103 by @art049)

Internals

0.3.2 - 2020-12-15

Added

Internals

0.3.1 - 2020-11-16

Added

Fixed

  • Fix setattr error on a manually initialized EmbeddedModel (#40 by @art049)

0.3.0 - 2020-11-09

Deprecated

  • Deprecate usage of __collection__ to customize the collection name. Prefer the collection Config option (more details)

Added

  • Allow parsing document with unset fields defaults (documentation) (#28 by @art049)

  • Integration with Pydantic Config class (#37 by @art049):

    • It's now possible to define custom json_encoders on the Models
    • Some other Config options provided by Pydantic are now available (more details)
  • Support CPython 3.9 (#32 by @art049)

  • Unpin pydantic to support 1.7.0 (#29 by @art049)

0.2.1 - 2020-10-25

Fixed

  • Fix combined use of skip and limit with engine.find (#25 by @art049)

0.2.0 - 2020-10-25

Deprecated

  • Deprecate AIOEngineDependency to prefer a global engine object, more details (#21 by @art049)

Added

Fixed

  • Fix FastAPI usage with References (#19 by @art049)

Docs

  • Adding a CONTRIBUTING.md file to the root directory with link to docs (#8 by @sanders41)
  • Raw Query Usage Documentation Fix (#10 by @adeelsohailahmed)
  • Update Filtering to include Bitwise Operator Warning (#24 by @adeelsohailahmed)

0.1.0 - 2020-10-19

Initial Release