Skip to content

chore: warn on deprecated parameter usage #689

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

Merged
merged 3 commits into from
Apr 18, 2025
Merged

Conversation

adhtruong
Copy link
Collaborator

@adhtruong adhtruong commented Apr 13, 2025

@adhtruong adhtruong requested a review from guacs as a code owner April 13, 2025 13:54
@adhtruong adhtruong force-pushed the deprecate-settings branch from eb46288 to 01dc421 Compare April 18, 2025 13:04
Copy link

Documentation preview will be available shortly at https://litestar-org.github.io/polyfactory-docs-preview/689

@adhtruong adhtruong merged commit 5d97be2 into main Apr 18, 2025
24 checks passed
@adhtruong adhtruong deleted the deprecate-settings branch April 18, 2025 13:29
@@ -114,6 +114,9 @@ Any other field definition will not be checked.
:caption: Enable Check Factory Fields
:language: python

.. note::
The default for `__check_model__` is changed to `True` in v3. Set explicitly to disable this check.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean set __check_model__ explicitly? I tried both __check_model__ = False and True and still getting the warning.

Copy link
Collaborator Author

@adhtruong adhtruong Jul 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for flagging. This logic is wrong. I'll raise a PR for this shortly

@@ -28,6 +28,9 @@ By default, ``__set_relationships__`` is set to ``False``. If it is ``True``, al
.. note::
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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @arjentraas , this is a bug found and should be silenced in this case. It will be fixed in next release. See #723

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate __check_model__ and other constants
4 participants