Live data from Hacker News

Typeguard

typeguard.readthedocs.io

1–10 of 20 posts

Re: Typeguard

#2
Not the poster, but this library is completely undervalued. I am a big fan of it.

Using standard type annotations in python and adding some @typechecked annotations can be much easier than adopting mypy in an organisation. It helps adopting typechecking incrementally for people who would never decide to adopt it otherwise, and it brings benefits immediately.

Re: Typeguard

#3
post #2

Not the poster, but this library is completely undervalued. I am a big fan of it. Using standard type annotations in python and adding some @typechecked annotations can be much easier than adopting mypy in an organisation. It helps adopting typechecking incrementally for people who would never decide to adopt it otherwise, and it brings benefits immediately.

When would you do the switch to mypy and why?

Re: Typeguard

#4
post #3
post #2

Not the poster, but this library is completely undervalued. I am a big fan of it. Using standard type annotations in python and adding some @typechecked annotations can be much easier than adopting mypy in an organisation. It helps adopting typechecking incrementally for people who would never decide to adopt it otherwise, and it brings benefits immediately.

When would you do the switch to mypy and why?

Typeguard has a performance hit as it runs at runtime, on the other hand it provides better type safety than mypy.

Re: Typeguard

#5
post #2

Not the poster, but this library is completely undervalued. I am a big fan of it. Using standard type annotations in python and adding some @typechecked annotations can be much easier than adopting mypy in an organisation. It helps adopting typechecking incrementally for people who would never decide to adopt it otherwise, and it brings benefits immediately.

In my opinion the best way to get started with typing annotations in Python is just having an editor that understands type hints.

Re: Typeguard

#6
post #3
post #2

Not the poster, but this library is completely undervalued. I am a big fan of it. Using standard type annotations in python and adding some @typechecked annotations can be much easier than adopting mypy in an organisation. It helps adopting typechecking incrementally for people who would never decide to adopt it otherwise, and it brings benefits immediately.

When would you do the switch to mypy and why?

In addition to performance, I would switch when the idea is to have the whole codebase, or a specific part of it, typechecked at "compile time". This way it can be part of a ci pipeline or a precommit hook, instead of blowing up with a good descriptive error (typeguard) but at runtime.

Re: Typeguard

#7
post #2

Not the poster, but this library is completely undervalued. I am a big fan of it. Using standard type annotations in python and adding some @typechecked annotations can be much easier than adopting mypy in an organisation. It helps adopting typechecking incrementally for people who would never decide to adopt it otherwise, and it brings benefits immediately.

In my opinion the best way to get started with typing annotations in Python is just having an editor that understands type hints.

I agree, but it is not enforced. When I see a @typechecked annotation I know that the tests touching that path will blow up if the type is not correct. With intellij or Visual Studio code it is more of an hint (pun intended) one cannot rely on.

Re: Typeguard

#8
post #2

Not the poster, but this library is completely undervalued. I am a big fan of it. Using standard type annotations in python and adding some @typechecked annotations can be much easier than adopting mypy in an organisation. It helps adopting typechecking incrementally for people who would never decide to adopt it otherwise, and it brings benefits immediately.

In my opinion the best way to get started with typing annotations in Python is just having an editor that understands type hints.

Unless your environment requires you to use Python e.g. data science I just wonder why not use something with types to begin with.

Re: Typeguard

#10
post #2

Not the poster, but this library is completely undervalued. I am a big fan of it. Using standard type annotations in python and adding some @typechecked annotations can be much easier than adopting mypy in an organisation. It helps adopting typechecking incrementally for people who would never decide to adopt it otherwise, and it brings benefits immediately.

I think having a strictly-typed language is completely undervalued, especially when ones solution is to use a library that only attempts to enforce types at the runtime level (as I understand).

Why not trying to catch type issues earlier than in Prod?

Post reply on HN