Support type hinting?
See original GitHub issueI can’t seem to have PyCharm play nice with the objects generated by Factory Boy; it would be nice to either automatically support type hinting somehow (ideally, it would simply be the model defined as a base for the factory) or at least add some documentation to explain how to have type checkers understand that,
after p = PersonFactory()
, variuable p
is actually an instance of Person
rather than of PersonFactory
.
(Note: I’m not submitting a PR because I haven’t figured out a solution)
Issue Analytics
- State:
- Created 5 years ago
- Reactions:57
- Comments:12 (1 by maintainers)
Top Results From Across the Web
typing — Support for type hints — Python 3.11.1 documentation
This module provides runtime support for type hints. The most fundamental support consists of the types Any , Union , Callable , TypeVar...
Read more >Type hinting in PyCharm - JetBrains
PyCharm supports type hinting in function annotations and type comments using the typing module and the format defined by PEP 484. Adding type ......
Read more >Type hints cheat sheet - mypy 0.991 documentation
Type hints cheat sheet#. This document is a quick cheat sheet showing how to use type annotations for various common types in Python....
Read more >Type Hinting - Real Python
So, what is type hinting? It's a formal solution to statically indicate the type of a value. Type hints will help document your...
Read more >12 Beginner Concepts About Type Hints To Improve Your ...
1— Type annotations: a new syntax to support adding types. Type hints are performed using Python annotations (introduced since PEP 3107).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
my workaround for missing General protocol is as follow:
one drawback of this solution is that you always need to use
Factory.create()
instead ofFactory()
as it’s not possible (at least I didn’t find a proper solution) to override__new__()
method withTypeVar
.Typing support would be really nice!