-
Notifications
You must be signed in to change notification settings - Fork 19
Description
It looks like adafruit_bitmap_font (repo) is used as a convenience function to _load_font
:
Adafruit_CircuitPython_PortalBase/adafruit_portalbase/__init__.py
Lines 112 to 113 in 64ea98d
if font not in self._fonts: | |
self._fonts[font] = bitmap_font.load_font(font) |
This could be turned into an inline import. For example:
if font not in self._fonts:
from adafruit_bitmap_font import bitmap_font # <-- Inline import
self._fonts[font] = bitmap_font.load_font(font)
Turning this into an inline import would make this a soft dependency. If it's not used it's not required. I was working up a small demo on the MagTag but not using anything about the display or Wi-Fi. I noticed that I still needed quite a few libraries. Some of these, like adafruit_fakerequests, aren't used even if I was using the full capabilities on the device. For example, this line could also use an inline import:
response = Fake_Requests(LOCALFILE) |
Making these inline imports would reduce the number of hard dependencies here. This would also provide some space savings and improve the speed at which the code starts up. This also shouldn't functionally impact any existing example code which makes use of functions requiring these libraries. They would still require the library to be installed.
Is this worth submitting a PR for?