Skip to content

Commit

Permalink
CI fix (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
nabobalis committed Feb 13, 2021
1 parent b815f60 commit e64cca3
Show file tree
Hide file tree
Showing 22 changed files with 1,520 additions and 1,009 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
Sunkit_Instruments v0.2.0 (2021-02-13)
======================================

Features
--------

- Add :func:`sunkit_instruments.rhessi.imagecube2map` function to extract `sunpy.map.MapSequence` objects from a RHESSI 4D image cube. (`#35 <https://github.com/sunpy/sunkit-instruments/pull/35>`__)


Sunkit_Instruments 0.1.0 (2020-09-30)
=====================================

Expand Down
1 change: 0 additions & 1 deletion changelog/35.feature.rst

This file was deleted.

86 changes: 48 additions & 38 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
Expand All @@ -10,31 +9,32 @@
# -- Project information -----------------------------------------------------

from sunkit_instruments import __version__
project = 'sunkit_instruments'
copyright = '2020, The SunPy Developers'
author = 'The SunPy Developers'

project = "sunkit_instruments"
copyright = "2020, The SunPy Developers"
author = "The SunPy Developers"

# The full version, including alpha/beta/rc tags
release = __version__
is_development = '.dev' in __version__
is_development = ".dev" in __version__

# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.inheritance_diagram',
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
'sphinx.ext.doctest',
'sphinx.ext.mathjax',
'sphinx_automodapi.automodapi',
'sphinx_automodapi.smart_resolver',
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.todo",
"sphinx.ext.coverage",
"sphinx.ext.inheritance_diagram",
"sphinx.ext.viewcode",
"sphinx.ext.napoleon",
"sphinx.ext.doctest",
"sphinx.ext.mathjax",
"sphinx_automodapi.automodapi",
"sphinx_automodapi.smart_resolver",
]

# Add any paths that contain templates here, relative to this directory.
Expand All @@ -43,33 +43,42 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
source_suffix = '.rst'
source_suffix = ".rst"

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# The reST default role (used for this markup: `text`) to use for all
# documents. Set to the "smart" one.
default_role = 'obj'
default_role = "obj"

# -- Options for intersphinx extension ---------------------------------------

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
'python': ('https://docs.python.org/3/',
(None, 'http://data.astropy.org/intersphinx/python3.inv')),
'numpy': ('https://docs.scipy.org/doc/numpy/',
(None, 'http://data.astropy.org/intersphinx/numpy.inv')),
'scipy': ('https://docs.scipy.org/doc/scipy/reference/',
(None, 'http://data.astropy.org/intersphinx/scipy.inv')),
'matplotlib': ('https://matplotlib.org/',
(None, 'http://data.astropy.org/intersphinx/matplotlib.inv')),
'astropy': ('http://docs.astropy.org/en/stable/', None),
'sunpy': ('https://docs.sunpy.org/en/stable/', None)}
"python": (
"https://docs.python.org/3/",
(None, "http://data.astropy.org/intersphinx/python3.inv"),
),
"numpy": (
"https://docs.scipy.org/doc/numpy/",
(None, "http://data.astropy.org/intersphinx/numpy.inv"),
),
"scipy": (
"https://docs.scipy.org/doc/scipy/reference/",
(None, "http://data.astropy.org/intersphinx/scipy.inv"),
),
"matplotlib": (
"https://matplotlib.org/",
(None, "http://data.astropy.org/intersphinx/matplotlib.inv"),
),
"astropy": ("http://docs.astropy.org/en/stable/", None),
"sunpy": ("https://docs.sunpy.org/en/stable/", None),
}

# -- Options for HTML output -------------------------------------------------

Expand All @@ -79,7 +88,7 @@
try:
from sunpy_sphinx_theme.conf import *
except ImportError:
html_theme = 'default'
html_theme = "default"


# Add any paths that contain custom static files (such as style sheets) here,
Expand All @@ -91,12 +100,12 @@
graphviz_output_format = "svg"

graphviz_dot_args = [
'-Nfontsize=10',
'-Nfontname=Helvetica Neue, Helvetica, Arial, sans-serif',
'-Efontsize=10',
'-Efontname=Helvetica Neue, Helvetica, Arial, sans-serif',
'-Gfontsize=10',
'-Gfontname=Helvetica Neue, Helvetica, Arial, sans-serif'
"-Nfontsize=10",
"-Nfontname=Helvetica Neue, Helvetica, Arial, sans-serif",
"-Efontsize=10",
"-Efontname=Helvetica Neue, Helvetica, Arial, sans-serif",
"-Gfontsize=10",
"-Gfontname=Helvetica Neue, Helvetica, Arial, sans-serif",
]


Expand All @@ -106,9 +115,10 @@
target_file = os.path.abspath("./whatsnew/latest_changelog.txt")
try:
from sunpy.util.towncrier import generate_changelog_for_docs

if is_development:
generate_changelog_for_docs("../", target_file)
except Exception as e:
print(f"Failed to add changelog to docs with error {e}.")
# Make sure the file exists or else sphinx will complain.
open(target_file, 'a').close()
open(target_file, "a").close()
59 changes: 49 additions & 10 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ classifiers =
Programming Language :: Python :: 3
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Topic :: Scientific/Engineering :: Physics

[options]
Expand All @@ -36,7 +37,8 @@ install_requires =
matplotlib
numpy
pandas
sunpy[net,timeseries] >= 2.0.0
scipy
sunpy[net,timeseries] >= 2.1.0rc3

[options.extras_require]
tests =
Expand Down Expand Up @@ -69,23 +71,60 @@ junit_family=xunit1
filterwarnings =
error
error::sunpy.util.exceptions.SunpyDeprecationWarning
# Do not fail on pytest config issues (i.e. missing plugins) but do show them
always::pytest.PytestConfigWarning
#
# A list of warnings to ignore follows. If you add to this list, you MUST
# add a comment or ideally a link to an issue that explains why the warning
# is being ignored
#
# These warnings are raised on our CI due to something odd about numpy installation,
# but don't impact the tests
ignore:numpy.ufunc size changed:RuntimeWarning
# See https://github.com/aio-libs/aiohttp/issues/4842
ignore:"@coroutine" decorator is deprecated
#
# See https://github.com/pandas-dev/pandas/issues/26367; this can be
# removed when our minimum pandas version is >=0.25
ignore:can't resolve package from __spec__ or __package__:ImportWarning
# See https://github.com/spacetelescope/asdf/issues/789
ignore:direct construction of AsdfSchemaFile has been deprecated
ignore:direct construction of AsdfSchemaItem has been deprecated
ignore:direct construction of AsdfSchemaExampleItem has been deprecated
# See https://github.com/Cadair/parfive/issues/41
# Or other packages
ignore:The loop argument is deprecated
# This is due to dependencies building with a numpy version different from
# the local installed numpy version, but should be fine
# See https://github.com/numpy/numpy/issues/15748#issuecomment-598584838
ignore:numpy.ufunc size changed:RuntimeWarning
ignore:numpy.ndarray size changed:RuntimeWarning
# See https://github.com/mvantellingen/python-zeep/issues/956
ignore:defusedxml.lxml is no longer supported and will be removed in a future release.
# Sunpy Timeseries Warning.
ignore:Unknown units for.*
ignore:defusedxml.lxml is no longer supported:DeprecationWarning
# See https://github.com/aio-libs/aiohttp/issues/4842
ignore:"@coroutine" decorator is deprecated
# See https://github.com/spacetelescope/asdf/issues/789
ignore:direct construction of AsdfSchemaFile has been deprecated
ignore:direct construction of AsdfSchemaItem has been deprecated
ignore:direct construction of AsdfSchemaExampleItem has been deprecated
# See https://github.com/scikit-image/scikit-image/issues/4848
ignore:Converting `np.inexact` or `np.floating` to a dtype is deprecated
# See https://github.com/astropy/astropy/pull/10570
ignore:leap-second auto-update failed
# See https://github.com/astropy/extension-helpers/issues/23
ignore:Distutils was imported before Setuptools
# Figure tests use agg backend so show doesn't work but we use it in peek
ignore:Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
# Ignore doctest issues: docs/guide/tour.rst
ignore:File may have been truncated*
# Some tests use data that have dates in the future and ERFA does not like.
ignore:ERFA function "d2dtf"*
ignore:ERFA function "dtf2d"*
# Currently helio makes unverified requests - this filter should be removed when
# https://github.com/sunpy/sunpy/issues/4401 is fixed
ignore:Unverified HTTPS request
# https://github.com/astropy/astropy/issues/11272
ignore:elementwise == comparison failed and returning scalar instead:FutureWarning:astropy.table
# This isn't really an issue it's an annoyance, it's triggered by printing
# an astropy table inside a test, which is generally only done when
# CHANNEL UNITS ISSUE.
ignore:Unknown units for CHANNEL.*:sunpy.util.exceptions.SunpyUserWarning:
# debugging.
ignore:the imp module is deprecated in favour of importlib:DeprecationWarning:ipykernel.iostream

[pycodestyle]
max_line_length = 100
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
################################################################################
# Programmatically generate some extras combos.
################################################################################
extras = read_configuration("setup.cfg")['options']['extras_require']
extras = read_configuration("setup.cfg")["options"]["extras_require"]

# Dev is everything
extras['dev'] = list(chain(*extras.values()))
extras["dev"] = list(chain(*extras.values()))

# All is everything but tests and docs
exclude_keys = ("tests", "docs", "dev")
ex_extras = dict(filter(lambda i: i[0] not in exclude_keys, extras.items()))
# Concatenate all the values together for 'all'
extras['all'] = list(chain.from_iterable(ex_extras.values()))
extras["all"] = list(chain.from_iterable(ex_extras.values()))

setup(
extras_require=extras,
use_scm_version={'write_to': os.path.join('sunkit_instruments', '_version.py')}
use_scm_version={"write_to": os.path.join("sunkit_instruments", "_version.py")},
)
7 changes: 5 additions & 2 deletions sunkit_instruments/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ class UnsupportedPythonError(Exception):
"""


if sys.version_info < tuple(int(val) for val in __minimum_python_version__.split('.')):
if sys.version_info < tuple(int(val) for val in __minimum_python_version__.split(".")):
# This has to be .format to keep backwards compatibly.
raise UnsupportedPythonError(
"sunkit_instruments does not support Python < {}".format(__minimum_python_version__))
"sunkit_instruments does not support Python < {}".format(
__minimum_python_version__
)
)

__all__ = []
1 change: 1 addition & 0 deletions sunkit_instruments/_dev/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This package contains utilities that are only used when developing drms in a
copy of the source repository.
These files are not installed, and should not be assumed to exist at
runtime.
"""
6 changes: 3 additions & 3 deletions sunkit_instruments/_dev/scm_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
try:
from setuptools_scm import get_version

version = get_version(root=os.path.join('..', '..'), relative_to=__file__)
version = get_version(root=os.path.join("..", ".."), relative_to=__file__)
except ImportError:
raise ImportError('setuptools_scm not installed')
raise ImportError("setuptools_scm not installed")
except Exception as e:
raise ValueError(f'setuptools_scm broken with {e}')
raise ValueError(f"setuptools_scm broken with {e}")
23 changes: 11 additions & 12 deletions sunkit_instruments/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import pytest


Expand All @@ -14,22 +13,22 @@ def sunpy_cache(mocker, tmp_path):
from sunpy.data.data_manager.cache import Cache
from sunpy.data.data_manager.downloader import ParfiveDownloader
from sunpy.data.data_manager.storage import InMemStorage
cache = Cache(
ParfiveDownloader(),
InMemStorage(),
tmp_path,
None
)

cache = Cache(ParfiveDownloader(), InMemStorage(), tmp_path, None)

def add(self, url, path):
self._storage.store({
'url': url,
'file_path': path,
'file_hash': 'none', # hash doesn't matter
})
self._storage.store(
{
"url": url,
"file_path": path,
"file_hash": "none", # hash doesn't matter
}
)

cache.add = MethodType(add, cache)

def func(mocked):
mocker.patch(mocked, cache)
return cache

yield func
14 changes: 8 additions & 6 deletions sunkit_instruments/data/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

import sunkit_instruments

__all__ = ['rootdir', 'file_list', 'get_test_filepath', 'test_data_filenames']
__all__ = ["rootdir", "file_list", "get_test_filepath", "test_data_filenames"]

rootdir = os.path.join(os.path.dirname(sunkit_instruments.__file__), "data", "test")
file_list = glob.glob(os.path.join(rootdir, '*.[!p]*'))
file_list = glob.glob(os.path.join(rootdir, "*.[!p]*"))


def get_test_filepath(filename, **kwargs):
Expand All @@ -35,7 +35,9 @@ def get_test_filepath(filename, **kwargs):
This is a wrapper around `astropy.utils.data.get_pkg_data_filename` which
sets the ``package`` kwarg to be 'sunkit_instruments.data.test`.
"""
return get_pkg_data_filename(filename, package="sunkit_instruments.data.test", **kwargs)
return get_pkg_data_filename(
filename, package="sunkit_instruments.data.test", **kwargs
)


def test_data_filenames():
Expand All @@ -50,13 +52,13 @@ def test_data_filenames():
The name of all test files in ``data/test`` directory.
"""
test_data_filenames_list = []
excludes = ['*.pyc', '*'+os.path.sep+'__*__', '*.py']
excludes = r'|'.join([fnmatch.translate(x) for x in excludes]) or r'$.'
excludes = ["*.pyc", "*" + os.path.sep + "__*__", "*.py"]
excludes = r"|".join([fnmatch.translate(x) for x in excludes]) or r"$."

for root, dirs, files in os.walk(rootdir):
files = [os.path.join(root, f) for f in files]
files = [f for f in files if not re.match(excludes, f)]
files = [file.replace(rootdir + os.path.sep, '') for file in files]
files = [file.replace(rootdir + os.path.sep, "") for file in files]
test_data_filenames_list.extend(files)

return test_data_filenames_list

0 comments on commit e64cca3

Please sign in to comment.