pygdsm icon indicating copy to clipboard operation
pygdsm copied to clipboard

Replace `match` with if/else logic to restore compatiibility with earlier Python versions

Open sjoerd-bouma opened this issue 1 year ago • 1 comments

The __init__.py currently uses the match statement, which was introduced only in Python 3.10. Unfortunately, this means pygdsm is incompatible with earlier Python versions, in particular on clusters etc. where upgrading may not be straightforward. As far as I could tell, the match statement was in fact the only source of incompatibility with older Python versions, so here my suggestion to replace it with if/else logic instead.

I have verified this works on a local Python 3.6 installation. I have also added the python_requires argument to the setup.cfg file, as I think this is how pip can tell which Python versions are supported. I suppose the version number also has to be bumped before this can be released, but I am not sure exactly how/if you would like to proceed from here : )

sjoerd-bouma avatar Jun 25 '24 12:06 sjoerd-bouma

PR Summary

  • Enhanced Compatibility with Older Python Versions A change was made in the code base of the program to swap out newer "match" statements for more traditional "if-elif" statements. This ensures that the package is usable even for those using older versions of Python programming language.

  • Explicit Python Version Requirements A new field was introduced in the configuration file which explicitly states that for the package to work smoothly, a Python version of 3.6 or higher is needed. This takes the guesswork out of determining which versions are compatible with our software.

  • Extended Language Support in Metadata We've updated the 'metadata' - essentially the package's 'label' so to speak - to include Python version support for 3.6 through to 3.9. This means our package is now officially stated to work with more recent versions of Python and can reached a broader user base.

what-the-diff[bot] avatar Jun 25 '24 12:06 what-the-diff[bot]

Thanks @sjoerd-bouma -- finally merged (sorry this dropped off my radar)!

telegraphic avatar Dec 21 '24 07:12 telegraphic