tarantool / tarantool-python

Python client library for Tarantool
https://www.tarantool.io
BSD 2-Clause "Simplified" License
100 stars 48 forks source link

Type hints and type check #266

Open DifferentialOrange opened 1 year ago

DifferentialOrange commented 1 year ago

Type hints is a modern Python way to provide type information (see typing mypy). PR https://github.com/tarantool/tarantool-python/pull/264 is the first one to potentially use type hints, but it would be nice to have it anywhere.

Type asserts is a more tricky question. For now there are some minor type checks and asserts in connector. Some may also be implemented in PR #264. But it is a big question if they should be use. It seems that there are both adepts of using (since it is a convenient concept) and forbidding to use (since it contradicts Python duck typing principle) it. For example, see this StackOverflow thread. One way or another, it would be good to at least have a consistency on this question.

Since now package is fully documented, it should be easy to implement type hints and asserts after one decide what approach we should stick to. But choosing the approach is the question.

DifferentialOrange commented 1 year ago

We should consider linting with mypy after adding this

olegrok commented 1 year ago

You can consider also https://pyre-check.org/