httptools icon indicating copy to clipboard operation
httptools copied to clipboard

Fix all typing issues

Open Kludex opened this issue 3 months ago • 6 comments

@fantix can you please check this?

Kludex avatar Oct 19 '25 16:10 Kludex

I've dropped the Unions since they are not needed in pyi files.

Kludex avatar Oct 19 '25 16:10 Kludex

I've tested this on uvicorn, it works like a charm. It would be nice to add a type checker in this repository.

EDIT: I meant the typing... 😅

Kludex avatar Oct 19 '25 16:10 Kludex

Thank you! Looks there's an error: ImportError: cannot import name 'HttpParser' from 'httptools.parser.parser'

Let me add a CI workflow to check typing.

fantix avatar Oct 19 '25 18:10 fantix

Thank you! Looks there's an error: ImportError: cannot import name 'HttpParser' from 'httptools.parser.parser'

Let me add a CI workflow to check typing.

Then it seems the issue is that the parser.pyi exists? Should be __init__.pyi? 🤔

I'm on a plane. I'll fix this tomorrow.

Kludex avatar Oct 19 '25 18:10 Kludex

Thank you! Looks there's an error: ImportError: cannot import name 'HttpParser' from 'httptools.parser.parser'

Let me add a CI workflow to check typing.

It seems HttpParser is marked as internal. I've fixed it.

I've added the type checker to the pipeline, but feel free to tweak whatever you want.

Kludex avatar Oct 20 '25 08:10 Kludex

Btw, this gives less frustration to people when contributing to other projects:

Screenshot 2025-10-20 at 10 27 44

You can find it on:

Screenshot 2025-10-20 at 10 28 20

Kludex avatar Oct 20 '25 08:10 Kludex