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

Add basic typing support #1059

Merged
merged 1 commit into from
Jan 18, 2024
Merged

Add basic typing support #1059

merged 1 commit into from
Jan 18, 2024

Conversation

rbarrois
Copy link
Member

Only Factory.build() and Factory.create() are properly typed, provided the class is declared as class UserFactory(Factory[User]):.

Relies on mypy for tests.

Reviewed-By: Raphaël Barrois [email protected]

@rbarrois rbarrois force-pushed the improved-basic-typing branch 2 times, most recently from 250e538 to ac7fa0e Compare January 18, 2024 14:19
Only `Factory.build()` and `Factory.create()` are properly typed,
provided the class is declared as `class UserFactory(Factory[User]):`.

Relies on mypy for tests.

Reviewed-By: Raphaël Barrois <[email protected]>
@rbarrois rbarrois merged commit 68de8e7 into master Jan 18, 2024
34 checks passed
@rbarrois rbarrois deleted the improved-basic-typing branch January 18, 2024 14:33
goodspark added a commit to goodspark/factory_boy that referenced this pull request Aug 20, 2024
browniebroke added a commit to browniebroke/cookiecutter-django that referenced this pull request Aug 21, 2024
Since factory-boy 3.3.1, we can type annotate factories:

FactoryBoy/factory_boy#1059

Setting that up for the only factory of the project
browniebroke added a commit to cookiecutter/cookiecutter-django that referenced this pull request Aug 21, 2024
Since factory-boy 3.3.1, we can type annotate factories:

FactoryBoy/factory_boy#1059

Setting that up for the only factory of the project
DavidCain added a commit to DavidCain/factory_boy that referenced this pull request Nov 7, 2024
Basic typing support was added recently, exposing return types for
`create()` and `build()`:
FactoryBoy#1059

However, because this package does not expose these types, consumers of
`factory-boy` cannot leverage the annotations!

Let's ensure that the package exports its types. It's okay for only a
subset of methods to be typed! (In other words, it's still compliant
with PEP 561 to have partial coverage).
DavidCain added a commit to DavidCain/factory_boy that referenced this pull request Nov 7, 2024
Basic typing support was added recently, exposing return types for
`create()` and `build()`:
FactoryBoy#1059

However, because this package does not expose these types, consumers of
`factory-boy` cannot leverage the annotations!

Let's ensure that the package exports its types. It's okay for only a
subset of methods to be typed! (In other words, it's still compliant
with PEP 561 to have partial coverage).
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.

3 participants