adafruit / Adafruit_CircuitPython_Typing

Definitions not in the standard `typing` module that are needed for type annotation of CircuitPython code.
MIT License
6 stars 9 forks source link

Version 1.10.2 requires Python 3.8 again #39

Closed tombullock-aeromon closed 7 months ago

tombullock-aeromon commented 9 months ago

Following in the footsteps of issue #3, the use of / notation has been reintroduced as of 1.10.2 and in doing so requires the use of Python 3.8. This is not a thing that can be guaranteed, especially when multiple devices are being built in a commercial capacity on limited hardware.

Rather than removing the / notation again, one option would be to restrict 1.10.2 to Python 3.8, and leave the current python requirements for older versions of the module.

scirelli commented 8 months ago

I just ran into this error too!

Traceback (most recent call last):
  File "~/file", line 185, in initialize_devices
    device = initialize_device(importlib.import_module(device_package).Device, callback)
  File ".pyenv/versions/3.7.13/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "~/ir.py", line 64, in <module>
    import adafruit_ads1x15.ads1015 as ADS
  File ".../.venv/lib/python3.7/site-packages/adafruit_ads1x15/ads1015.py", line 23, in <module>
    from .ads1x15 import ADS1x15, Mode
  File ".../.venv/lib/python3.7/site-packages/adafruit_ads1x15/ads1x15.py", line 19, in <module>
    from adafruit_bus_device.i2c_device import I2CDevice
  File ".../.venv/lib/python3.7/site-packages/adafruit_bus_device/i2c_device.py", line 15, in <module>
    from circuitpython_typing import ReadableBuffer, WriteableBuffer
  File ".../.venv/lib/python3.7/site-packages/circuitpython_typing/__init__.py", line 79
    def read(self, count: Optional[int] = None, /) -> Optional[bytes]:
                                                ^
SyntaxError: invalid syntax
dhalbert commented 8 months ago

Yes, this was completely deliberate: #38. What platform are you on that's still using Python 3.7?

So are you asking us to add

[project]
...
requires-python = ">= 3.8"

A PR would be fine.

scirelli commented 8 months ago

I'm on a Beaglebone black, it's at 3.7.13.

So are you asking us to add

That would be a solution, at least then it would error out during install. Everything seemed fine until I ran the code.

dhalbert commented 8 months ago

If I add that to what would be 1.10.3, then the install would try 1.10.2, and that would fail, I think? So I just have to get rid of 1.10.2 altogether?

scirelli commented 8 months ago

I didn't specify a version, just grabbing the latest. So I don't think it will matter to me.

dhalbert commented 8 months ago

Debian bullseye is available for BeagleBone Black from https://www.beagleboard.org/distros. That has Python 3.9. Python 3.7 has been EOL since June, 2023. Can you upgrade your Debian version?

scirelli commented 8 months ago

I'm working on that now. I will see if I can downgrade the requirement until then.

dhalbert commented 8 months ago

just pip3 install adafruit-circuitpython-typing==1.10.1

scirelli commented 8 months ago

just pip3 install adafruit-circuitpython-typing==1.10.1

Yup, that's what I did for now.

tombullock-aeromon commented 8 months ago

Yes, this was completely deliberate: #38. What platform are you on that's still using Python 3.7?

We use a PocketBeagle with Debian Buster; whilst we hope to use the images for Bullseye or Bookworm in the future we cannot guarantee it for all devices, and so any older ones that may be updated for whatever reason are at risk of becoming unusable for our purposes. (Patching to force a particular install version worked on our first affected device, and I did so before writing this ticket.)

If I add that to what would be 1.10.3, then the install would try 1.10.2, and that would fail, I think? So I just have to get rid of 1.10.2 altogether?

Hmm, yeah I can see the issue there.

dhalbert commented 8 months ago

I am going to clean this up by making a 1.10.3 that requires 3.8, and removing 1.10.2. Then anyone installing this with 3.7 with get 1.10.1.

tekktrik commented 7 months ago

I think this is all set now, right @dhalbert? I see the 1.10.2 version yanked on PyPI.

dhalbert commented 7 months ago

Right, I think it is all set. So 1.10.1 is fine for 3.7, and 1.10.3 is the first to require 3.8. I will close this.

Fixed by #40