Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type hints #373

Open
aucampia opened this issue Jul 12, 2024 · 2 comments
Open

Type hints #373

aucampia opened this issue Jul 12, 2024 · 2 comments

Comments

@aucampia
Copy link

aucampia commented Jul 12, 2024

boltons have some nice functionality but it would be very handy if it also had type hints. From #318 it seems you are open to type hints, but I just want to confirm this, and check if you have any specific preferences for how they should be added.

From what I gather from the linked issue:

  • You prefer type hints in .py files (i.e. embedded) as opposed to having them in separate .pyi files
  • You want validation in CI

Is there any thing more I should consider before working on it?

@mahmoud
Copy link
Owner

mahmoud commented Jul 12, 2024

Hey Iwan! Thanks for your interest and I'm glad you asked. Actually since going 3.7+, yes, I think the answer here has gotten a lot simpler: Type hints welcome, annotations preferred, no comments / .pyi necessary.

Other than that, I'd request smaller PRs preferred, starting with the functions/types that are least ambiguous to type or that you feel most comfortable typing. :) Also on the docket, if you're typing a signature that involves a **kwargs, feel free to convert it to * kw-only args. :)

Looking forward to seeing what you come up with!

@Avasam
Copy link
Contributor

Avasam commented Feb 20, 2025

I feel like a first good step is getting on-par with typeshed. I did so in #382 (may have to split up per-module if you want small PRs).

Just that would be enough to declare yourself typed (whilst not fully, so aren't the stubs) and for contributors to come here instead of https://github.com/python/typeshed/tree/main/stubs/boltons

Then enabling type-checking tests (mypy, pyright) and best-practices (a few Ruff lint groups [F404, FA, PYI, UP] or pyupgrade + flake8-future-annotations)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants