praw-dev / praw

PRAW, an acronym for "Python Reddit API Wrapper", is a python package that allows for simple access to Reddit's API.
http://praw.readthedocs.io/
BSD 2-Clause "Simplified" License
3.47k stars 456 forks source link

Revert "Add py.typed stub" #1944

Closed LilSpazJoekp closed 1 year ago

LilSpazJoekp commented 1 year ago

Reverts praw-dev/praw#1936

Typing improvement are needed to be made to PRAW before this is fully MyPy compatible. Becoming MyPy compatible may also be problematic as PRAW dynamically defines attributes on deserialized objects from Reddit.

The reason for the dynamically defining attributes is because Reddit is known for adding and removing attributes without notice and it removes the burden of maintaining accurate attributes on every type that PRAW deserializes from Reddit from PRAW.

BranislavBajuzik commented 1 year ago

From Mypy docs:

These stub files do not need to be complete! [...] You can then iterate on just the parts of the library you need.

Please consider adding this back and add typing.Any to the untyped parts. Some type-checking is better than None

LilSpazJoekp commented 1 year ago

As far as I know, it not possible to type dynamically defined attributes. Mypy will complain if you access any dynamic attribute on PRAW object.

BranislavBajuzik commented 1 year ago

I didn't think about the dynamic attributes.

Dynamic attributes can be typed using a mypy plugin, just like Django-stubs does.