Skip to content

Commit

Permalink
MAINT: dropping astropy <5 and numpy <1.20 support
Browse files Browse the repository at this point in the history
  • Loading branch information
bsipocz committed Mar 13, 2024
1 parent 80f0d4f commit 5df6cd8
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 32 deletions.
4 changes: 2 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Service fixes and enhancements
Infrastructure, Utility and Other Changes and Additions
-------------------------------------------------------

- Versions of astropy <5.0 and numpy <1.20 are no longer supported. [#2966]


- Versions of Python <3.9 are no longer supported.
- Versions of Python <3.9 are no longer supported. [#2966]


0.4.7 (2024-03-08)
Expand Down
5 changes: 1 addition & 4 deletions astroquery/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
from .progressbar import chunk_report, chunk_read
from .class_or_instance import class_or_instance
from .commons import (parse_coordinates, TableList, suppress_vo_warnings,
validate_email, ASTROPY_LT_4_3, ASTROPY_LT_5_0,
ASTROPY_LT_5_1)
validate_email, ASTROPY_LT_5_1)
from .process_asyncs import async_to_sync
from .docstr_chompers import prepend_docstr_nosections
from .cleanup_downloads import cleanup_saved_downloads
Expand All @@ -19,8 +18,6 @@
'TableList',
'suppress_vo_warnings',
'validate_email',
'ASTROPY_LT_4_3',
'ASTROPY_LT_5_0',
'ASTROPY_LT_5_1',
"async_to_sync",
"prepend_docstr_nosections",
Expand Down
8 changes: 1 addition & 7 deletions astroquery/utils/commons.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,8 @@
'TableList',
'suppress_vo_warnings',
'validate_email',
'ASTROPY_LT_4_3',
'ASTROPY_LT_5_0',
'ASTROPY_LT_5_1']

ASTROPY_LT_4_3 = not minversion('astropy', '4.3')
ASTROPY_LT_5_0 = not minversion('astropy', '5.0')

ASTROPY_LT_5_1 = not minversion('astropy', '5.1')


Expand Down Expand Up @@ -73,8 +68,7 @@ def parse_coordinates(coordinates):
"appropriate astropy.coordinates object.", InputWarning)
raise u.UnitsError
except ValueError as err:
if ((ASTROPY_LT_5_0 and isinstance(err.args[1], u.UnitsError))
or (not ASTROPY_LT_5_0 and isinstance(err.__context__, u.UnitsError))):
if isinstance(err.args[1], u.UnitsError):
try:
c = SkyCoord(coordinates, unit="deg", frame="icrs")
warnings.warn("Coordinate string is being interpreted as an "
Expand Down
7 changes: 0 additions & 7 deletions astroquery/utils/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,6 @@ def patch_getreadablefileobj(request):
_is_url = aud._is_url
aud._is_url = lambda x: True

if not commons.ASTROPY_LT_4_3:
_try_url_open = aud._try_url_open
aud._try_url_open = lambda x, **kwargs: MockRemote(x, **kwargs)

_urlopen = urllib.request.urlopen
_urlopener = urllib.request.build_opener
_urlrequest = urllib.request.Request
Expand Down Expand Up @@ -405,9 +401,6 @@ def monkey_urlrequest(x, *args, **kwargs):
def closing():
aud._is_url = _is_url

if not commons.ASTROPY_LT_4_3:
aud._try_url_open = _try_url_open

urllib.request.urlopen = _urlopen
aud.urllib.request.urlopen = _urlopen
urllib.request.build_opener = _urlopener
Expand Down
11 changes: 1 addition & 10 deletions astroquery/vo_conesearch/validator/tests/test_inpect.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,7 @@
import os

# ASTROPY
import astropy
from astropy.utils.data import get_pkg_data_filename
from astropy.utils.introspection import minversion

ASTROPY_LT_4_3 = not minversion(astropy, '4.3')

if ASTROPY_LT_4_3:
from astropy.utils.data import _find_pkg_data_path as get_pkg_data_path
else:
from astropy.utils.data import get_pkg_data_path
from astropy.utils.data import get_pkg_data_filename, get_pkg_data_path

# LOCAL
from .. import inspect
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ omit =
python_requires = >=3.9

install_requires=
numpy>=1.18
astropy>=4.2.1
numpy>=1.20
astropy>=5.0
requests>=2.19
beautifulsoup4>=4.8
html5lib>=0.999
Expand Down

0 comments on commit 5df6cd8

Please sign in to comment.