purarue / google_takeout_parser

A library/CLI tool to parse data out of your Google Takeout (History, Activity, Youtube, Locations, etc...)
https://pypi.org/project/google-takeout-parser/
MIT License
82 stars 14 forks source link

Missing typeshed types for third-party libraries when running mypy #74

Closed mighabana closed 1 month ago

mighabana commented 1 month ago

Expected Behavior

Running mypy ./google_takeout_parser on the master branch should return "Success: no issues found..."

Current Behavior

Running mypy ./google_takeout_parser returns 9 errors related to missing types for "pytz" and "beautifulsoup4"

google_takeout_parser/parse_html/html_time_utils.py:10: error: Library stubs not installed for "pytz"  [import-untyped]
    import pytz
    ^
google_takeout_parser/parse_html/html_time_utils.py:10: note: Hint: "python3 -m pip install types-pytz"
google_takeout_parser/parse_html/html_time_utils.py: note: In function "parse_html_dt":
google_takeout_parser/parse_html/html_time_utils.py:50: error: Returning Any from function declared to return "datetime"  [no-any-return]
            return pytz.utc.localize(datetime.strptime(s, fmt))
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
google_takeout_parser/parse_html/html_time_utils.py:58: error: Returning Any from function declared to return "datetime"  [no-any-return]
            return pytz.utc.localize(dt)
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
google_takeout_parser/parse_html/html_time_utils.py:67: error: Returning Any from function declared to return "datetime"  [no-any-return]
            return tz.localize(dt)
            ^~~~~~~~~~~~~~~~~~~~~~
google_takeout_parser/parse_html/html_time_utils.py:72: error: Returning Any from function declared to return "datetime"  [no-any-return]
        return tz.normalize(dt.replace(tzinfo=export_tzinfo))
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
google_takeout_parser/parse_html/activity.py:10: error: Library stubs not installed for "bs4"  [import-untyped]
    import bs4
    ^
google_takeout_parser/parse_html/activity.py:11: error: Library stubs not installed for "bs4.element"  [import-untyped]
    from bs4.element import Tag, PageElement
    ^
google_takeout_parser/parse_html/activity.py:11: note: Hint: "python3 -m pip install types-beautifulsoup4"
google_takeout_parser/parse_html/activity.py:11: note: (or run "mypy --install-types" to install all missing stub packages)
google_takeout_parser/parse_html/activity.py:11: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
google_takeout_parser/parse_html/comment.py:6: error: Library stubs not installed for "bs4"  [import-untyped]
    import bs4
    ^
google_takeout_parser/parse_html/test_html_parsing.py:1: error: Library stubs not installed for "bs4"  [import-untyped]
    import bs4
    ^
Found 9 errors in 4 files (checked 23 source files)

Possible Solution

Add types-beautifulsoup4 and types-pytz to the testing environment in setup.cfg

purarue commented 1 month ago

solved in #75