Increase IDE typing support #218
Labels
enhancement
New feature or request
not qualified
The issue is not checked yet by the owners
question
Further information is requested
Is your feature request related to a problem? Please describe.
In pycharm, as of this moment, rethinkdb query methods and others are not recognized properly in static analysis, and I think static typing analysis libraries such as mypy will not be able to validate code this way.
Describe the solution you'd like
Superclass
RethinkDB
with classes encapsulatingast
,net
,query
, anderrors
submodules' functions and constants, erase this monkeypatching block of code:Add (generic/union) type annotations to chaining functions so that (for example;
get_all
cannot be chained withget_all
, or with another function) IDE and static analysis can pick up on incorrect combinations before they happen.Maybe possibly split
RethinkDB
into subclassesSyncRethinkDB
,AsyncioRethinkDB
,TwistedRethinkDB
,TornadoRethinkDB
andGeventRethinkDB
that all annotate the return values of their ast functions with the correct types (Future
, etc.) so that IDE compatibility and analysis can pick up on a possibly incorrect/incompatible versions.Or simply have the connection type at
run()
influence the wrapping type around the return value.Additional context
Zen of Python, line 2:
A lot of methods in the python driver puzzle me as a python developer, simplifying them to a set of
ast
frontend functions directly denoted in theRethinkDB
class, and have theConnection
type influence typing generics' outcome (run(Connection[RetT]) -> RetT[T]
) could increase IDE typing analysis while staying flexible and open to new runtime types.The text was updated successfully, but these errors were encountered: