pytest-xdist icon indicating copy to clipboard operation
pytest-xdist copied to clipboard

Add a py.typed file

Open dmtucker opened this issue 1 year ago • 3 comments

Hey there :wave: I'm in the process of adding types to pytest-mypy, which integrates with xdist in part via the pytest_configure_node hook. The type for the node parameter is available from xdist.workermanage, but mypy still emits the following error:

error: Skipping analyzing "xdist.workermanage": module is installed, but missing library stubs or py.typed marker  [import-untyped]
note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports

I see lots of typing work was done to xdist in 3.6.0 (https://github.com/pytest-dev/pytest-xdist/pull/1065). Could we add a py.typed file to allow downstreams to take advantage of it too?

dmtucker avatar Aug 27 '24 04:08 dmtucker

I already managed to forget the details, but at the time I wrote "The typings are not exposed as that would need some work on the public API". I think what I meant is that we should clearly delineate what is considered public/stable API (that should be properly typed and audited, and the typing should not break), and what is considered private.

bluetech avatar Aug 27 '24 12:08 bluetech

Yeah, e.g. I just came up with a way to run code in the controller and pass information to the workers, but it relies on that hook: https://github.com/pytest-dev/pytest-xdist/issues/783#issuecomment-2743297537

flying-sheep avatar Mar 21 '25 13:03 flying-sheep