Skip to content

Commit 193b635

Browse files
Adrian DamianAdrian Damian
authored andcommitted
First attempt
1 parent b830403 commit 193b635

File tree

13 files changed

+235
-356
lines changed

13 files changed

+235
-356
lines changed

.github/workflows/cibuild.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,23 @@ jobs:
6767
- name: Python 3.8 with latest astropy
6868
run: tox -e py38-latest
6969

70+
docs:
71+
runs-on: ubuntu-latest
72+
needs: tests
73+
steps:
74+
- uses: actions/checkout@v2
75+
- name: Set up Python 3.8
76+
uses: actions/setup-python@v2
77+
with:
78+
python-version: 3.8
79+
- name: Setup Graphviz
80+
uses: ts-graphviz/setup-graphviz@v1
81+
- name: Install tox
82+
run: python -m pip install --upgrade tox
83+
- name: Check docs
84+
run: tox -e build_docs
85+
- name: Check links
86+
run: tox -e linkcheck
7087

7188
style_coverage:
7289
runs-on: ubuntu-latest

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ sdist
4242
develop-eggs
4343
.installed.cfg
4444
distribute-*.tar.gz
45+
pip-wheel-metadata
4546

4647
# Other
4748
.cache

MANIFEST.in

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ include CHANGES.rst
44
include ez_setup.py
55
include ah_bootstrap.py
66
include setup.cfg
7+
include pyproject.toml
78

89
recursive-include packagename *.pyx *.c *.pxd
910
recursive-include docs *
@@ -15,26 +16,4 @@ prune build
1516
prune docs/_build
1617
prune docs/api
1718

18-
19-
# the next few stanzas are for astropy_helpers. It's derived from the
20-
# astropy_helpers/MANIFEST.in, but requires additional includes for the actual
21-
# package directory and egg-info.
22-
23-
include astropy_helpers/README.rst
24-
include astropy_helpers/CHANGES.rst
25-
include astropy_helpers/LICENSE.rst
26-
recursive-include astropy_helpers/licenses *
27-
28-
include astropy_helpers/ez_setup.py
29-
include astropy_helpers/ah_bootstrap.py
30-
31-
recursive-include astropy_helpers/astropy_helpers *.py *.pyx *.c *.h
32-
recursive-include astropy_helpers/astropy_helpers.egg-info *
33-
# include the sphinx stuff with "*" because there are css/html/rst/etc.
34-
recursive-include astropy_helpers/astropy_helpers/sphinx *
35-
36-
prune astropy_helpers/build
37-
prune astropy_helpers/astropy_helpers/tests
38-
39-
4019
global-exclude *.pyc *.o

conftest.py

Lines changed: 0 additions & 34 deletions
This file was deleted.

docs/conf.py

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,15 @@
2929
import os
3030
import sys
3131

32+
sys.path.insert(0, os.path.abspath('..'))
3233
try:
33-
import astropy_helpers
34+
from sphinx_astropy.conf.v1 import * # noqa
3435
except ImportError:
35-
# Building from inside the docs/ directory?
36-
if os.path.basename(os.getcwd()) == 'docs':
37-
a_h_path = os.path.abspath(os.path.join('..', 'astropy_helpers'))
38-
if os.path.isdir(a_h_path):
39-
sys.path.insert(1, a_h_path)
40-
41-
# Load all of the global Astropy configuration
42-
from sphinx_astropy.conf import *
36+
print('ERROR: the documentation requires the sphinx-astropy package to be installed')
37+
sys.exit(1)
4338

4439
# Get configuration information from setup.cfg
45-
try:
46-
from ConfigParser import ConfigParser
47-
except ImportError:
48-
from configparser import ConfigParser
40+
from configparser import ConfigParser
4941
conf = ConfigParser()
5042
conf.read([os.path.join(os.path.dirname(__file__), '..', 'setup.cfg')])
5143
setup_cfg = dict(conf.items('metadata'))
@@ -77,7 +69,7 @@
7769
# -- Project information ------------------------------------------------------
7870

7971
# This does not *have* to match the package name, but typically does
80-
project = setup_cfg['package_name']
72+
project = setup_cfg['name']
8173
author = setup_cfg['author']
8274
copyright = '{}, {}'.format(
8375
datetime.datetime.now().year, setup_cfg['author'])
@@ -86,8 +78,8 @@
8678
# |version| and |release|, also used in various other places throughout the
8779
# built documents.
8880

89-
__import__(setup_cfg['package_name'])
90-
package = sys.modules[setup_cfg['package_name']]
81+
__import__(project)
82+
package = sys.modules[project]
9183

9284
# The short X.Y version.
9385
version = package.__version__.split('-', 1)[0]
@@ -153,7 +145,7 @@
153145
if eval(setup_cfg.get('edit_on_github')):
154146
extensions += ['astropy.sphinx.ext.edit_on_github']
155147

156-
versionmod = __import__(setup_cfg['package_name'] + '.version')
148+
versionmod = __import__(project + '.version')
157149
edit_on_github_project = setup_cfg['github_project']
158150
if versionmod.release:
159151
edit_on_github_branch = "v" + versionmod.version

pyproject.toml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
[tool.astropy-bot]
1+
[build-system]
22

3-
[tool.astropy-bot.changelog_checker]
4-
filename = "CHANGES.rst"
3+
requires = ["setuptools",
4+
"setuptools_scm",
5+
"wheel",
6+
"extension-helpers",
7+
"oldest-supported-numpy",
8+
"cython==0.29.14"]
9+
10+
build-backend = 'setuptools.build_meta'

pyvo/__init__.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,11 @@
3333
# ----------------------------------------------------------------------------
3434

3535
# For egg_info test builds to pass, put package imports here.
36-
if not _ASTROPY_SETUP_:
37-
from . import registry
38-
from .dal import ssa, sia, sla, scs, tap
39-
from . import auth
40-
from .registry import search as regsearch
41-
from .dal import (
42-
imagesearch, spectrumsearch, conesearch, linesearch, tablesearch,
43-
DALAccessError, DALProtocolError, DALFormatError, DALServiceError,
44-
DALQueryError)
36+
from . import registry
37+
from .dal import ssa, sia, sla, scs, tap
38+
from . import auth
39+
from .registry import search as regsearch
40+
from .dal import (
41+
imagesearch, spectrumsearch, conesearch, linesearch, tablesearch,
42+
DALAccessError, DALProtocolError, DALFormatError, DALServiceError,
43+
DALQueryError)

pyvo/_astropy_init.py

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,13 @@
11
# Licensed under a 3-clause BSD style license - see LICENSE.rst
2+
import os
23

3-
__all__ = ['__version__', '__githash__']
4-
5-
# this indicates whether or not we are in the package's setup.py
6-
try:
7-
_ASTROPY_SETUP_
8-
except NameError:
9-
import builtins
10-
builtins._ASTROPY_SETUP_ = False
4+
__all__ = ['__version__', 'test']
115

126
try:
137
from .version import version as __version__
148
except ImportError:
159
__version__ = ''
16-
try:
17-
from .version import githash as __githash__
18-
except ImportError:
19-
__githash__ = ''
20-
21-
22-
if not _ASTROPY_SETUP_: # noqa
23-
import os
2410

25-
# Create the test function for self test
26-
from astropy.tests.runner import TestRunner
27-
test = TestRunner.make_test_runner_in(os.path.dirname(__file__))
28-
test.__test__ = False
29-
__all__ += ['test']
11+
# Create the test function for self test
12+
from astropy.tests.runner import TestRunner
13+
test = TestRunner.make_test_runner_in(os.path.dirname(__file__))

pyvo/conftest.py

Lines changed: 54 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,59 @@
1-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
2-
import os
3-
from distutils.version import LooseVersion
4-
# this contains imports plugins that configure py.test for astropy tests.
5-
# by importing them here in conftest.py they are discoverable by py.test
6-
# no matter how it is invoked within the source tree.
7-
8-
from astropy.version import version as astropy_version
9-
10-
if LooseVersion(astropy_version) < LooseVersion('2.0.3'):
11-
# Astropy is not compatible with the standalone plugins prior this while
12-
# astroquery requires them, so we need this workaround. This will mess
13-
# up the test header, but everything else will work.
14-
from astropy.tests.pytest_plugins import (PYTEST_HEADER_MODULES,
15-
enable_deprecations_as_exceptions,
16-
TESTED_VERSIONS)
17-
elif astropy_version < '3.0':
18-
# With older versions of Astropy, we actually need to import the pytest
19-
# plugins themselves in order to make them discoverable by pytest.
20-
from astropy.tests.pytest_plugins import *
21-
else:
22-
# As of Astropy 3.0, the pytest plugins provided by Astropy are
23-
# automatically made available when Astropy is installed. This means it's
24-
# not necessary to import them here, but we still need to import global
25-
# variables that are used for configuration.
26-
from pytest_astropy_header.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS
27-
28-
from astropy.tests.helper import enable_deprecations_as_exceptions
1+
"""Configure Test Suite.
292
30-
# Add astropy to test header information and remove unused packages.
31-
# Pytest header customisation was introduced in astropy 1.0.
3+
This file is used to configure the behavior of pytest when using the Astropy
4+
test infrastructure. It needs to live inside the package in order for it to
5+
get picked up when running the tests inside an interpreter using
6+
`pyvo.test()`.
327
33-
try:
34-
PYTEST_HEADER_MODULES['Astropy'] = 'astropy'
35-
del PYTEST_HEADER_MODULES['h5py']
36-
del PYTEST_HEADER_MODULES['Scipy']
37-
del PYTEST_HEADER_MODULES['Matplotlib']
38-
del PYTEST_HEADER_MODULES['Pandas']
39-
except (NameError, KeyError):
40-
pass
8+
"""
419

42-
enable_deprecations_as_exceptions()
43-
44-
45-
46-
# This is to figure out the affiliated package version, rather than
47-
# using Astropy's
48-
from .version import version, astropy_helpers_version
10+
import os
4911

12+
from astropy.version import version as astropy_version
5013

51-
packagename = os.path.basename(os.path.dirname(__file__))
52-
TESTED_VERSIONS[packagename] = version
53-
TESTED_VERSIONS['astropy_helpers'] = astropy_helpers_version
14+
# For Astropy 3.0 and later, we can use the standalone pytest plugin
15+
if astropy_version < '3.0':
16+
from astropy.tests.pytest_plugins import * # noqa
17+
del pytest_report_header
18+
ASTROPY_HEADER = True
19+
else:
20+
try:
21+
from pytest_astropy_header.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS
22+
ASTROPY_HEADER = True
23+
except ImportError:
24+
ASTROPY_HEADER = False
25+
26+
27+
def pytest_configure(config):
28+
"""Configure Pytest with Astropy.
29+
30+
Parameters
31+
----------
32+
config : pytest configuration
33+
34+
"""
35+
if ASTROPY_HEADER:
36+
37+
config.option.astropy_header = True
38+
39+
# Customize the following lines to add/remove entries from the list of
40+
# packages for which version numbers are displayed when running the tests.
41+
PYTEST_HEADER_MODULES.pop('Pandas', None)
42+
PYTEST_HEADER_MODULES['scikit-image'] = 'skimage'
43+
44+
from . import __version__
45+
packagename = os.path.basename(os.path.dirname(__file__))
46+
TESTED_VERSIONS[packagename] = __version__
47+
48+
# Uncomment the last two lines in this block to treat all DeprecationWarnings as
49+
# exceptions. For Astropy v2.0 or later, there are 2 additional keywords,
50+
# as follow (although default should work for most cases).
51+
# To ignore some packages that produce deprecation warnings on import
52+
# (in addition to 'compiler', 'scipy', 'pygments', 'ipykernel', and
53+
# 'setuptools'), add:
54+
# modules_to_ignore_on_import=['module_1', 'module_2']
55+
# To ignore some specific deprecation warning messages for Python version
56+
# MAJOR.MINOR or later, add:
57+
# warnings_to_ignore_by_pyver={(MAJOR, MINOR): ['Message to ignore']}
58+
# from astropy.tests.helper import enable_deprecations_as_exceptions # noqa
59+
# enable_deprecations_as_exceptions()

pyvo/tests/coveragerc

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)