Hacker News
Ty 1.0: an extremely fast Python type checker and language server
natsu529
|next
[-]
alexwaygood
|root
|parent
[-]
natsu529
|root
|parent
|next
[-]
quotemstr
|root
|parent
|previous
[-]
This style of development is unfair to innovators and ossifies the ecosystem.
_carljm
|root
|parent
|next
[-]
fishgoesblub
|next
|previous
[-]
ibejoeb
|root
|parent
|next
[-]
wilkystyle
|next
|previous
[-]
BoumTAC
|next
|previous
[-]
The real issue is that ty's Django support is still early: reverse relations and django-stubs aren't supported yet, and django-types is already lagging behind Django 6.
WD-42
|next
|previous
[-]
Funnily though I’ve started to care less about typing in Python. Since Rust got good most projects where I’d want strong types I’m not using Python anymore. Python is still great for glue code, as it was intended. Typing helps there if libraries have good support but I find myself writing Python type annotations less now. It’s always been a bit awkward and ugly in Python anyway.
BewareTheYiga
|next
|previous
[-]
ethnrob
|next
|previous
[-]
I have nothing against Ty, it is quite powerful, and released under MIT.
This blog post also tells us that Ty is used extensively at OpenAI, like we're meant to be impressed.
arthur-st
|root
|parent
|next
[-]
LtWorf
|root
|parent
|next
|previous
[-]
I got a 2 weeks ban on the python discuss instance for suggesting that core contributors who contribute as their job should disclose who their employer is.
pronik
|root
|parent
|previous
[-]
globular-toast
|next
|previous
[-]
122339817
|next
|previous
[-]
Remember when Astral told us in 2024 they would not sell out?
analog_daddy
|root
|parent
|next
[-]
chrikrah
|previous
[-]
ibraheemdev
|root
|parent
|next
[-]
arthur-st
|root
|parent
|previous
[-]
Summarizing, for something that is an argument with specific fields you'd use a Mapping or a MutableMapping as the annotation, and if that's a return value, then it should be a TypedDict. Sometimes TypedDict also makes sense as an argument annotation, e.g., if it has to be a dict strictly.
For a generic dictionary, like you know that you're drawing from a set of possible kwargs that are all string values, you can also just annotate them with an "anonymous" dict like what Ty is inferring on your codebase.