Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
[submodule "astropy_helpers"]
path = astropy_helpers
url = https://github.com/astropy/astropy-helpers.git
# This file is intentionally left empty after removing astropy-helpers
26 changes: 2 additions & 24 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ include README.rst
include CHANGES.rst
include LONG_DESCRIPTION.rst

include ez_setup.py
include ah_bootstrap.py
include setup.cfg
include pyproject.toml
include tox.ini

recursive-include hips *.pyx *.c *.pxd
recursive-include docs *
Expand All @@ -16,26 +16,4 @@ prune build
prune docs/_build
prune docs/api


# the next few stanzas are for astropy_helpers. It's derived from the
# astropy_helpers/MANIFEST.in, but requires additional includes for the actual
# package directory and egg-info.

include astropy_helpers/README.rst
include astropy_helpers/CHANGES.rst
include astropy_helpers/LICENSE.rst
recursive-include astropy_helpers/licenses *

include astropy_helpers/ez_setup.py
include astropy_helpers/ah_bootstrap.py

recursive-include astropy_helpers/astropy_helpers *.py *.pyx *.c *.h
recursive-include astropy_helpers/astropy_helpers.egg-info *
# include the sphinx stuff with "*" because there are css/html/rst/etc.
recursive-include astropy_helpers/astropy_helpers/sphinx *

prune astropy_helpers/build
prune astropy_helpers/astropy_helpers/tests


global-exclude *.pyc *.o
58 changes: 31 additions & 27 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,6 @@
import os
import sys

try:
import astropy_helpers
except ImportError:
# Building from inside the docs/ directory?
if os.path.basename(os.getcwd()) == 'docs':
a_h_path = os.path.abspath(os.path.join('..', 'astropy_helpers'))
if os.path.isdir(a_h_path):
sys.path.insert(1, a_h_path)

# Load all of the global Astropy configuration
from astropy_helpers.sphinx.conf import *

# Get configuration information from setup.cfg
from configparser import ConfigParser
conf = ConfigParser()
Expand All @@ -50,28 +38,48 @@

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


del intersphinx_mapping['scipy']
del intersphinx_mapping['h5py']
intersphinx_mapping['astropy-healpix'] = ('https://astropy-healpix.readthedocs.io/en/latest/', None)
# Add any Sphinx extension module names here, as strings
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.inheritance_diagram',
'sphinx.ext.viewcode',
'sphinx.ext.mathjax',
'sphinx.ext.napoleon',
'sphinx_automodapi.automodapi',
'sphinx_automodapi.smart_resolver',
'matplotlib.sphinxext.plot_directive',
]

# Intersphinx mappings
intersphinx_mapping = {
'python': ('https://docs.python.org/3/', None),
'numpy': ('https://numpy.org/doc/stable/', None),
'astropy': ('https://docs.astropy.org/en/stable/', None),
'astropy-healpix': ('https://astropy-healpix.readthedocs.io/en/latest/', None),
}

# By default, highlight as Python 3.
highlight_language = 'python3'

# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.2'
# The suffix of source filenames.
source_suffix = '.rst'

# The encoding of source files.
#source_encoding = 'utf-8-sig'

# To perform a Sphinx version check that needs to be more specific than
# major.minor, call `check_sphinx_version("x.y.z")` here.
# check_sphinx_version("1.2.1")
# The master toctree document.
master_doc = 'index'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns.append('_templates')
exclude_patterns = ['_build', '_templates']

# This is added to the end of RST files - a good place to put substitutions to
# be used globally.
rst_epilog += """
rst_epilog = """
"""

# -- Project information ------------------------------------------------------
Expand Down Expand Up @@ -112,12 +120,8 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes. To override the custom theme, set this to the
# name of a builtin theme or the name of a custom theme in html_theme_path.
#html_theme = None

html_theme = "sphinx_rtd_theme"



# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}

Expand Down
55 changes: 30 additions & 25 deletions hips/_astropy_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,29 +111,34 @@ def test(package=None, test_path=None, args=None, plugins=None,
if not _ASTROPY_SETUP_: # noqa
import os
from warnings import warn
from astropy.config.configuration import (
update_default_config,
ConfigurationDefaultMissingError,
ConfigurationDefaultMissingWarning)

# add these here so we only need to cleanup the namespace at the end
config_dir = None

if not os.environ.get('ASTROPY_SKIP_CONFIG_UPDATE', False):
config_dir = os.path.dirname(__file__)
config_template = os.path.join(config_dir, __package__ + ".cfg")
if os.path.isfile(config_template):
try:
update_default_config(
__package__, config_dir, version=__version__)
except TypeError as orig_error:

# Check if we have a config file and update it if needed
# This is compatible with both older and newer astropy versions
try:
from astropy.config.configuration import update_default_config, ConfigurationDefaultMissingError, ConfigurationDefaultMissingWarning

# add these here so we only need to cleanup the namespace at the end
config_dir = None

if not os.environ.get('ASTROPY_SKIP_CONFIG_UPDATE', False):
config_dir = os.path.dirname(__file__)
config_template = os.path.join(config_dir, __package__ + ".cfg")
if os.path.isfile(config_template):
try:
update_default_config(__package__, config_dir)
except ConfigurationDefaultMissingError as e:
wmsg = (e.args[0] +
" Cannot install default profile. If you are "
"importing from source, this is expected.")
warn(ConfigurationDefaultMissingWarning(wmsg))
del e
except Exception:
raise orig_error
update_default_config(
__package__, config_dir, version=__version__)
except TypeError as orig_error:
try:
update_default_config(__package__, config_dir)
except ConfigurationDefaultMissingError as e:
wmsg = (e.args[0] +
" Cannot install default profile. If you are "
"importing from source, this is expected.")
warn(ConfigurationDefaultMissingWarning(wmsg))
del e
except Exception:
raise orig_error
except ImportError:
# Newer versions of astropy might have a different configuration system
# or the update_default_config might be moved elsewhere
pass
19 changes: 16 additions & 3 deletions hips/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,22 @@
# by importing them here in conftest.py they are discoverable by py.test
# no matter how it is invoked within the source tree.

from astropy.tests.pytest_plugins import *
import os
import pytest
try:
# For astropy 4.0 and later
from pytest_astropy_header.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS
except ImportError:
try:
# For astropy 3.0 and later
from astropy.tests.plugins.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS
except ImportError:
# For astropy < 3.0
try:
from astropy.tests.pytest_plugins import PYTEST_HEADER_MODULES, TESTED_VERSIONS
except ImportError:
PYTEST_HEADER_MODULES = {}
TESTED_VERSIONS = {}

## Uncomment the following line to treat all DeprecationWarnings as
## exceptions
Expand All @@ -28,7 +43,5 @@
except ImportError:
version = 'dev'

import os

packagename = os.path.basename(os.path.dirname(__file__))
TESTED_VERSIONS[packagename] = version
2 changes: 1 addition & 1 deletion hips/draw/tests/test_healpix.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_healpix_to_hips(tmpdir, file_format):

for idx, val in enumerate(desired):
filename = str(tmpdir / f"Norder1/Dir0/Npix{idx}.{file_format}")
if file_format is "fits":
if file_format == "fits":
data = fits.getdata(filename)
data = np.rot90(data, k=-1)
else:
Expand Down
2 changes: 1 addition & 1 deletion hips/draw/tests/test_paint.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import pytest
from numpy.testing import assert_allclose
from astropy.coordinates import SkyCoord
from astropy.tests.helper import remote_data
from ...tests.helper import remote_data
from ...utils.testing import requires_hips_extra
from ...utils.wcs import WCSGeometry
from ...tiles import HipsSurveyProperties
Expand Down
2 changes: 1 addition & 1 deletion hips/draw/tests/test_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import pytest
import numpy as np
from numpy.testing import assert_allclose
from astropy.tests.helper import remote_data
from ...tests.helper import remote_data
from ...utils.testing import make_test_wcs_geometry
from ...tiles import HipsSurveyProperties
from ..ui import make_sky_image
Expand Down
2 changes: 1 addition & 1 deletion hips/tiles/tests/test_allsky.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from pathlib import Path
import pytest
from astropy.tests.helper import remote_data
from ...tests.helper import remote_data
from numpy.testing import assert_equal, assert_allclose
from ...utils.testing import get_hips_extra_file, requires_hips_extra
from ..tile import HipsTileMeta
Expand Down
2 changes: 1 addition & 1 deletion hips/tiles/tests/test_fetch.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
from astropy.tests.helper import remote_data
from ...tests.helper import remote_data
from numpy.testing import assert_allclose
from ..fetch import fetch_tiles
from ..survey import HipsSurveyProperties
Expand Down
2 changes: 1 addition & 1 deletion hips/tiles/tests/test_survey.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import pytest
from numpy.testing import assert_allclose
from astropy.utils.data import get_pkg_data_filename
from astropy.tests.helper import remote_data
from ...tests.helper import remote_data
from ...utils.testing import get_hips_extra_file, requires_hips_extra
from ..tile import HipsTileMeta
from ..survey import HipsSurveyProperties, HipsSurveyPropertiesList
Expand Down
2 changes: 1 addition & 1 deletion hips/tiles/tests/test_tile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from pathlib import Path
import pytest
from astropy.tests.helper import remote_data
from ...tests.helper import remote_data
import numpy as np
from numpy.testing import assert_allclose, assert_equal
from ...utils.testing import get_hips_extra_file, requires_hips_extra
Expand Down
12 changes: 6 additions & 6 deletions hips/utils/tests/test_wcs.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from astropy.tests.helper import remote_data
from ...tests.helper import remote_data
from numpy.testing import assert_allclose
from astropy.coordinates import SkyCoord
from ..wcs import WCSGeometry


class TestWCSGeometry:
def setup(self):
def setup_method(self):
self.geometry = WCSGeometry.create(
skydir=SkyCoord(0, 0, unit='deg', frame='galactic'),
width=2000, height=1000, fov='3 deg',
Expand All @@ -33,8 +33,8 @@ def test_celestial_frame(self):
assert c.frame.name == 'icrs'
assert_allclose(c.ra.deg, 359.99, atol=1e-2)
assert_allclose(c.dec.deg, 0.00075, atol=1e-2)
assert_allclose(self.geometry.wcs.wcs.crpix, [1000., 500.])
assert_allclose(self.geometry.wcs.wcs.cdelt, [-0.0015, 0.0015])
assert_allclose(geometry.wcs.wcs.crpix, [1000., 500.])
assert_allclose(geometry.wcs.wcs.cdelt, [-0.0015, 0.0015])

@remote_data
def test_create_from_dict(self):
Expand All @@ -46,5 +46,5 @@ def test_create_from_dict(self):
assert c.frame.name == 'galactic'
assert_allclose(c.l.deg, 184.55, atol=1e-2)
assert_allclose(c.b.deg, -5.78, atol=1e-2)
assert_allclose(self.geometry.wcs.wcs.crpix, [1000., 500.])
assert_allclose(self.geometry.wcs.wcs.cdelt, [-0.0015, 0.0015])
assert_allclose(geometry.wcs.wcs.crpix, [1000., 500.])
assert_allclose(geometry.wcs.wcs.cdelt, [-0.0015, 0.0015])
6 changes: 1 addition & 5 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ norecursedirs = build docs/_build
doctest_plus = enabled
doctest_norecursedirs = docs/*.py

[ah_bootstrap]
auto_use = True

[pycodestyle]
# E101 - mix of tabs and spaces
# W191 - use of tabs
Expand All @@ -40,8 +37,7 @@ license = BSD 3-Clause
url = https://github.com/hipspy/hips
edit_on_github = False
github_project = hipspy/hips
# version should be PEP386 compatible (http://www.python.org/dev/peps/pep-0386)
version = 0.3.dev
# Using setuptools_scm for version management

[entry_points]

Expand Down
Loading