diff --git a/MANIFEST.in b/MANIFEST.in index 5709e033..07cbd04a 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,21 +1,3 @@ -include README.rst -include CHANGES.rst -include setup.cfg -include LICENSE.rst -include pyproject.toml - -recursive-include sunkit_instruments *.pyx *.c *.pxd -recursive-include docs * -recursive-include licenses * -recursive-include cextern * -recursive-include scripts * - -prune build -prune docs/_build -prune docs/api - -global-exclude *.pyc *.o - # This subpackage is only used in development checkouts and should not be # included in built tarballs prune sunkit_instruments/_dev diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f1ae1210..9247aa85 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -40,11 +40,14 @@ stages: - template: check-skip.yml@OpenAstronomy - template: run-tox-env.yml@OpenAstronomy parameters: - default_python: '3.8' + default_python: '3.9' submodules: false coverage: codecov + libraries: + apt: + - libhdf5-dev envs: - - linux: py39 + - linux: py311 - stage: SecondPhaseTests displayName: Stage 2 Tests @@ -53,7 +56,7 @@ stages: jobs: - template: run-tox-env.yml@OpenAstronomy parameters: - default_python: '3.8' + default_python: '3.9' submodules: false coverage: codecov libraries: @@ -74,7 +77,7 @@ stages: jobs: - template: run-tox-env.yml@OpenAstronomy parameters: - default_python: '3.8' + default_python: '3.9' submodules: false coverage: codecov envs: diff --git a/docs/conf.py b/docs/conf.py index ae6595f2..8f3af123 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -13,7 +13,7 @@ os.environ["HOME"] = "/home/docs/" os.environ["LANG"] = "C" os.environ["LC_ALL"] = "C" - os.environ["HIDE_PARFIVE_PROGESS"] = "True" + os.environ["PARFIVE_HIDE_PROGRESS"] = "True" # -- Non stdlib imports -------------------------------------------------------- from sunkit_instruments import __version__ # NOQA diff --git a/examples/plot_suvi_thematic_map.py b/examples/plot_suvi_thematic_map.py index f292ed7c..b9d47a99 100644 --- a/examples/plot_suvi_thematic_map.py +++ b/examples/plot_suvi_thematic_map.py @@ -14,11 +14,11 @@ import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap from matplotlib.patches import Patch +from parfive import Downloader from astropy.io import fits from sunkit_instruments.suvi._variables import SOLAR_CLASS_NAME, SOLAR_COLORS -from sunkit_instruments.utils import _download_data ############################################################################### # We start with getting the data. This is done by downloading the data from ``data.ngdc.noaa.gov``. @@ -29,16 +29,15 @@ # Using the url: # https://data.ngdc.noaa.gov/platforms/solar-space-observing-satellites/goes/goes16/l2/data/suvi-l2-thmap/2022/01/01/dr_suvi-l2-thmap_g16_s20220101T000000Z_e20220101T000400Z_v1-0-2.fits -urls = [ +url = [ "https://data.ngdc.noaa.gov/platforms/solar-space-observing-satellites/goes/goes16/l2/data/suvi-l2-thmap/2022/01/01/dr_suvi-l2-thmap_g16_s20220101T000000Z_e20220101T000400Z_v1-0-2.fits" ] -_download_data(urls) -filename = "dr_suvi-l2-thmap_g16_s20220101T000000Z_e20220101T000400Z_v1-0-2.fits" +(file,) = Downloader.simple_download(url) ################################################################################ # First let's read a SUVI L2 Thematic Map FITS file. -with fits.open(filename) as hdu: +with fits.open(file) as hdu: thmap_data = hdu[0].data time_stamp = hdu[0].header["DATE-OBS"][0:19] diff --git a/setup.cfg b/setup.cfg index 0760ce73..70cd9da4 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,7 +7,7 @@ long_description_content_type = text/x-rst author = The SunPy Community author_email = sunpy@googlegroups.com license = BSD 3-Clause -license_file = LICENSE.rst +license_files = LICENSE.rst url = https://sunpy.org edit_on_github = True github_project = sunpy/sunkit_instruments @@ -23,6 +23,7 @@ classifiers = Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 Topic :: Scientific/Engineering :: Physics [options] @@ -71,8 +72,8 @@ filterwarnings = # is being ignored # # + ignore:may indicate binary incompatibility:RuntimeWarning ignore:distutils Version classes are deprecated. Use packaging.version instead:DeprecationWarning - ignore:numpy.ndarray size changed, may indicate binary incompatibility. ignore:Unknown units for CHANNEL:sunpy.util.exceptions.SunpyUserWarning [pycodestyle] diff --git a/setup.py b/setup.py index 091417e6..ca6e7706 100755 --- a/setup.py +++ b/setup.py @@ -3,7 +3,12 @@ import os from itertools import chain -from setuptools.config import read_configuration +try: + # Recommended for setuptools 61.0.0+ + # (though may disappear in the future) + from setuptools.config.setupcfg import read_configuration +except ImportError: + from setuptools.config import read_configuration ################################################################################ # Programmatically generate some extras combos. diff --git a/sunkit_instruments/utils.py b/sunkit_instruments/utils.py index 7c628815..952b80b5 100644 --- a/sunkit_instruments/utils.py +++ b/sunkit_instruments/utils.py @@ -1,25 +1,3 @@ """ This module provides general utility functions. """ -import shutil -import tarfile -from pathlib import Path - -import requests - - -def _download_data(urls: list): - """ - This only should be called in the example gallery. - - THIS IS NOT A USER FACING FUNCTION TO DOWNLOAD DATA. - """ - for url in urls: - filename = url.split("/")[-1] - if not Path(filename).exists(): - with requests.get(url, stream=True) as r: - with open(filename, "wb") as f: - shutil.copyfileobj(r.raw, f) - if ".tar.gz" in filename: - with tarfile.open(filename, "r") as tar: - tar.extractall(Path(filename).parent) diff --git a/tox.ini b/tox.ini index 9b0c96ae..a6bc4f6f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - py{38,39,310}{,-devdeps,-online,-oldestdeps} + py{38,39,310,311}{,-devdeps,-online,-oldestdeps} build_docs codestyle requires = @@ -9,8 +9,6 @@ requires = isolated_build = true [testenv] -# Run the tests in a temporary directory to make sure that we don't import -# sunpy from the source tree changedir = .tmp/{envname} description = run tests @@ -21,7 +19,7 @@ setenv = COLUMNS = 180 PYTEST_COMMAND = pytest -vvv -s -raR --durations=25 --pyargs sunkit_instruments --cov-report=xml --cov=sunkit_instruments --cov-config={toxinidir}/setup.cfg {toxinidir}/docs SUNPY_SAMPLEDIR = {env:SUNPY_SAMPLEDIR:{toxinidir}/.tox/{envname}/sample_data/} - HIDE_PARFIVE_PROGESS = True + PARFIVE_HIDE_PROGRESS = True passenv = HOME HTTP_PROXY @@ -29,15 +27,11 @@ passenv = NO_PROXY CIRCLECI deps = - # All our tests run in parallel which this plugin allows us to. - pytest-xdist - # The devdeps factor is intended to be used to install the latest developer version of key dependencies. devdeps: git+https://github.com/sunpy/sunpy - # These are specific online extras we use to run the online tests. + oldestdeps: sunpy<4.1 online: pytest-rerunfailures online: pytest-timeout - # Oldest deps we pin against. - oldestdeps: sunpy<4.1 + pytest-xdist extras = dev commands =