Provide type annotations
Bug #1843791 reported by
Daniel Hahler
This bug affects 5 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Beautiful Soup |
In Progress
|
Undecided
|
Unassigned |
Bug Description
It would be useful to have type annotations for bs4, to be used with mypy etc.
I've quickly generated them using "stubgen" [1] provided by mypy, and started adding some manually then - but nothing to publish really yet.
I've wondered if there are plans for this already, and thought it would be good to have an issue to discuss this / have a place for reference.
I've used "2to3" on the source before - not clear how this should be handled then when done in the repo itself.
Changed in beautifulsoup: | |
status: | Triaged → In Progress |
To post a comment you must log in.
This is an interesting idea and I would like to get here eventually.
The sticking point, as you've found out, is that the canonical version of the Beautiful Soup code uses Python 2, and it's automatically converted to Python 3. I don't see a way to add these annotations without permanently switching to Python 3.
Because Beautiful Soup is frequently used in duct-tape environments I'm going to keep Python 2 support past the official end-of-life date, but eventually I will drop it, and we can pick up this issue then.