ryantam626 / jupyterlab_code_formatter

A JupyterLab plugin to facilitate invocation of code formatters.
MIT License
822 stars 52 forks source link

Minimum Python version #309

Closed pdhall99 closed 1 year ago

pdhall99 commented 1 year ago

I ran into the issue pointed out here: https://github.com/ryantam626/jupyterlab_code_formatter/issues/193#issuecomment-1488742233

Is the intention to support Python >= 3.7? https://github.com/ryantam626/jupyterlab_code_formatter/blob/6d9f6efce1c6f6739a3f076dc25348ad6e8f38ba/pyproject.toml#L9

If so, then the particular functools.cache issue could be fixed by changing https://github.com/ryantam626/jupyterlab_code_formatter/blob/6d9f6efce1c6f6739a3f076dc25348ad6e8f38ba/jupyterlab_code_formatter/formatters.py#L17 to something like

import sys

if sys.version_info >= (3, 9):
    from functools import cache
else:
    from functools import lru_cache
    cache = lru_cache(maxsize=None)

Or if the intention is to support Python >= 3.9 then it would make sense to update pyproject.toml.

I can make a PR either way.

ryantam626 commented 1 year ago

On yikes, this slipped my mind, the intention is to support 3.7 until it becomes unbearablely hard/EOL of 3.7.

Would you mind making a PR for additional support for >=3.7,<3.9 please? :pray:

ryantam626 commented 1 year ago

I will publish a new version with your fix in a couple of days, feeling a bit sick atm and the release process is not fully ironed out yet. Thanks again!