Skip to content

Commit

Permalink
Update template to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
nmearl committed Nov 2, 2020
1 parent 35a2011 commit 693a4f2
Show file tree
Hide file tree
Showing 10 changed files with 129 additions and 100 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ docs/_build
.floo
.flooignore

# Visual Studio Code project files
.vscode

# Packages/installer info
*.egg
*.egg-info
Expand Down
43 changes: 29 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,20 +120,24 @@ matrix:
stage: Comprehensive tests
env: TOXENV=py37-test-astropy30-numpy117

# Run tests using external dependencies to e.g. check specific loaders
- os: linux
python: 3.8
name: External dependencies
stage: Comprehensive tests
env: TOXENV=py38-test-external

# Do a code style check
- os: linux
python: 3.8
name: Code style checks
stage: Initial tests
env: TOXENV=codestyle

# Run documentation link check in a cron job.
- language: python
python: 3.8
name: Documentation link check
stage: Cron tests
env: TOXENV=linkcheck
addons:
apt:
packages:
- graphviz

allow_failures:
# Do a PEP8 test with flake8
# (do allow to fail unless your code completely compliant)
Expand All @@ -143,6 +147,13 @@ matrix:
# stage: Initial tests
# env: TOXENV=codestyle


before_install:
# Create a coverage.xml for use by coveralls or codecov
- if [[ $TOXENV == *-cov ]]; then
export TOXPOSARGS=$TOXPOSARGS" --cov-report=xml:"$TRAVIS_BUILD_DIR"/coverage.xml";
fi

install:

# We now use the ci-helpers package to set up our Python environment
Expand All @@ -152,7 +163,7 @@ install:

- if [[ $TRAVIS_OS_NAME != linux ]]; then
git clone --depth 1 git://github.com/astropy/ci-helpers.git;
source ci-helpers/travis/setup_conda.sh;
source ci-helpers/travis/setup_python.sh;
fi

script:
Expand All @@ -161,9 +172,13 @@ script:
- tox $TOXARGS -- $TOXPOSARGS

after_success:
# If coveralls.io is set up for this package, uncomment the two lines below.
# pip install coveralls
# coveralls
# If codecov is set up for this package, uncomment the two lines below
# pip install codecov
# codecov
# if either coveralls or codecov is used, uncomment the if and fi statements
# and the appropriate two lines inside the if statement
# - if [[ $TOXENV == *-cov ]]; then
# # If coveralls.io is set up for this package, uncomment the two lines below.
# pip install coveralls;
# coveralls;
# # If codecov is set up for this package, uncomment the two lines below
# pip install codecov;
# codecov;
# fi
16 changes: 14 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
#needs_sphinx = '1.2'

# To perform a Sphinx version check that needs to be more specific than
# major.minor, call `check_sphinx_version("x.y.z")` here.
# major.minor, call `check_sphinx_version("X.Y.Z")` here.
# check_sphinx_version("1.2.1")

# Include other packages to link against
Expand Down Expand Up @@ -142,6 +142,9 @@
# Output file base name for HTML help builder.
htmlhelp_basename = project + 'doc'

# Prefixes that are ignored for sorting the Python module index
modindex_common_prefix = ["specutils."]


# -- Options for LaTeX output -------------------------------------------------

Expand Down Expand Up @@ -174,6 +177,15 @@
# -- Resolving issue number to links in changelog -----------------------------
github_issues_url = 'https://github.com/{0}/issues/'.format(setup_cfg['github_project'])


# -- Options for linkcheck output -------------------------------------------
linkcheck_retry = 5
linkcheck_ignore = [
r'https://github\.com/astropy/specutils/(?:issues|pull)/\d+',
]
linkcheck_timeout = 180
linkcheck_anchors = False

# -- Turn on nitpicky mode for sphinx (to warn about references not found) ----
#
nitpicky = True
Expand All @@ -198,4 +210,4 @@
continue
dtype, target = line.split(None, 1)
target = target.strip()
nitpick_ignore.append((dtype, target))
nitpick_ignore.append((dtype, six.u(target)))
45 changes: 23 additions & 22 deletions licenses/LICENSE.rst
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
Copyright (c) 2020, Specutils Developers
All rights reserved.
Copyright 2020 Specutils Developers

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
* Neither the name of the Astropy Team nor the names of its contributors may be
used to endorse or promote products derived from this software without
specific prior written permission.
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2 changes: 1 addition & 1 deletion licenses/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ Licenses
This directory holds license and credit information for the package,
works the package is derived from, and/or datasets.

Ensure that you pick a package licence which is in this folder and it matches
Ensure that you pick a package license which is in this folder and it matches
the one mentioned in the top level README.rst file. If you are using the
pre-rendered version of this template check for the word 'Other' in the README.
4 changes: 2 additions & 2 deletions licenses/TEMPLATE_LICENCE.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
This project is based upon the Astropy package template
(https://github.com/astropy/package-template/) which is licenced under the terms
of the following licence.
(https://github.com/astropy/package-template/) which is licensed under the terms
of the following license.

---

Expand Down
2 changes: 1 addition & 1 deletion specutils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Packages may add whatever they like to this file, but
# should keep this content at the top.
# ----------------------------------------------------------------------------
from ._astropy_init import *
from ._astropy_init import * # noqa
from astropy import config as _config
# ----------------------------------------------------------------------------

Expand Down
6 changes: 1 addition & 5 deletions specutils/_astropy_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
try:
_ASTROPY_SETUP_
except NameError:
from sys import version_info
if version_info[0] >= 3:
import builtins
else:
import __builtin__ as builtins
import builtins
builtins._ASTROPY_SETUP_ = False

try:
Expand Down
102 changes: 50 additions & 52 deletions specutils/conftest.py
Original file line number Diff line number Diff line change
@@ -1,57 +1,55 @@
# 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.
# 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
# packagename.test

from importlib.util import find_spec
import os

from astropy.version import version as astropy_version
from astropy.tests.plugins.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS
from astropy.tests.helper import enable_deprecations_as_exceptions

## Uncomment the following line to treat all DeprecationWarnings as
## exceptions
enable_deprecations_as_exceptions()

# Uncomment and customize the following lines to add/remove entries from
# the list of packages for which version numbers are displayed when running
# the tests. Making it pass for KeyError is essential in some cases when
# the package uses other astropy affiliated packages.
try:
PYTEST_HEADER_MODULES['Astropy'] = 'astropy'
PYTEST_HEADER_MODULES['gwcs'] = 'gwcs'
del PYTEST_HEADER_MODULES['h5py']
del PYTEST_HEADER_MODULES['Pandas']
del PYTEST_HEADER_MODULES['Matplotlib']
except (NameError, KeyError): # NameError is needed to support Astropy < 1.0
pass

# Use ASDF schema tester plugin if ASDF is installed
if find_spec('asdf') is not None:
PYTEST_HEADER_MODULES['Asdf'] = 'asdf'

# Uncomment the following lines to display the version number of the
# package rather than the version number of Astropy in the top line when
# running the tests.
import os

# This is to figure out the affiliated package version, rather than
# using Astropy's
try:
from .version import version
except ImportError:
version = 'dev'

try:
packagename = os.path.basename(os.path.dirname(__file__))
TESTED_VERSIONS[packagename] = version
except NameError: # Needed to support Astropy <= 1.0.0
pass


# makes sure matplotlib doesn't try to pop up plots
try:
import matplotlib
except ImportError:
pass
# 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:
matplotlib.use('Agg')
try:
from pytest_astropy_header.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS
ASTROPY_HEADER = True
except ImportError:
ASTROPY_HEADER = False


def pytest_configure(config):

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['gwcs'] = 'gwcs'
del PYTEST_HEADER_MODULES['h5py']
del PYTEST_HEADER_MODULES['Matplotlib']
# Use ASDF schema tester plugin if ASDF is installed
from importlib.util import find_spec
if find_spec('asdf') is not None:
PYTEST_HEADER_MODULES['Asdf'] = 'asdf'

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()
6 changes: 5 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ requires =
setuptools >= 30.3.0
pip >= 19.3.1
isolated_build = true
indexserver =
NIGHTLY = https://pypi.anaconda.org/scipy-wheels-nightly/simple

[testenv]
# Suppress display of matplotlib plots generated during docs build
setenv =
MPLBACKEND=agg
# Disable the accelerate linear algebra library when running on macos as
# latest numpy versions do not work with it
NPY_BLAS_ORDER=
Expand Down Expand Up @@ -59,7 +63,7 @@ deps =
astropy40: astropy==4.0.*
astropylts: astropy==4.0.*

devdeps: git+https://github.com/numpy/numpy.git#egg=numpy
devdeps: :NIGHTLY:numpy
devdeps: git+https://github.com/astropy/astropy.git#egg=astropy

external: asdf
Expand Down

0 comments on commit 693a4f2

Please sign in to comment.