hhursev / recipe-scrapers

Python package for scraping recipes data
MIT License
1.61k stars 505 forks source link

v15: bug: WebsiteNotImplemented exception cannot be imported from main module #1023

Closed jayaddison closed 3 months ago

jayaddison commented 3 months ago

After updating to 15.0.0-rc1 and attempting to run a local test suite:

ImportError while loading conftest '.../reciperadar/crawler/tests/conftest.py'.
tests/conftest.py:3: in <module>
    from web.app import app
web/app.py:15: in <module>
    from recipe_scrapers import (
E   ImportError: cannot import name 'WebsiteNotImplementedError' from 'recipe_scrapers' (.../reciperadar/crawler/venv/lib/python3.11/site-packages/recipe_scrapers/__init__.py)
make: *** [Makefile:54: tests] Error 4

That's an unexpected breaking change; we should either allow importing the exception from the main module, or otherwise include it in the public API somehow for clients to use. Module names that begin with _ (underscore) shouldn't be considered public.

jayaddison commented 3 months ago

Mmm, not so fast. It seems that WebsiteNotImplementedError isn't raised anywhere by the v15 code currently. That may explain why it was removed from the main module scope, since it would cause linting failures due to unused imports otherwise.

jayaddison commented 3 months ago

Resolved by #1021.