chore: warn on deprecated parameter usage#689
Conversation
eb46288 to
01dc421
Compare
|
Documentation preview will be available shortly at https://litestar-org.github.io/polyfactory-docs-preview/689 |
| :language: python | ||
|
|
||
| .. note:: | ||
| The default for `__check_model__` is changed to `True` in v3. Set explicitly to disable this check. |
There was a problem hiding this comment.
Do you mean set __check_model__ explicitly? I tried both __check_model__ = False and True and still getting the warning.
There was a problem hiding this comment.
Thanks for flagging. This logic is wrong. I'll raise a PR for this shortly
| If ``__set_relationships__ = True``, ForeignKey fields associated with relationship() will be automatically generated by ``build`` method because :class:`__set_foreign_keys__ <polyfactory.factories.sqlalchemy_factory.SQLAlchemyFactory.__set_foreign_keys__>` is set to ``True`` by default. But their values will be overwritten by using ``create_sync``/ ``create_async`` methods, so SQLAlchemy ORM creates them. | ||
|
|
||
| .. note:: | ||
| The default for `__set_relationships__` is changed to `True` in v3. Set explicitly to retain existing behaviour. |
There was a problem hiding this comment.
What's the best approach here? I have removed the __set_relationships__ = True flag, but the warning still occurs. Additionally, we get a similar warning for __set_association_proxy__, even though it is not set.
There was a problem hiding this comment.
Hi @arjentraas , this is a bug found and should be silenced in this case. It will be fixed in next release. See #723
Bumps [polyfactory](https://github.com/litestar-org/polyfactory) from 2.21.0 to 2.22.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/litestar-org/polyfactory/releases">polyfactory's releases</a>.</em></p> <blockquote> <h2>v2.22.0</h2> <h2>What's Changed</h2> <ul> <li>chore: remove usage of _AnnotatedAlias by <a href="https://github.com/adhtruong"><code>@adhtruong</code></a> in <a href="https://redirect.github.com/litestar-org/polyfactory/pull/693">litestar-org/polyfactory#693</a></li> <li>chore: warn on deprecated parameter usage by <a href="https://github.com/adhtruong"><code>@adhtruong</code></a> in <a href="https://redirect.github.com/litestar-org/polyfactory/pull/689">litestar-org/polyfactory#689</a></li> <li>feat: Allow usage of Pydantic models containing forward references by <a href="https://github.com/marcuslimdw"><code>@marcuslimdw</code></a> in <a href="https://redirect.github.com/litestar-org/polyfactory/pull/698">litestar-org/polyfactory#698</a></li> <li>chore(deps): bump astral-sh/setup-uv from 5 to 6 by <a href="https://github.com/dependabot"><code>@dependabot</code></a> in <a href="https://redirect.github.com/litestar-org/polyfactory/pull/696">litestar-org/polyfactory#696</a></li> <li>docs: add marcuslimdw as a contributor for code by <a href="https://github.com/allcontributors"><code>@allcontributors</code></a> in <a href="https://redirect.github.com/litestar-org/polyfactory/pull/699">litestar-org/polyfactory#699</a></li> <li>refactor: make type utils deterministic by <a href="https://github.com/adhtruong"><code>@adhtruong</code></a> in <a href="https://redirect.github.com/litestar-org/polyfactory/pull/688">litestar-org/polyfactory#688</a></li> <li>perf: avoid deep copy by <a href="https://github.com/adhtruong"><code>@adhtruong</code></a> in <a href="https://redirect.github.com/litestar-org/polyfactory/pull/702">litestar-org/polyfactory#702</a></li> <li>fix: test by adding inheritance in Child class from Parent by <a href="https://github.com/Rub1kCube"><code>@Rub1kCube</code></a> in <a href="https://redirect.github.com/litestar-org/polyfactory/pull/706">litestar-org/polyfactory#706</a></li> <li>docs: add Rub1kCube as a contributor for test by <a href="https://github.com/allcontributors"><code>@allcontributors</code></a> in <a href="https://redirect.github.com/litestar-org/polyfactory/pull/708">litestar-org/polyfactory#708</a></li> <li>chore(deps): bump dawidd6/action-download-artifact from 9 to 10 by <a href="https://github.com/dependabot"><code>@dependabot</code></a> in <a href="https://redirect.github.com/litestar-org/polyfactory/pull/709">litestar-org/polyfactory#709</a></li> <li>fix: Generate correct collection size when annotation_types.Len is used by <a href="https://github.com/priyankc"><code>@priyankc</code></a> in <a href="https://redirect.github.com/litestar-org/polyfactory/pull/712">litestar-org/polyfactory#712</a></li> <li>chore(deps): bump dawidd6/action-download-artifact from 10 to 11 by <a href="https://github.com/dependabot"><code>@dependabot</code></a> in <a href="https://redirect.github.com/litestar-org/polyfactory/pull/714">litestar-org/polyfactory#714</a></li> <li>fix: no blank children names by <a href="https://github.com/iloveitaly"><code>@iloveitaly</code></a> in <a href="https://redirect.github.com/litestar-org/polyfactory/pull/666">litestar-org/polyfactory#666</a></li> <li>feat: add PEP 695 type alias support and improve type handling by <a href="https://github.com/Rub1kCube"><code>@Rub1kCube</code></a> in <a href="https://redirect.github.com/litestar-org/polyfactory/pull/711">litestar-org/polyfactory#711</a></li> <li>chore(release): bump to v2.22.0 by <a href="https://github.com/adhtruong"><code>@adhtruong</code></a> in <a href="https://redirect.github.com/litestar-org/polyfactory/pull/722">litestar-org/polyfactory#722</a></li> </ul> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/marcuslimdw"><code>@marcuslimdw</code></a> made their first contribution in <a href="https://redirect.github.com/litestar-org/polyfactory/pull/698">litestar-org/polyfactory#698</a></li> <li><a href="https://github.com/Rub1kCube"><code>@Rub1kCube</code></a> made their first contribution in <a href="https://redirect.github.com/litestar-org/polyfactory/pull/706">litestar-org/polyfactory#706</a></li> <li><a href="https://github.com/priyankc"><code>@priyankc</code></a> made their first contribution in <a href="https://redirect.github.com/litestar-org/polyfactory/pull/712">litestar-org/polyfactory#712</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/litestar-org/polyfactory/compare/v2.21.0...v2.22.0">https://github.com/litestar-org/polyfactory/compare/v2.21.0...v2.22.0</a></p> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/litestar-org/polyfactory/blob/main/docs/changelog.rst">polyfactory's changelog</a>.</em></p> <blockquote> <h2><code>Release [v2.22.0] - 2025-07-01 <https://github.com/litestar-org/polyfactory/releases/tag/v2.22.0></code>_</h2> <ul> <li><code>See All commits in v2.22.0 <https://github.com/litestar-org/polyfactory/commits/v2.22.0></code>_</li> </ul> <p><code>203310b <https://github.com/litestar-org/polyfactory/commit/203310bfa4a8054efb59c1bda34715d4196a7954></code>_ ... <code>c7a7b44 <https://github.com/litestar-org/polyfactory/commit/c7a7b4426126d0134d531fc4db34199d39c46298></code>_ | <code>See diff for 2.22.0 <https://github.com/litestar-org/polyfactory/compare/203310bfa4a8054efb59c1bda34715d4196a7954...c7a7b4426126d0134d531fc4db34199d39c46298></code>_</p> <p>Bug Fixes ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</p> <ul> <li>(<code>94eb1bf <https://github.com/litestar-org/polyfactory/commit/94eb1bfc3f947a4090157bc7bdcec19e8c530dd8></code><em>) - Test by adding inheritance in Child class from Parent (<a href="https://redirect.github.com/litestar-org/polyfactory/issues/706">#706</a>) by <code>@Rub1kCube <https://github.com/Rub1kCube></code></em> in <code>[#706](litestar-org/polyfactory#706) <https://github.com/litestar-org/polyfactory/pull/706></code>_</li> <li>(<code>dbcf79d <https://github.com/litestar-org/polyfactory/commit/dbcf79db38fffdcae7599b5cd2806261ab58fd79></code><em>) - Generate correct collection size when annotation_types.Len is used (<a href="https://redirect.github.com/litestar-org/polyfactory/issues/712">#712</a>) by <code>@priyankc <https://github.com/priyankc></code></em> in <code>[#712](litestar-org/polyfactory#712) <https://github.com/litestar-org/polyfactory/pull/712></code>_</li> <li>(<code>216b8a5 <https://github.com/litestar-org/polyfactory/commit/216b8a50451f01a49967bcc7e028a5e0803a108c></code><em>) - No blank children names (<a href="https://redirect.github.com/litestar-org/polyfactory/issues/666">#666</a>) by <code>@iloveitaly <https://github.com/iloveitaly></code></em> in <code>[#666](litestar-org/polyfactory#666) <https://github.com/litestar-org/polyfactory/pull/666></code>_</li> </ul> <p>Documentation ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</p> <ul> <li>(<code>3b541b6 <https://github.com/litestar-org/polyfactory/commit/3b541b66c1ef4d5cb3ecc3071ee3d1921257c99e></code><em>) - Add marcuslimdw as a contributor for code (<a href="https://redirect.github.com/litestar-org/polyfactory/issues/699">#699</a>) by <code>@allcontributors[bot] <https://github.com/allcontributors[bot]></code></em> in <code>[#699](litestar-org/polyfactory#699) <https://github.com/litestar-org/polyfactory/pull/699></code>_</li> <li>(<code>a34e7d3 <https://github.com/litestar-org/polyfactory/commit/a34e7d37b727835f4f4aad19dc42c9f5009c366d></code><em>) - Add Rub1kCube as a contributor for test (<a href="https://redirect.github.com/litestar-org/polyfactory/issues/708">#708</a>) by <code>@allcontributors[bot] <https://github.com/allcontributors[bot]></code></em> in <code>[#708](litestar-org/polyfactory#708) <https://github.com/litestar-org/polyfactory/pull/708></code>_</li> </ul> <p>Features ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</p> <ul> <li>(<code>5de22fa <https://github.com/litestar-org/polyfactory/commit/5de22fa1331e36fc506088af21430ba58f11fc94></code><em>) - Allow usage of Pydantic models containing forward references (<a href="https://redirect.github.com/litestar-org/polyfactory/issues/698">#698</a>) by <code>@marcuslimdw <https://github.com/marcuslimdw></code></em> in <code>[#698](litestar-org/polyfactory#698) <https://github.com/litestar-org/polyfactory/pull/698></code>_</li> <li>(<code>c7a7b44 <https://github.com/litestar-org/polyfactory/commit/c7a7b4426126d0134d531fc4db34199d39c46298></code><em>) - Add PEP 695 type alias support and improve type handling (<a href="https://redirect.github.com/litestar-org/polyfactory/issues/711">#711</a>) by <code>@Rub1kCube <https://github.com/Rub1kCube></code></em> in <code>[#711](litestar-org/polyfactory#711) <https://github.com/litestar-org/polyfactory/pull/711></code>_</li> </ul> <p>Miscellaneous Tasks ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</p> <ul> <li>(<code>82baed7 <https://github.com/litestar-org/polyfactory/commit/82baed7c2c252964381a751d8639e781662655f3></code><em>) - Remove <em>AnnotatedAlias (<a href="https://redirect.github.com/litestar-org/polyfactory/issues/693">#693</a>) by <code>@adhtruong <https://github.com/adhtruong></code></em> in <code>[#693](litestar-org/polyfactory#693) <https://github.com/litestar-org/polyfactory/pull/693></code></em></li> <li>(<code>5d97be2 <https://github.com/litestar-org/polyfactory/commit/5d97be2424f03fa098741c1f93e2be832dcd3950></code><em>) - Warn on deprecated parameter usage (<a href="https://redirect.github.com/litestar-org/polyfactory/issues/689">#689</a>) by <code>@adhtruong <https://github.com/adhtruong></code></em> in <code>[#689](litestar-org/polyfactory#689) <https://github.com/litestar-org/polyfactory/pull/689></code>_</li> <li>(<code>aff32a0 <https://github.com/litestar-org/polyfactory/commit/aff32a03de6c2b2282b2a28db88d03fb67ffb150></code><em>) - Bump astral-sh/setup-uv from 5 to 6 (<a href="https://redirect.github.com/litestar-org/polyfactory/issues/696">#696</a>) by <code>@dependabot[bot] <https://github.com/dependabot[bot]></code></em> in <code>[#696](litestar-org/polyfactory#696) <https://github.com/litestar-org/polyfactory/pull/696></code>_</li> <li>(<code>d03aa1b <https://github.com/litestar-org/polyfactory/commit/d03aa1bfb6221d87cf5d83ad184beaf2d4d77178></code><em>) - Bump dawidd6/action-download-artifact from 9 to 10 (<a href="https://redirect.github.com/litestar-org/polyfactory/issues/709">#709</a>) by <code>@dependabot[bot] <https://github.com/dependabot[bot]></code></em> in <code>[#709](litestar-org/polyfactory#709) <https://github.com/litestar-org/polyfactory/pull/709></code>_</li> <li>(<code>0cd86d2 <https://github.com/litestar-org/polyfactory/commit/0cd86d2bf93efaddc1c994e21ead4714273182ec></code><em>) - Bump dawidd6/action-download-artifact from 10 to 11 (<a href="https://redirect.github.com/litestar-org/polyfactory/issues/714">#714</a>) by <code>@dependabot[bot] <https://github.com/dependabot[bot]></code></em> in <code>[#714](litestar-org/polyfactory#714) <https://github.com/litestar-org/polyfactory/pull/714></code>_</li> </ul> <p>Performance ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</p> <ul> <li>(<code>0d55db8 <https://github.com/litestar-org/polyfactory/commit/0d55db8a6ac21e559f6524148de8e50323714994></code><em>) - Avoid deep copy (<a href="https://redirect.github.com/litestar-org/polyfactory/issues/702">#702</a>) by <code>@adhtruong <https://github.com/adhtruong></code></em> in <code>[#702](litestar-org/polyfactory#702) <https://github.com/litestar-org/polyfactory/pull/702></code>_</li> </ul> <p>Refactor ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</p> <ul> <li>(<code>6281fb2 <https://github.com/litestar-org/polyfactory/commit/6281fb223b893c2a808bcc9920856ed2c948d740></code><em>) - Make type utils deterministic (<a href="https://redirect.github.com/litestar-org/polyfactory/issues/688">#688</a>) by <code>@adhtruong <https://github.com/adhtruong></code></em> in <code>[#688](litestar-org/polyfactory#688) <https://github.com/litestar-org/polyfactory/pull/688></code>_</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/litestar-org/polyfactory/commit/f270b0fb46f36b32db0a1c9f9d2cea25c59b8f22"><code>f270b0f</code></a> chore(release): bump to v2.22.0 (<a href="https://redirect.github.com/litestar-org/polyfactory/issues/722">#722</a>)</li> <li><a href="https://github.com/litestar-org/polyfactory/commit/c7a7b4426126d0134d531fc4db34199d39c46298"><code>c7a7b44</code></a> feat: add PEP 695 type alias support and improve type handling (<a href="https://redirect.github.com/litestar-org/polyfactory/issues/711">#711</a>)</li> <li><a href="https://github.com/litestar-org/polyfactory/commit/216b8a50451f01a49967bcc7e028a5e0803a108c"><code>216b8a5</code></a> fix: no blank children names (<a href="https://redirect.github.com/litestar-org/polyfactory/issues/666">#666</a>)</li> <li><a href="https://github.com/litestar-org/polyfactory/commit/0cd86d2bf93efaddc1c994e21ead4714273182ec"><code>0cd86d2</code></a> chore(deps): bump dawidd6/action-download-artifact from 10 to 11 (<a href="https://redirect.github.com/litestar-org/polyfactory/issues/714">#714</a>)</li> <li><a href="https://github.com/litestar-org/polyfactory/commit/dbcf79db38fffdcae7599b5cd2806261ab58fd79"><code>dbcf79d</code></a> fix: Generate correct collection size when annotation_types.Len is used (<a href="https://redirect.github.com/litestar-org/polyfactory/issues/712">#712</a>)</li> <li><a href="https://github.com/litestar-org/polyfactory/commit/d03aa1bfb6221d87cf5d83ad184beaf2d4d77178"><code>d03aa1b</code></a> chore(deps): bump dawidd6/action-download-artifact from 9 to 10 (<a href="https://redirect.github.com/litestar-org/polyfactory/issues/709">#709</a>)</li> <li><a href="https://github.com/litestar-org/polyfactory/commit/a34e7d37b727835f4f4aad19dc42c9f5009c366d"><code>a34e7d3</code></a> docs: add Rub1kCube as a contributor for test (<a href="https://redirect.github.com/litestar-org/polyfactory/issues/708">#708</a>)</li> <li><a href="https://github.com/litestar-org/polyfactory/commit/94eb1bfc3f947a4090157bc7bdcec19e8c530dd8"><code>94eb1bf</code></a> fix: test by adding inheritance in Child class from Parent (<a href="https://redirect.github.com/litestar-org/polyfactory/issues/706">#706</a>)</li> <li><a href="https://github.com/litestar-org/polyfactory/commit/0d55db8a6ac21e559f6524148de8e50323714994"><code>0d55db8</code></a> perf: avoid deep copy (<a href="https://redirect.github.com/litestar-org/polyfactory/issues/702">#702</a>)</li> <li><a href="https://github.com/litestar-org/polyfactory/commit/6281fb223b893c2a808bcc9920856ed2c948d740"><code>6281fb2</code></a> refactor: make type utils deterministic (<a href="https://redirect.github.com/litestar-org/polyfactory/issues/688">#688</a>)</li> <li>Additional commits viewable in <a href="https://github.com/litestar-org/polyfactory/compare/v2.21.0...v2.22.0">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Description
Closes
__check_model__and other constants #681 (comment)