From c10b409cd8cb28fd7d792d16b90e8c0fe9dac41d Mon Sep 17 00:00:00 2001 From: Kolja Glogowski Date: Sun, 17 Feb 2019 14:06:54 +0100 Subject: [PATCH 1/6] Added support for pytest >= 4.1 The method Item.get_marker() was removed in pytest 4.1. A drop-in replacement for our case is Item.get_closest_marker() which was introduced in the pytest 3.6 release. --- drms/tests/conftest.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drms/tests/conftest.py b/drms/tests/conftest.py index 54fc899..dc6ed56 100644 --- a/drms/tests/conftest.py +++ b/drms/tests/conftest.py @@ -79,19 +79,34 @@ def site_reachable(url, timeout=3): kis_reachable = lazily_cached(site_reachable, kis_testurl) +def _get_item_marker(item, name): + """ + Compatibility function for pytest < 3.6. + + Notes + ----- + The method pytest.Item.get_closest_marker() is available since pytest 3.6, + while the method pytest.Item.get_marker() was removed in pytest 4.1. + """ + if hasattr(item, 'get_closest_marker'): + return item.get_closest_marker(name) + else: + return item.get_marker(name) + + def pytest_runtest_setup(item): # Skip JSOC online site tests if the site is not reachable. - if item.get_marker('jsoc') is not None: + if _get_item_marker(item, 'jsoc') is not None: if not jsoc_reachable(): pytest.skip('JSOC is not reachable') # Skip KIS online site tests if the site is not reachable. - if item.get_marker('kis') is not None: + if _get_item_marker(item, 'kis') is not None: if not kis_reachable(): pytest.skip('KIS is not reachable') # Skip export tests if no email address was specified. - if item.get_marker('export') is not None: + if _get_item_marker(item, 'export') is not None: email = item.config.getoption('email') if email is None: pytest.skip('No email address specified; use the --email ' From c48562bf17309c18aff7c9d8422fb37629b277d6 Mon Sep 17 00:00:00 2001 From: Kolja Glogowski Date: Sun, 17 Feb 2019 16:02:53 +0100 Subject: [PATCH 2/6] Make sure that drms.to_datetime() returns naive timestamps --- drms/utils.py | 1 + setup.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drms/utils.py b/drms/utils.py index 4325c3e..81bd361 100644 --- a/drms/utils.py +++ b/drms/utils.py @@ -79,4 +79,5 @@ def to_datetime(tstr, force=False): s = s.str.replace('_', ' ') s = s.str.replace('.', '-', n=2) res = _pd_to_datetime_coerce(s) + res = res.dt.tz_localize(None) # remove any timezone information return res.iloc[0] if (len(res) == 1) and np.isscalar(tstr) else res diff --git a/setup.py b/setup.py index b58c363..27e31e4 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ packages=['drms', 'drms.tests'], install_requires=[ 'numpy>=1.9.0', - 'pandas>=0.14.1', + 'pandas>=0.15.0', 'six>=1.8.0'], classifiers=[ 'Intended Audience :: Developers', From 2952e9bd48f1fc07ea5688eab7c38d7757025320 Mon Sep 17 00:00:00 2001 From: Kolja Glogowski Date: Sun, 17 Feb 2019 16:49:13 +0100 Subject: [PATCH 3/6] Fixed Pandas future warnings for DataFrame.from_items() Replaced the deprecated pandas.DataFrame.from_items(...) method calls with pandas.DataFrame.from_dict(OrderedDict(...)). --- drms/client.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drms/client.py b/drms/client.py index d48660b..c19d01e 100644 --- a/drms/client.py +++ b/drms/client.py @@ -4,6 +4,7 @@ import re import time import warnings +from collections import OrderedDict from six import string_types from six.moves.urllib.request import urlretrieve from six.moves.urllib.error import HTTPError, URLError @@ -1086,7 +1087,8 @@ def query(self, ds, key=None, seg=None, link=None, convert_numeric=True, if 'keywords' in lres: names = [it['name'] for it in lres['keywords']] values = [it['values'] for it in lres['keywords']] - res_key = pd.DataFrame.from_items(zip(names, values)) + res_key = pd.DataFrame.from_dict( + OrderedDict(zip(names, values))) else: res_key = pd.DataFrame() if convert_numeric: @@ -1097,7 +1099,8 @@ def query(self, ds, key=None, seg=None, link=None, convert_numeric=True, if 'segments' in lres: names = [it['name'] for it in lres['segments']] values = [it['values'] for it in lres['segments']] - res_seg = pd.DataFrame.from_items(zip(names, values)) + res_seg = pd.DataFrame.from_dict( + OrderedDict(zip(names, values))) else: res_seg = pd.DataFrame() res.append(res_seg) @@ -1106,7 +1109,8 @@ def query(self, ds, key=None, seg=None, link=None, convert_numeric=True, if 'links' in lres: names = [it['name'] for it in lres['links']] values = [it['values'] for it in lres['links']] - res_link = pd.DataFrame.from_items(zip(names, values)) + res_link = pd.DataFrame.from_dict( + OrderedDict(zip(names, values))) else: res_link = pd.DataFrame() res.append(res_link) From a1d1e1469b7d85203b62ac9422a2dff3f0d176ce Mon Sep 17 00:00:00 2001 From: Kolja Glogowski Date: Sun, 17 Feb 2019 17:10:07 +0100 Subject: [PATCH 4/6] Make sure all online tests get installed with the drms package --- drms/tests/online/__init__.py | 0 setup.py | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 drms/tests/online/__init__.py diff --git a/drms/tests/online/__init__.py b/drms/tests/online/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/setup.py b/setup.py index 27e31e4..7f7e6c0 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ author_email=AUTHOR_EMAIL, url=URL, license=LICENSE, - packages=['drms', 'drms.tests'], + packages=['drms', 'drms.tests', 'drms.tests.online'], install_requires=[ 'numpy>=1.9.0', 'pandas>=0.15.0', From 9ec5cabb8496d24a9fc94a409a341828ce03c3d4 Mon Sep 17 00:00:00 2001 From: Kolja Glogowski Date: Sun, 17 Feb 2019 17:22:33 +0100 Subject: [PATCH 5/6] Updated tox envlist and added a special testenv for old versions --- tox.ini | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 2e96474..a0f73c5 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27, py34, py35, py36 +envlist = py27, py35, py36, py37 [testenv] deps = @@ -12,3 +12,16 @@ commands = python --version python -m drms --version python -m drms.tests + +[testenv:py34] +deps = + Cython + six==1.8.0 + numpy==1.9.0 + pandas==0.15.0 + pytest +changedir = {envtmpdir} +commands = + python --version + python -m drms --version + python -m drms.tests From cc1e7bc7e1eefdfe6503b0dc914804c24b479199 Mon Sep 17 00:00:00 2001 From: Kolja Glogowski Date: Sun, 17 Feb 2019 18:17:09 +0100 Subject: [PATCH 6/6] Updated URLs, version numbers, authors and dates --- AUTHORS.txt | 3 +++ LICENSE.txt | 2 +- README.rst | 6 +++--- doc/index.rst | 2 +- doc/intro.rst | 2 +- doc/tutorial.rst | 6 +++--- drms/__init__.py | 4 ++-- setup.py | 3 ++- 8 files changed, 16 insertions(+), 12 deletions(-) diff --git a/AUTHORS.txt b/AUTHORS.txt index 0f26593..3a7d231 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -8,3 +8,6 @@ Contributors: - Monica Bobra - Arthur Amezcua - David Perez-Suarez +- Nitin Choudhary +- Stuart Mumford +- Nabil Freij diff --git a/LICENSE.txt b/LICENSE.txt index f4355c0..2d0a549 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2014-2016 Kolja Glogowski and others. +Copyright (c) 2014-2019 Kolja Glogowski and others. See AUTHORS.txt for a list of contributors. Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/README.rst b/README.rst index 5115773..c0c52b2 100644 --- a/README.rst +++ b/README.rst @@ -3,8 +3,8 @@ drms ==== `Docs `_ | -`Tutorial `_ | -`Github `_ | +`Tutorial `_ | +`Github `_ | `PyPI `_ The ``drms`` module provides an easy-to-use interface for accessing HMI, @@ -22,7 +22,7 @@ The ``drms`` module supports Python 2.7 and Python 3.4 or newer. It requires the following Python packages: - NumPy, version 1.9.0 or newer -- Pandas, version 0.14.1 or newer +- Pandas, version 0.15.0 or newer - Six, version 1.8.0 or newer The module might also work with earlier versions, but it has not been diff --git a/doc/index.rst b/doc/index.rst index cfb137b..41f2113 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -4,7 +4,7 @@ drms documentation :Release: |version| :Date: |today| -:Github: https://github.com/kbg/drms +:Github: https://github.com/sunpy/drms :PyPI: https://pypi.python.org/pypi/drms Python module for accessing HMI, AIA and MDI data. diff --git a/doc/intro.rst b/doc/intro.rst index 7195e5f..0492656 100644 --- a/doc/intro.rst +++ b/doc/intro.rst @@ -32,7 +32,7 @@ The ``drms`` module supports Python 2.7 and Python 3.4 or newer. It requires the following Python packages: - NumPy, version 1.9.0 or newer -- Pandas, version 0.14.1 or newer +- Pandas, version 0.15.0 or newer - Six, version 1.8.0 or newer The module might also work with earlier versions, but it has not been diff --git a/doc/tutorial.rst b/doc/tutorial.rst index ea78927..7dce267 100644 --- a/doc/tutorial.rst +++ b/doc/tutorial.rst @@ -9,7 +9,7 @@ This tutorial gives an introduction on how to use the ``drms`` Python module. More detailed information on the different classes and functions can be found in the :ref:`API Reference Manual `. In addition to this tutorial, many example scripts are available in the -`source code package `_ +`source code package `_ of the ``drms`` module. .. tip:: @@ -414,10 +414,10 @@ Example scripts --------------- There are many example scripts available in the -`examples directory `_ +`examples directory `_ of the ``drms`` Python package source code. An archive of the latest source code release can be downloaded from the -`drms relase page `_ +`drms relase page `_ on Github. .. For more information, use ``help(drms)`` inside the Python interpreter, diff --git a/drms/__init__.py b/drms/__init__.py index 6d029d5..be93dd6 100644 --- a/drms/__init__.py +++ b/drms/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2014-2016 Kolja Glogowski and others. +# Copyright (c) 2014-2019 Kolja Glogowski and others. # See AUTHORS.txt for a list of contributors. # # Permission is hereby granted, free of charge, to any person @@ -25,7 +25,7 @@ """ Access HMI, AIA and MDI data with Python -The latest release is avaiable at https://github.com/kbg/drms . +The latest release is avaiable at https://github.com/sunpy/drms . """ from __future__ import absolute_import, division, print_function diff --git a/setup.py b/setup.py index 7f7e6c0..1c58184 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ LONG_DESCRIPTION = open('README.rst').read() AUTHOR = 'Kolja Glogowski' AUTHOR_EMAIL = '"Kolja Glogowski" ' -URL = 'https://github.com/kbg/drms' +URL = 'https://github.com/sunpy/drms' LICENSE = 'MIT' setup(name=NAME, @@ -36,5 +36,6 @@ 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', 'Topic :: Scientific/Engineering :: Astronomy'], platforms='any')