Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

CircuitPython ABC (AbstractBaseClass) deprecated ?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

CircuitPython ABC (AbstractBaseClass) deprecated ?

by lImbus on Sun Jul 05, 2020 10:24 am

I am new to CircuitPython, wanting to try out this [1] Library (~1 year old) on CircuitPython 5.4.0 Beta 1, and it does not seem to work (in REPL):

Code: Select all | TOGGLE FULL SIZE
>>> from sparkfun_serlcd import Sparkfun_SerLCD_I2C
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/lib/sparkfun_serlcd.py", line 63, in <module>
ImportError: no module named 'abc'

which I am assuming related to the following line of codes in the library:
Code: Select all | TOGGLE FULL SIZE
from abc import ABC, abstractmethod
...
class Sparkfun_SerLCD(ABC):
...
class Sparkfun_SerLCD_I2C(Sparkfun_SerLCD):


also, if I try this manually:
Code: Select all | TOGGLE FULL SIZE
>>> from abc import ABC, abstractmethod
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: no module named 'abc'


If I am assuming that the library has worked at some point, then I have to concur that the abstract base class of python is a concept that is being deprecated in newer versions of CircuitPython or MicroPython?

It's only after having chosen and bought the hardware (Teensy4.1) that I realized that it only very very recently started to be supported, so right now, I do not have the option to go back to 5.3.0 or even older to try out that library on an older CircuitPython where abc is potentially still supported.

[1]:
- https://pypi.org/project/sparkfun-circuitpython-serlcd
- https://github.com/fourstix/Sparkfun_Ci ... hon_SerLCD

lImbus
 
Posts: 3
Joined: Sun Jul 05, 2020 10:00 am

Re: CircuitPython ABC (AbstractBaseClass) deprecated ?

by lImbus on Sun Jul 05, 2020 10:58 am

I manually modified the library to not have an abstract baseclass and specializations for SPI, I2C and UART, but only the one specialization for I2C and it worked.
So it's really only about the ABC.
I'd like to learn how to bring the library up to date. I'd fork and update, then submit a PR.

lImbus
 
Posts: 3
Joined: Sun Jul 05, 2020 10:00 am

Re: CircuitPython ABC (AbstractBaseClass) deprecated ?

by tannewt on Mon Jul 06, 2020 1:15 am

I don't think CircuitPython has ever had `abc`.

I'd suggest posting an issue on the repo. It isn't an Adafruit product or library so there isn't a lot we can do.

tannewt
 
Posts: 1716
Joined: Thu Oct 06, 2016 8:48 pm

Re: CircuitPython ABC (AbstractBaseClass) deprecated ?

by lImbus on Mon Jul 06, 2020 4:56 am

ah, yes, I understand. I thought it was a CircuitPython problem, but obviously it's a "Sparkfun" problem :)
Can you point me to some documentation that would show me how this kind of abstraction/class hierarchy can be solved in (Circuit)Python? I'll fix the library then.
thank you,
lImbus

lImbus
 
Posts: 3
Joined: Sun Jul 05, 2020 10:00 am

Re: CircuitPython ABC (AbstractBaseClass) deprecated ?

by tannewt on Mon Jul 06, 2020 1:16 pm

I don't think that driver was done by SparkFun. I believe it was done by a community member for a SparkFun sensor.

Unfortunately, I don't know much about AbstractBaseClass myself. I'd probably start by removing it and seeing if it works.

Again, I think your best bet is to file an issue on the repo. I bet they'd be happy to help.

tannewt
 
Posts: 1716
Joined: Thu Oct 06, 2016 8:48 pm

Please be positive and constructive with your questions and comments.