Skip to content

Commit

Permalink
Update package infrastructure to follow APE 17 guidelines
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog committed Apr 2, 2020
1 parent f0959a2 commit fdaba41
Show file tree
Hide file tree
Showing 12 changed files with 193 additions and 167 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@ distribute-*.tar.gz
# Mac OSX
.DS_Store

*.fits
.coverage*

pip-wheel-metadata/
File renamed without changes.
25 changes: 1 addition & 24 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ include README.rst
include CHANGES.md
include LICENSE.md

include pyproject.toml
include setup.py
include setup.cfg

Expand All @@ -17,28 +18,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 ah_bootstrap.py

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
22 changes: 11 additions & 11 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,21 @@ jobs:

- linux: pep8

- macos: py36-test
- macos: py37-test
- macos: py36-test-cov
- macos: py37-test-cov

- linux: py36-test
- linux: py37-test
- linux: py36-test-cov
- linux: py37-test-cov

- linux32: py36-test
- linux32: py37-test
- linux32: py36-test-cov
- linux32: py37-test-cov

- windows: py36-test
- windows: py37-test
- windows: py36-test-cov
- windows: py37-test-cov

- macos: py36-docs
- linux: py37-docs
- macos: py37-docs
- macos: build_docs
- linux: build_docs
- macos: build_docs

- template: publish.yml@OpenAstronomy
parameters:
Expand Down
9 changes: 4 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
[build-system]
requires = ["setuptools",
"setuptools_scm",
"wheel",
"numpy==1.13.3; python_version=='3.5'",
"numpy==1.13.3; python_version=='3.6'",
"numpy==1.14.5; python_version=='3.7'",
"numpy==1.17.3; python_version>='3.8'",
"Cython"]
"extension-helpers",
"oldest-supported-numpy",
"cython==0.29.14"]
build-backend = 'setuptools.build_meta'
6 changes: 1 addition & 5 deletions reproject/_astropy_init.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst

__all__ = ['__version__', '__githash__']
__all__ = ['__version__']

# this indicates whether or not we are in the package's setup.py
try:
Expand All @@ -13,10 +13,6 @@
from .version import version as __version__
except ImportError:
__version__ = ''
try:
from .version import githash as __githash__
except ImportError:
__githash__ = ''


if not _ASTROPY_SETUP_: # noqa
Expand Down
37 changes: 23 additions & 14 deletions reproject/conftest.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
# This file is used to configure the behavior of pytest when using the Astropy
# test infrastructure.
import os
# 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 astropy.tests.plugins.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS
import os

from .version import astropy_helpers_version, version # noqa
try:
from pytest_astropy_header.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS
ASTROPY_HEADER = True
except ImportError:
ASTROPY_HEADER = False

os.environ['MPLBACKEND'] = 'Agg'

# from astropy.tests.helper import enable_deprecations_as_exceptions
# enable_deprecations_as_exceptions()

PYTEST_HEADER_MODULES['Astropy'] = 'astropy'
PYTEST_HEADER_MODULES['astropy-healpix'] = 'astropy_healpix'
PYTEST_HEADER_MODULES['Cython'] = 'cython'
del PYTEST_HEADER_MODULES['h5py']
del PYTEST_HEADER_MODULES['Matplotlib']
def pytest_configure(config):

if ASTROPY_HEADER:

config.option.astropy_header = True

PYTEST_HEADER_MODULES.pop('Pandas', None)
PYTEST_HEADER_MODULES.pop('h5py', None)
PYTEST_HEADER_MODULES.pop('Matplotlib', None)
PYTEST_HEADER_MODULES['Astropy'] = 'astropy'
PYTEST_HEADER_MODULES['astropy-healpix'] = 'astropy_healpix'
PYTEST_HEADER_MODULES['Cython'] = 'cython'

packagename = os.path.basename(os.path.dirname(__file__))
TESTED_VERSIONS[packagename] = version
TESTED_VERSIONS['astropy_helpers'] = astropy_helpers_version
from . import __version__
packagename = os.path.basename(os.path.dirname(__file__))
TESTED_VERSIONS[packagename] = __version__
3 changes: 2 additions & 1 deletion reproject/spherical_intersect/setup_package.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
from distutils.core import Extension
import numpy as np

REPROJECT_ROOT = os.path.relpath(os.path.dirname(__file__))

Expand All @@ -13,7 +14,7 @@ def get_extensions():
sources.append(os.path.join(REPROJECT_ROOT, "overlapArea.c"))
sources.append(os.path.join(REPROJECT_ROOT, "reproject_slice_c.c"))

include_dirs = ['numpy']
include_dirs = [np.get_include()]
include_dirs.append(REPROJECT_ROOT)

# Note that to set the DEBUG variable in the overlapArea.c code, which
Expand Down
31 changes: 0 additions & 31 deletions reproject/tests/coveragerc

This file was deleted.

68 changes: 45 additions & 23 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
[metadata]
package_name = reproject
description = Reproject astronomical images
long_description = file: README.rst
name = reproject
author = Thomas Robitaille, Christoph Deil, Adam Ginsburg
author_email = [email protected]
license = BSD
author_email = [email protected]
license = BSD 3-Clause
license_file = LICENSE
url = https://reproject.readthedocs.io
description = Reproject astronomical images
long_description = file: README.rst
long_description_content_type = text/x-rst
edit_on_github = False
github_project = astropy/reproject
version = 0.6
name = reproject

[options]
zip_safe = False
packages = find:
python_requires = >=3.5
setup_requires = numpy>=1.13
python_requires = >=3.6
setup_requires = setuptools_scm
install_requires =
numpy>=1.13
astropy>=3.2
Expand Down Expand Up @@ -43,27 +43,49 @@ reproject.adaptive.tests = reference/*
reproject.interpolation.tests = reference/*
reproject.mosaicking.tests = reference/*
reproject.spherical_intersect = overlapArea.h, reproject_slice_c.h, mNaN.h
reproject.tests = coveragerc, data/*

[build_sphinx]
source-dir = docs
build-dir = docs/_build
all_files = 1

[upload_docs]
upload-dir = docs/_build/html
show-response = 1
reproject.tests = data/*

[tool:pytest]
minversion = 3.1
testpaths = "reproject" "docs"
norecursedirs = build docs/_build
astropy_header = true
doctest_plus = enabled
addopts = --arraydiff --arraydiff-default-format=fits
text_file_format = rst
addopts = --doctest-rst --arraydiff --arraydiff-default-format=fits

[ah_bootstrap]
auto_use = True
[coverage:run]
omit =
reproject/_astropy_init*
reproject/conftest.py
reproject/*setup_package*
reproject/tests/*
reproject/*/tests/*
reproject/extern/*
reproject/version*
*/reproject/_astropy_init*
*/reproject/conftest.py
*/reproject/*setup_package*
*/reproject/tests/*
*/reproject/*/tests/*
*/reproject/extern/*
*/reproject/version*

[entry_points]
[coverage:report]
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover
# Don't complain about packages we have installed
except ImportError
# Don't complain if tests don't hit assertions
raise AssertionError
raise NotImplementedError
# Don't complain about script hooks
def main\(.*\):
# Ignore branches that don't pertain to this version of Python
pragma: py{ignore_python_version}
# Don't complain about IPython completion helper
def _ipython_key_completions_

[isort]
line_length = 100
Expand Down
Loading

0 comments on commit fdaba41

Please sign in to comment.