astropy / package-template

Template for packages that use Astropy. Maintainer: @astrofrog
http://docs.astropy.org/projects/package-template/en/latest/
Other
60 stars 62 forks source link

Python version check comes to late (for version 2 at least) #428

Closed mhvk closed 4 years ago

mhvk commented 5 years ago

In __init__.py, the check on the python version comes after importing _astropy_init, which means that if one tries to import under python2, a bug is raised before the version check happens.

I think the order can be safely swapped (or, perhaps better, the version check can happen inside _astropy_init.py)

Also, ideally, of course there is only one place where the minimum version is defined...

p.s. EDIT: in my packages, I have simply removed the version check; things either work or they don't...

Cadair commented 5 years ago

Also, ideally, of course there is only one place where the minimum version is defined...

This turned out to be practically impossible, which is why we ended up with it twice fwiw.

pllim commented 4 years ago

Is this still an issue?

astrofrog commented 4 years ago

Technically it's still an issue, although people shouldn't really run into it if they define python_requires properly, which this template does. In any case I think the real fix is what @mhvk mentioned - we should just remove this check from __init__.py. Should be an easy PR if anyone wants to give it a go :) (I'll happily approve).