Skip to content

Type Checking #167

Description

@supersimple33

Hello, I wanted to make a feature request I have recently migrated from concurrent futures to pebble since pebble is better. However, I have lost the ability to type check as the types are passed through in pebble. If you are open to it I would like to override the way that submit works so it has the same typing properties as concurrent futures. I have integrated an example of what I mean below.

from concurrent.futures import ProcessPoolExecutor
from pebble import ProcessPool
def cool(x: int):
    return x

if __name__ == "__main__":
    with ProcessPoolExecutor() as pool:
        pool.submit(cool, 1).result() # ok
        pool.submit(cool, "a").result() # mypy flags this
    with ProcessPool() as pool:
        pool.submit(cool, None, 1).result() # ok
        pool.submit(cool, None, "a").result() # should fail but doesn't

Also the type after calling result() is Any in pebble whereas it is the return type of the function in concurrent futures.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions