Skip to content

Commit

Permalink
First attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Damian authored and Adrian Damian committed Jan 18, 2022
1 parent b830403 commit 193b635
Show file tree
Hide file tree
Showing 13 changed files with 235 additions and 356 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/cibuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,23 @@ jobs:
- name: Python 3.8 with latest astropy
run: tox -e py38-latest

docs:
runs-on: ubuntu-latest
needs: tests
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v1
- name: Install tox
run: python -m pip install --upgrade tox
- name: Check docs
run: tox -e build_docs
- name: Check links
run: tox -e linkcheck

style_coverage:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ sdist
develop-eggs
.installed.cfg
distribute-*.tar.gz
pip-wheel-metadata

# Other
.cache
Expand Down
23 changes: 1 addition & 22 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ include CHANGES.rst
include ez_setup.py
include ah_bootstrap.py
include setup.cfg
include pyproject.toml

recursive-include packagename *.pyx *.c *.pxd
recursive-include docs *
Expand All @@ -15,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
34 changes: 0 additions & 34 deletions conftest.py

This file was deleted.

26 changes: 9 additions & 17 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,15 @@
import os
import sys

sys.path.insert(0, os.path.abspath('..'))
try:
import astropy_helpers
from sphinx_astropy.conf.v1 import * # noqa
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 sphinx_astropy.conf import *
print('ERROR: the documentation requires the sphinx-astropy package to be installed')
sys.exit(1)

# Get configuration information from setup.cfg
try:
from ConfigParser import ConfigParser
except ImportError:
from configparser import ConfigParser
from configparser import ConfigParser
conf = ConfigParser()
conf.read([os.path.join(os.path.dirname(__file__), '..', 'setup.cfg')])
setup_cfg = dict(conf.items('metadata'))
Expand Down Expand Up @@ -77,7 +69,7 @@
# -- Project information ------------------------------------------------------

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

__import__(setup_cfg['package_name'])
package = sys.modules[setup_cfg['package_name']]
__import__(project)
package = sys.modules[project]

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

versionmod = __import__(setup_cfg['package_name'] + '.version')
versionmod = __import__(project + '.version')
edit_on_github_project = setup_cfg['github_project']
if versionmod.release:
edit_on_github_branch = "v" + versionmod.version
Expand Down
12 changes: 9 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
[tool.astropy-bot]
[build-system]

[tool.astropy-bot.changelog_checker]
filename = "CHANGES.rst"
requires = ["setuptools",
"setuptools_scm",
"wheel",
"extension-helpers",
"oldest-supported-numpy",
"cython==0.29.14"]

build-backend = 'setuptools.build_meta'
17 changes: 8 additions & 9 deletions pyvo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,11 @@
# ----------------------------------------------------------------------------

# For egg_info test builds to pass, put package imports here.
if not _ASTROPY_SETUP_:
from . import registry
from .dal import ssa, sia, sla, scs, tap
from . import auth
from .registry import search as regsearch
from .dal import (
imagesearch, spectrumsearch, conesearch, linesearch, tablesearch,
DALAccessError, DALProtocolError, DALFormatError, DALServiceError,
DALQueryError)
from . import registry
from .dal import ssa, sia, sla, scs, tap
from . import auth
from .registry import search as regsearch
from .dal import (
imagesearch, spectrumsearch, conesearch, linesearch, tablesearch,
DALAccessError, DALProtocolError, DALFormatError, DALServiceError,
DALQueryError)
26 changes: 5 additions & 21 deletions pyvo/_astropy_init.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,13 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import os

__all__ = ['__version__', '__githash__']

# this indicates whether or not we are in the package's setup.py
try:
_ASTROPY_SETUP_
except NameError:
import builtins
builtins._ASTROPY_SETUP_ = False
__all__ = ['__version__', 'test']

try:
from .version import version as __version__
except ImportError:
__version__ = ''
try:
from .version import githash as __githash__
except ImportError:
__githash__ = ''


if not _ASTROPY_SETUP_: # noqa
import os

# Create the test function for self test
from astropy.tests.runner import TestRunner
test = TestRunner.make_test_runner_in(os.path.dirname(__file__))
test.__test__ = False
__all__ += ['test']
# Create the test function for self test
from astropy.tests.runner import TestRunner
test = TestRunner.make_test_runner_in(os.path.dirname(__file__))
102 changes: 54 additions & 48 deletions pyvo/conftest.py
Original file line number Diff line number Diff line change
@@ -1,53 +1,59 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
from distutils.version import LooseVersion
# this contains imports plugins that configure py.test for astropy tests.
# 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.version import version as astropy_version

if LooseVersion(astropy_version) < LooseVersion('2.0.3'):
# Astropy is not compatible with the standalone plugins prior this while
# astroquery requires them, so we need this workaround. This will mess
# up the test header, but everything else will work.
from astropy.tests.pytest_plugins import (PYTEST_HEADER_MODULES,
enable_deprecations_as_exceptions,
TESTED_VERSIONS)
elif astropy_version < '3.0':
# With older versions of Astropy, we actually need to import the pytest
# plugins themselves in order to make them discoverable by pytest.
from astropy.tests.pytest_plugins import *
else:
# As of Astropy 3.0, the pytest plugins provided by Astropy are
# automatically made available when Astropy is installed. This means it's
# not necessary to import them here, but we still need to import global
# variables that are used for configuration.
from pytest_astropy_header.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS

from astropy.tests.helper import enable_deprecations_as_exceptions
"""Configure Test Suite.
# Add astropy to test header information and remove unused packages.
# Pytest header customisation was introduced in astropy 1.0.
This file is used to configure the behavior of pytest when using the Astropy
test infrastructure. It needs to live inside the package in order for it to
get picked up when running the tests inside an interpreter using
`pyvo.test()`.
try:
PYTEST_HEADER_MODULES['Astropy'] = 'astropy'
del PYTEST_HEADER_MODULES['h5py']
del PYTEST_HEADER_MODULES['Scipy']
del PYTEST_HEADER_MODULES['Matplotlib']
del PYTEST_HEADER_MODULES['Pandas']
except (NameError, KeyError):
pass
"""

enable_deprecations_as_exceptions()



# This is to figure out the affiliated package version, rather than
# using Astropy's
from .version import version, astropy_helpers_version
import os

from astropy.version import version as astropy_version

packagename = os.path.basename(os.path.dirname(__file__))
TESTED_VERSIONS[packagename] = version
TESTED_VERSIONS['astropy_helpers'] = astropy_helpers_version
# For Astropy 3.0 and later, we can use the standalone pytest plugin
if astropy_version < '3.0':
from astropy.tests.pytest_plugins import * # noqa
del pytest_report_header
ASTROPY_HEADER = True
else:
try:
from pytest_astropy_header.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS
ASTROPY_HEADER = True
except ImportError:
ASTROPY_HEADER = False


def pytest_configure(config):
"""Configure Pytest with Astropy.
Parameters
----------
config : pytest configuration
"""
if ASTROPY_HEADER:

config.option.astropy_header = True

# Customize the following lines to add/remove entries from the list of
# packages for which version numbers are displayed when running the tests.
PYTEST_HEADER_MODULES.pop('Pandas', None)
PYTEST_HEADER_MODULES['scikit-image'] = 'skimage'

from . import __version__
packagename = os.path.basename(os.path.dirname(__file__))
TESTED_VERSIONS[packagename] = __version__

# Uncomment the last two lines in this block to treat all DeprecationWarnings as
# exceptions. For Astropy v2.0 or later, there are 2 additional keywords,
# as follow (although default should work for most cases).
# To ignore some packages that produce deprecation warnings on import
# (in addition to 'compiler', 'scipy', 'pygments', 'ipykernel', and
# 'setuptools'), add:
# modules_to_ignore_on_import=['module_1', 'module_2']
# To ignore some specific deprecation warning messages for Python version
# MAJOR.MINOR or later, add:
# warnings_to_ignore_by_pyver={(MAJOR, MINOR): ['Message to ignore']}
# from astropy.tests.helper import enable_deprecations_as_exceptions # noqa
# enable_deprecations_as_exceptions()
31 changes: 0 additions & 31 deletions pyvo/tests/coveragerc

This file was deleted.

Loading

0 comments on commit 193b635

Please sign in to comment.