PyBites-Open-Source/eatlocal

eatlocal only works with Python >= 3.9

rhelmstedter opened this issue · 4 comments

When using eatlocal with Python 3.8, the following error occurs:

TypeError: 'type' object is not subscriptable/Users/russell/.pyenv/versions/3.8.13/envs/test-eatlocal-38/lib/python3.8/site-packages/eatlocal │
│ /__main__.py:22 in <module>                                                                      │
│                                                                                                  │
│    19 console = Console()                                                                        │
│    20                                                                                            │
│    21                                                                                            │
│ ❱  22 def load_config(env_path: Path) -> dict[str, str]:                                         │
│    23config = {"PYBITES_USERNAME": "", "PYBITES_PASSWORD": "", "PYBITES_REPO": ""}          │
│    24if not env_path.exists():

Problem Identification

The root issue here is the change in type hinting syntax from 3.8 to 3.9. In Python 3.8 the syntax is:

from typing import Dict

def load_config(...) -> Dict[str, str]:

This means, in order to use eatlocal, the user must upgrade to Python >= 3.9.0. However, the PyBites platform itself runs on Python 3.8.

Suggestion

The expected versions of Python for both the platform and eatlocal should match. This would allow the user to create a dedicated virtual environment that is more closely aligned with the platform and still use eatlocal.

Caveat

This may lead to a breaking change for users already running a Python version > 3.8. These users would have to downgrade their version of Python to continue using eatlocal.

@bbelderbos Is there a timeline for when the platform will update the version it runs? Or, should I start looking at how adjust eatlocal?

@rhelmstedter I am waiting for 3.10 to do one upgrade but it is taking a while: https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html > so maybe we should do 3.9 first as that's already available. That would solve this issue. Let me add a reminder for next week ...

@bbelderbos I tested PR #33 against both 3.8 and 3.10 and it worked. If you want to wait for 3.10 that is fine.

This issue came about because some one in the slack couldn't get eatlocal to work. He just confirmed that it works now with 3.8 as well.

Awesome thanks. Yeah thinking about the upgrade, it's not easy with many lambdas running and dependencies, so I might wait till 3.10 rather. Happy you got eatlocal to work with 3.8, it's only the typing stuff that you had to change right?