Changelog¶
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Unreleased¶
1.0.2 - 2024-04-26¶
Fixed¶
- fix: support pydantic 2.7 (#462 by @adriencaccia)
Internals¶
-
chore(bench): update CodSpeed/action to v2 (#461 by @adriencaccia)
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¶
Internals¶
-
Fix Pydantic docs URLs (#366 by @aminalaee)
-
Add a test with a model when defining multiple optional fields (#426 by @art049)
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 aNone
implicit default value anymore -
Model.copy
doesn't support theexclude
andinclude
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 themodel_config
dict should be used instead -
DocumentParsingError
is no longer a subclass ofValidationError
-
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 theWithBSONSerializer
annotation. -
Decimals (
decimal.Decimal
andbson.Decimal128
) are now serialized as strings in JSON documents -
Custom JSON encoders(defined with the
json_encoders
config option) are no longer effective onodmantic.bson
types. Annotated types withpydantic.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 thecollection
config option
Deprecations¶
We comply with the new Pydantic method naming, prefixing them with model_
-
Model.dict
has been deprecated in favor ofModel.model_dump
-
Model.doc
has been deprecated in favor ofModel.model_dump_doc
-
Model.parse_doc
has been deprecated in favor ofModel.model_validate_doc
-
Model.update
has been deprecated in favor ofModel.model_update
-
Model.copy
has been deprecated in favor ofModel.model_copy
Details¶
-
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)
0.9.2 - 2023-01-03¶
Fixed¶
Internals¶
0.9.1 - 2022-11-24¶
Fixed¶
- Bump motor version (#296 by @valeriiduz)
Internals¶
0.9.0 - 2022-09-25¶
Added¶
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]
Fixed¶
-
Fix
EmbeddedModel
generics definition with a customkey_name
(#269 by @art049) -
Raise a
TypeError
when defining aReference
in a generic(List, Dict, Tuple, ...) containing EmbeddedModels (#269 by @art049)
0.8.0 - 2022-09-09¶
Added¶
-
Allow Index definition (feature documentation) (#255 by @art049)
-
Allow using the
Config.extra
attribute from pydantic (#259 by @art049)
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¶
Internals¶
0.7.0 - 2022-08-30¶
Added¶
-
Add new SyncEngine, support async and sync code (#231 by @tiangolo)
-
Friendly interface for session and transactions (#244 by @art049)
-
Implement the
engine.remove
method to allow instance deletion from a query (#147 & #237 by @joeriddles & @art049)
Internals¶
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)
Fixed¶
-
Fix using the shared session when updating a document (#227 by @tiangolo)
-
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¶
-
Update and copy methods:
- Updating multiple fields at once is now directly possible from a pydantic model or a dictionary (feature documentation, sample use case with FastAPI)
- Changing the primary field of an instance is now easier (documentation)
Fixed¶
-
Update example in README (#192 by @jasper-moment)
Internals¶
-
⬆️ Update motor requirement from >=2.1.0,<2.5.0 to >=2.1.0,<2.6.0 (#160 by @dependabot[bot])
-
⬆️ Update typer requirement from ^0.3.2 to ^0.4.1 (#214 by @dependabot[bot])
-
⬆️ Update mypy requirement from ^0.910 to ^0.942 (#215 by @dependabot[bot])
-
⬆️ Update fastapi requirement from >=0.61.1,<0.67.0 to >=0.61.1,<0.69.0 (#166 by @dependabot[bot])
-
⬆️ Update fastapi requirement from >=0.61.1,<0.64.0 to >=0.61.1,<0.67.0 (#150 by @dependabot[bot])
-
⬆️ Update mypy requirement from ^0.812 to ^0.910 (#142 by @dependabot[bot])
-
⬆️ Update pytest-asyncio requirement from ^0.14.0 to ^0.15.0 (#125 by @dependabot[bot])
-
⬆️ Update motor requirement from >=2.1.0,<2.4.0 to >=2.1.0,<2.5.0 (#124 by @dependabot[bot])
-
⬆️ Update importlib-metadata requirement from >=1,<4 to >=1,<5 (#126 by @dependabot[bot])
-
⬆️ Update pydocstyle requirement from ^5.1.1 to ^6.0.0 (#119 by @dependabot[bot])
-
⬆️ Update isort requirement from ~=5.7.0 to ~=5.8.0 (#122 by @dependabot[bot])
-
⬆️ Update flake8 requirement from ~=3.8.4 to ~=3.9.0 (#116 by @dependabot[bot])
0.3.5 - 2021-05-12¶
Security¶
- Change allowed pydantic versions to handle CVE-2021-29510 by @art049
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¶
-
CI Matrix with Standalone instances, ReplicaSets and Sharded clusters (#91 by @art049)
-
Update mkdocstrings requirement from ^0.14.0 to ^0.15.0 (#110 by @dependabot[bot])
-
Update mkdocs-material requirement from ^6.0.2 to ^7.0.3 (#111 by @dependabot[bot])
-
Update mypy requirement from ^0.800 to ^0.812 (#106 by @dependabot[bot])
0.3.3 - 2021-02-13¶
Fixed¶
-
Remove
bypass_document_validation
save option to avoidNot 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¶
-
Update pytz requirement from ^2020.1 to ^2021.1 (#98 by @dependabot[bot])
-
Update mkdocstrings requirement from ^0.13.2 to ^0.14.0 (#92 by @dependabot[bot])
-
Update mypy requirement from ^0.790 to ^0.800 (#97 by @dependabot[bot])
-
Update isort requirement from ~=5.6.4 to ~=5.7.0 (#90 by @dependabot[bot])
-
Update fastapi requirement from >=0.61.1,<0.63.0 to >=0.61.1,<0.64.0 (#84 by @dependabot[bot])
0.3.2 - 2020-12-15¶
Added¶
Internals¶
-
Migrate to the updated prettier precommit hook (#74 by @art049)
-
Update uvicorn requirement from ^0.12.1 to ^0.13.0 (#67 by @dependabot[bot])
-
Update mypy requirement from ^0.782 to ^0.790 (#48 by @dependabot[bot])
-
Update importlib-metadata requirement from ^1.0 to >=1,<4 (#54 by @dependabot[bot])
-
Update flake8 requirement from ==3.8.3 to ==3.8.4 (#47 by @dependabot[bot])
-
Update fastapi requirement from ^0.61.1 to >=0.61.1,<0.63.0 (#59 by @dependabot[bot])
0.3.1 - 2020-11-16¶
Added¶
Fixed¶
0.3.0 - 2020-11-09¶
Deprecated¶
- Deprecate usage of
__collection__
to customize the collection name. Prefer thecollection
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)
- It's now possible to define custom
0.2.1 - 2020-10-25¶
Fixed¶
0.2.0 - 2020-10-25¶
Deprecated¶
- Deprecate
AIOEngineDependency
to prefer a global engine object, more details (#21 by @art049)
Added¶
- Add sorting support (#17 by @adriencaccia)
- Support motor 2.3.0 (#20 by @art049)
Fixed¶
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)