adafruit / Adafruit_CircuitPython_PyPortal

CircuitPython driver for Adafruit PyPortal.
MIT License
46 stars 57 forks source link

Remove backward-compatible imports when 4.0.0 released #17

Closed dhalbert closed 4 years ago

dhalbert commented 5 years ago

Remove the try-import code that supports older versions of displayio et al when 4.0.0 is released as stable.

kevinjwalters commented 5 years ago

On a related note, we have been discussing in discord the usefulness of this in https://github.com/adafruit/Adafruit_CircuitPython_PyPortal/blob/master/adafruit_pyportal.py#L58

try:
    from adafruit_display_text.text_area import TextArea  # pylint: disable=unused-import
    print("*** WARNING ***\nPlease update your library bundle to the latest 'adafruit_display_text' version as we've deprecated 'text_area' in favor of 'label'")  # pylint: disable=line-too-long
except ImportError:
    from adafruit_display_text.Label import Label

The current behaviour for that is to print the warning which cannot be seen as it's only on screen for about 1/4 of a second before the raster display blanks it. The import then has polluted the the code in some way where it blows up later on with a NameError: name 'Label' is not defined. I'd say that should either be a "file exists" type test to avoid polluting import xor it should be a fatal error to a) make it visible and b) force user to address it.

(I had missed the step in instructions to delete the old files on CIRCUITPY in https://learn.adafruit.com/adabox011/updating-your-pyportal and based on forum discussion a small number of other users must have done the same: https://forums.adafruit.com/viewtopic.php?f=59&t=149573)

ladyada commented 5 years ago

we're going to remove it soon when 4 is released which solves it, right?

kevinjwalters commented 5 years ago

Yes, if you are referring to removing the import from adafruit_display_text.text_area.