Skip to content

Commit

Permalink
Merge pull request #103 from pllim/conf-cleanup
Browse files Browse the repository at this point in the history
MNT: Clean up of conf.py and conftest.py
  • Loading branch information
mwcraig committed Dec 31, 2019
2 parents 54e8c15 + 22eff2c commit 48b368c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 68 deletions.
66 changes: 22 additions & 44 deletions astrowidgets/conftest.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,22 @@
# This file is used to configure the behavior of pytest when using the Astropy
# test infrastructure.
import os

from astropy.version import version as astropy_version
if 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 astropy.tests.plugins.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS

from astropy.tests.helper import enable_deprecations_as_exceptions
try:
from pytest_astropy_header.display import (PYTEST_HEADER_MODULES,
TESTED_VERSIONS)
except ImportError:
PYTEST_HEADER_MODULES = {}

## Uncomment the following line 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']}
# Uncomment the following line to treat all DeprecationWarnings as
# exceptions.
# from astropy.tests.helper import enable_deprecations_as_exceptions # noqa
# 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.
# 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['Ginga'] = 'ginga'
Expand All @@ -39,20 +25,12 @@
except KeyError:
pass

## 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 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
# 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.
try:
from .version import version
except ImportError:
version = 'unknown'
packagename = os.path.basename(os.path.dirname(__file__))
TESTED_VERSIONS[packagename] = version
38 changes: 14 additions & 24 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import datetime
import os
import sys
from pkg_resources import get_distribution

try:
from sphinx_astropy.conf.v1 import * # noqa
Expand All @@ -48,15 +49,15 @@
highlight_language = 'python3'

# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.2'
# 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.
# check_sphinx_version("1.2.1")

# 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.append('_templates') # noqa

# This is added to the end of RST files - a good place to put substitutions to
# be used globally.
Expand All @@ -68,21 +69,16 @@
# This does not *have* to match the package name, but typically does
project = setup_cfg['name']
author = setup_cfg['author']
copyright = '{0}, {1}'.format(
datetime.datetime.now().year, setup_cfg['author'])
copyright = '{0}, {1}'.format(datetime.datetime.now().year, author)

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.

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

# The short X.Y version.
version = package.__version__.split('-', 1)[0]
# The full version, including alpha/beta/rc tags.
release = package.__version__

release = get_distribution(project).version
# The short X.Y version.
version = '.'.join(release.split('.')[:2])

# -- Options for HTML output --------------------------------------------------

Expand All @@ -93,39 +89,36 @@
# variables set in the global configuration. The variables set in the
# global configuration are listed below, commented out.


# Add any paths that contain custom themes here, relative to this directory.
# To use a different custom theme, add the directory containing the theme.
#html_theme_path = []
# html_theme_path = []

# 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 = None

html_theme_options = {
'logotext1': 'astro', # white, semi-bold
'logotext2': 'widgets', # orange, light
'logotext3': ':docs' # white, light
}

}

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

# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = ''
# html_logo = ''

# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = ''
# html_favicon = ''

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = ''
# html_last_updated_fmt = ''

# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
Expand All @@ -134,23 +127,20 @@
# Output file base name for HTML help builder.
htmlhelp_basename = project + 'doc'


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

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [('index', project + '.tex', project + u' Documentation',
author, 'manual')]


# -- Options for manual page output -------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [('index', project.lower(), project + u' Documentation',
[author], 1)]


# -- Options for the edit_on_github extension ---------------------------------

# if eval(setup_cfg.get('edit_on_github')):
Expand Down

0 comments on commit 48b368c

Please sign in to comment.