-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MNT: Modernize packaging, etc #64
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
version: 2 | ||
|
||
build: | ||
image: latest | ||
os: ubuntu-20.04 | ||
tools: | ||
python: "3.9" | ||
|
||
sphinx: | ||
builder: html | ||
configuration: docs/conf.py | ||
fail_on_warning: true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can set up RTD PR builder here using this setting and turn off sphinx builds on Azure. |
||
|
||
python: | ||
version: 3.6 | ||
system_packages: false | ||
install: | ||
- method: pip | ||
path: . | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
include LICENSE | ||
include README.rst | ||
include CHANGES.rst | ||
|
||
include setup.cfg | ||
include pyproject.toml | ||
|
||
global-exclude *.pyc *.o |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
Experimental astronomy plugins for glue | ||
--------------------------------------- | ||
Astronomy plugins for glue | ||
-------------------------- | ||
|
||
.. image:: https://readthedocs.org/projects/glue-astronomy/badge/?version=latest | ||
:target: https://glue-astronomy.readthedocs.io/en/latest/?badge=latest | ||
:alt: Documentation Status | ||
|
||
.. image:: https://dev.azure.com/glue-viz/glue-astronomy/_apis/build/status/glue-viz.glue-astronomy?branchName=main | ||
:target: https://dev.azure.com/glue-viz/glue-astronomy/_build/latest?definitionId=9&branchName=main | ||
:alt: CI Status | ||
|
||
.. image:: https://codecov.io/gh/glue-viz/glue-astronomy/branch/main/graph/badge.svg | ||
:target: https://codecov.io/gh/glue-viz/glue-astronomy | ||
:alt: Coverage Status | ||
|
||
.. image:: https://img.shields.io/pypi/v/glue-astronomy.svg | ||
:target: https://pypi.org/project/glue-astronomy | ||
:alt: PyPI Status | ||
|
||
The glue-astronomy plugin for glue provides a collection of astronomy-specific | ||
functionality. It is currently under heavy development and is not ready for | ||
general use at this point. The documentation for this plugin can be found at | ||
functionality. It is currently under heavy development. | ||
The documentation for this plugin can be found at | ||
https://glue-astronomy.readthedocs.io. |
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -27,15 +27,13 @@ jobs: | |||||||||||
coverage: 'false' | ||||||||||||
|
||||||||||||
- linux: py36-test-casa | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should really drop Python 3.6. I would have done it, except I don't know what CASA is doing there. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
CASATOOLS has wheels for py38, so should be no problem to move to that. |
||||||||||||
- linux: py37-test | ||||||||||||
- linux: py38-test | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
- linux: py38-test-dev | ||||||||||||
- linux: py39-test | ||||||||||||
- linux: py310-test-dev | ||||||||||||
|
||||||||||||
- macos: py36-test-casa | ||||||||||||
- windows: py37-test | ||||||||||||
- macos: py38-test | ||||||||||||
Comment on lines
34
to
36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
- windows: py38-test-dev | ||||||||||||
- windows: py39-test-dev | ||||||||||||
|
||||||||||||
- linux: py36-docs | ||||||||||||
- macos: py37-docs | ||||||||||||
- windows: py38-test | ||||||||||||
- linux: py39-docs |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,52 @@ | ||
import os | ||
import numpy as np | ||
import pytest | ||
from astropy.utils.data import get_pkg_data_filename | ||
from glue.qglue import parse_data | ||
from spectral_cube import SpectralCube | ||
|
||
DATA = os.path.join(os.path.dirname(__file__), 'data') | ||
from glue_astronomy.io.spectral_cube.spectral_cube import is_spectral_cube, read_spectral_cube | ||
|
||
|
||
def test_identifier_fits(): | ||
from ..spectral_cube import is_spectral_cube | ||
assert is_spectral_cube(os.path.join(DATA, 'cube_3d.fits')) | ||
assert is_spectral_cube(get_pkg_data_filename('data/cube_3d.fits')) | ||
|
||
|
||
def test_identifier_casa(): | ||
pytest.importorskip('casatools') | ||
from ..spectral_cube import is_spectral_cube | ||
assert is_spectral_cube(os.path.join(DATA, 'cube_3d.image')) | ||
assert is_spectral_cube(get_pkg_data_filename('data/cube_3d.image')) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately that's the one that has broken the previously skipped casa-test, since There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Whoops... sorry! Should have used https://github.com/astropy/astropy/blob/179fa5fe1a97aaaa43e9d87d44eb366db454a396/astropy/utils/data.py#L892 instead. If you don't open a PR to fix this, I'll try to open one tomorrow when I get the chance. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See astrofrog#1 |
||
|
||
|
||
def test_reader_fits(): | ||
from ..spectral_cube import read_spectral_cube | ||
data = read_spectral_cube(os.path.join(DATA, 'cube_3d.fits')) | ||
data['STOKES I'] | ||
data = read_spectral_cube(get_pkg_data_filename('data/cube_3d.fits')) | ||
assert isinstance(data['STOKES I'], np.ndarray) | ||
assert data.shape == (2, 3, 4) | ||
|
||
|
||
def test_reader_fits_4d(): | ||
from ..spectral_cube import read_spectral_cube | ||
data = read_spectral_cube(os.path.join(DATA, 'cube_4d.fits')) | ||
data['STOKES I'] | ||
data = read_spectral_cube(get_pkg_data_filename('data/cube_4d.fits')) | ||
assert isinstance(data['STOKES I'], np.ndarray) | ||
assert data.shape == (2, 3, 4) | ||
|
||
|
||
def test_reader_fits_4d_fullstokes(): | ||
from ..spectral_cube import read_spectral_cube | ||
data = read_spectral_cube(os.path.join(DATA, 'cube_4d_fullstokes.fits')) | ||
data['STOKES I'] | ||
data['STOKES Q'] | ||
data['STOKES U'] | ||
data['STOKES V'] | ||
data = read_spectral_cube(get_pkg_data_filename('data/cube_4d_fullstokes.fits')) | ||
assert isinstance(data['STOKES I'], np.ndarray) | ||
assert isinstance(data['STOKES Q'], np.ndarray) | ||
assert isinstance(data['STOKES U'], np.ndarray) | ||
assert isinstance(data['STOKES V'], np.ndarray) | ||
assert data.shape == (2, 3, 4) | ||
|
||
|
||
def test_reader_casa(): | ||
pytest.importorskip('casatools') | ||
from ..spectral_cube import read_spectral_cube | ||
data = read_spectral_cube(os.path.join(DATA, 'cube_3d.image')) | ||
data['STOKES I'] | ||
data = read_spectral_cube(get_pkg_data_filename('data/cube_3d.image')) | ||
assert isinstance(data['STOKES I'], np.ndarray) | ||
assert data.shape == (2, 3, 4) | ||
|
||
|
||
def test_qglue(): | ||
from spectral_cube import SpectralCube | ||
cube = SpectralCube.read(os.path.join(DATA, 'cube_3d.fits')) | ||
cube = SpectralCube.read(get_pkg_data_filename('data/cube_3d.fits')) | ||
data = parse_data(cube, 'x')[0] | ||
assert data.label == 'x' | ||
data['flux'] | ||
assert isinstance(data['flux'], np.ndarray) | ||
assert data.shape == (2, 3, 4) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[build-system] | ||
requires = ["setuptools>=30.3.0", | ||
"setuptools_scm", | ||
"wheel"] | ||
build-backend = 'setuptools.build_meta' |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,11 +8,14 @@ license_file = LICENSE | |
url = https://github.com/glue-viz/glue-astronomy | ||
description = Astronomy-specific plugins for glue | ||
long_description = file: README.rst | ||
long_description_content_type = text/x-rst | ||
|
||
[options] | ||
zip_safe = False | ||
packages = find: | ||
python_requires = >=3.6 | ||
setup_requires = | ||
setuptools_scm | ||
install_requires = | ||
astropy>=4.0 | ||
glue-core>=1.0 | ||
|
@@ -29,6 +32,7 @@ docs = | |
sphinx-rtd-theme | ||
test = | ||
pytest | ||
pytest-astropy | ||
pytest-cov | ||
mock | ||
qt = | ||
|
@@ -39,6 +43,17 @@ glue.plugins = | |
glue_astronomy = glue_astronomy:setup | ||
spectral_cube = glue_astronomy.io.spectral_cube:setup | ||
|
||
[options.package_data] | ||
glue_astronomy.io.spectral_cube.tests = data/*, data/*/*, data/*/*/* | ||
|
||
[tool:pytest] | ||
addopts=-p no:logging | ||
doctest_plug = enabled | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like you wanted to use |
||
minversion = 6 | ||
testpaths = docs glue_astronomy | ||
doctest_plus = enabled | ||
xfail_strict = true | ||
filterwarnings = | ||
error | ||
ignore:numpy\.ndarray size changed:RuntimeWarning | ||
|
||
[flake8] | ||
max-line-length = 100 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,6 @@ | ||
#!/usr/bin/env python | ||
|
||
from __future__ import print_function | ||
import os | ||
from setuptools import setup | ||
|
||
import sys | ||
from distutils.version import LooseVersion | ||
|
||
try: | ||
from setuptools import setup, __version__ | ||
assert LooseVersion(__version__) >= LooseVersion('30.3') | ||
except (ImportError, AssertionError): | ||
sys.stderr.write("ERROR: setuptools 30.3 or later is required by glue-plotly\n") | ||
sys.exit(1) | ||
|
||
setup(use_scm_version=True, setup_requires=['setuptools_scm']) | ||
setup(use_scm_version={'write_to': os.path.join('glue_astronomy', 'version.py')}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy paste oversight?