News for hackers. Stuff that matters.
Re:Astral – "We're building a new static type checker for Py... by westurner on Wednesday January 29, 2025 @02:34PM (#42869995)
Could it please also do runtime type checking?

(PyContracts and iContract do runtime type checking, but it's not very performant.)

That MyPy isn't usable at runtime causes lots of re-work.

Re:Astral – "We're building a new static type checker for Py... by StackTopherFlow on Wednesday January 29, 2025 @03:15PM (#42870555)
Have you tried beartype? It's worked well for me and has the least overhead of any other runtime type checker.

https://github.com/beartype/beartype

Re:Astral – "We're building a new static type checker for Py... by N1H1L on Wednesday January 29, 2025 @04:52PM (#42871694)
I think TypeGuard (https://github.com/agronholm/typeguard) also does runtime type checking. I use beartype BTW.
Re:Astral – "We're building a new static type checker for Py... by westurner on Wednesday January 29, 2025 @11:34PM (#42874894)
pycontracts: https://github.com/AlexandruBurlacu/pycontracts

icontract: https://github.com/Parquery/icontract

The DbC Design-by-Contract patterns supported by icontract probably have code quality returns beyond saving work.

Safety critical coding guidelines specify that there must be runtime type and value checks at the top of every function.

Re:Astral – "We're building a new static type checker for Py... by drcongo on Thursday January 30, 2025 @09:31AM (#42878023)
I use TypeGuard too, but only in local dev and pytest runs. I find it really useful so I'm now intrigued to try Beartype too. I found the readme on GitHub confusing at a glance though, I need decorators to type check something?