Adding type hints
Author: wcooleyCreated Nov 28, 2018Updated Feb 17, 2025
I have started generating/creating typing hints for boltons and would like to make them available for others to use. There are basically 3 ways that I can do that:
- Add to the actual code (using Python legacy-compatible comments).
- Add type stubs alongside the actual code.
- Create a separate stub-only package (& repo).
Option 1 is the most invasive but also ensures greater consistency between the production code and hints and makes it more immediately available to someone reading the code.
Option 2 is less invasive but makes the hints less convenient for human consumption and adds a new part of the package to be maintained.
Option 3 is least invasive and requires no support from anyone other than myself but is quite likely to be neglected and poorly-maintained.
Any preference/comments?
Source: mahmoud/boltons