Skip to content

Commit

Permalink
MNT: Infrastructure update
Browse files Browse the repository at this point in the history
  • Loading branch information
pllim committed Mar 26, 2020
1 parent b2a7ab6 commit 9380248
Show file tree
Hide file tree
Showing 16 changed files with 186 additions and 144 deletions.
2 changes: 2 additions & 0 deletions .bandit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
exclude_dirs:
- acstools/tests
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ sdist
develop-eggs
.installed.cfg
distribute-*.tar.gz
pip-wheel-metadata/
acstools/version.py

# Other
.cache
Expand Down
5 changes: 3 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ python:
version: 3.7
system_packages: true
install:
- requirements: doc/rtd-pip-requirements
- method: setuptools
- method: pip
path: .
extra_requirements:
- docs

# Don't build any extra formats
formats: []
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
See https://github.com/spacetelescope/acstools/releases
19 changes: 6 additions & 13 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,18 @@ bc1.name = "release"
// Would be nice if Jenkins can access /grp/hst/cdbs/xxxx directly.
bc1.env_vars = ['TEST_BIGDATA=https://bytesalad.stsci.edu/artifactory']
bc1.conda_channels = ['http://ssb.stsci.edu/astroconda']
bc1.conda_packages = ['python=3.6',
'requests',
'numpy',
'matplotlib',
'scipy',
'stsci.tools']
bc1.build_cmds = ["pip install scikit-image ci-watson",
"python setup.py install"]
bc1.conda_packages = ['python=3.6']
bc1.build_cmds = ["pip install -e .[test,all]"]
bc1.test_cmds = ["pytest --basetemp=tests_output --junitxml results.xml --bigdata -v"]
bc1.failedUnstableThresh = 1
bc1.failedFailureThresh = 6

// Run with astropy dev and Python 3.7
// Run with astropy dev and Python 3.8
bc2 = utils.copy(bc1)
bc2.name = "dev"
bc2.conda_packages[0] = "python=3.7"
bc2.build_cmds = ["pip install scikit-image ci-watson",
"pip install git+https://github.com/astropy/astropy.git#egg=astropy --upgrade --no-deps",
"python setup.py install"]
bc2.conda_packages[0] = "python=3.8"
bc2.build_cmds = ["pip install git+https://github.com/astropy/astropy.git#egg=astropy --upgrade --no-deps",
"pip install -e [test,all]"]

// Iterate over configurations that define the (distibuted) build matrix.
// Spawn a host of the given nodetype for each combination and run in parallel.
Expand Down
19 changes: 6 additions & 13 deletions JenkinsfileRT
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,18 @@ bc.name = "release"
bc.env_vars = ['TEST_BIGDATA=https://bytesalad.stsci.edu/artifactory',
'jref=/grp/hst/cdbs/jref/']
bc.conda_channels = ['http://ssb.stsci.edu/astroconda']
bc.conda_packages = ['python=3.6',
'requests',
'numpy',
'matplotlib',
'scipy',
'stsci.tools']
bc.build_cmds = ["pip install scikit-image ci-watson",
"python setup.py install"]
bc.conda_packages = ['python=3.6']
bc.build_cmds = ["pip install -e .[test,all]"]
bc.test_cmds = ["pytest --basetemp=tests_output --junitxml results.xml --bigdata --slow -v"]
bc.failedUnstableThresh = 1
bc.failedFailureThresh = 6

// Astropy dev and Python 3.7
// Astropy dev and Python 3.8
bc1 = utils.copy(bc)
bc1.name = "dev"
bc1.conda_packages[0] = "python=3.7"
bc1.build_cmds = ["pip install scikit-image",
"pip install git+https://github.com/astropy/astropy.git#egg=astropy --upgrade --no-deps",
"python setup.py install"]
bc1.conda_packages[0] = "python=3.8"
bc1.build_cmds = ["pip install git+https://github.com/astropy/astropy.git#egg=astropy --upgrade --no-deps",
"pip install -e [test,all]"]

// Iterate over configurations that define the (distributed) build matrix.
// Spawn a host (or workdir) for each combination and run in parallel.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2018, Space Telescope Science Institute, AURA
Copyright (c) 2020, Space Telescope Science Institute, AURA
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
include README.rst
include LICENSE.txt
include CHANGES.rst
include setup.cfg
include pyproject.toml
recursive-include doc *

prune build
Expand Down
44 changes: 17 additions & 27 deletions acstools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,21 @@
"""The acstools package holds Python tasks useful for analyzing ACS data.
These tasks include:
Utility and library functions used by these tasks are also included in this
module.
"""
from pkg_resources import get_distribution, DistributionNotFound


"""The acstools package holds Python tasks useful for analyzing ACS data."""
try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
from .version import version as __version__
except ImportError:
# package is not installed
__version__ = 'unknown'
__version__ = ''


from . import acs_destripe
from . import acs_destripe_plus
from . import calacs
from . import acsccd
from . import acscte
from . import acscteforwardmodel
from . import acs2d
from . import acsrej
from . import acssum
from . import acszpt
from . import acsphotcte
from . import satdet
from . import utils_calib
from . import acs_destripe # noqa
from . import acs_destripe_plus # noqa
from . import calacs # noqa
from . import acsccd # noqa
from . import acscte # noqa
from . import acscteforwardmodel # noqa
from . import acs2d # noqa
from . import acsrej # noqa
from . import acssum # noqa
from . import acszpt # noqa
from . import acsphotcte # noqa
from . import satdet # noqa
from . import utils_calib # noqa
44 changes: 39 additions & 5 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@ trigger:
- master

jobs:
- job: 'EggInfo'
- job: 'PEP517'
pool:
vmImage: 'Ubuntu-16.04'

steps:
- task: UsePythonVersion@0

# Make sure that egg_info works without dependencies
# Make sure that packaging will work
- script: |
python -m pip install --upgrade pip setuptools
python setup.py egg_info
displayName: 'egg_info'
python -m pip install --upgrade pip setuptools pep517 twine
python -m pep517.build --source .
twine check dist/*
displayName: 'pep517 build'
- job: 'PEP8'
pool:
Expand All @@ -32,3 +33,36 @@ jobs:
pip install flake8
flake8 acstools --count
displayName: 'PEP 8 check'
- job: 'Audit'
pool:
vmImage: 'Ubuntu-16.04'

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.x'

- script: |
python -m pip install --upgrade pip setuptools
pip install bandit
bandit -r . -c .bandit.yaml
displayName: 'Security audit'
- job: 'LinkCheck'
pool:
vmImage: 'Ubuntu-16.04'
strategy:
maxParallel: 4

steps:
- task: UsePythonVersion@0

- script: |
python -m pip install --upgrade pip setuptools
pip install -e .[docs]
- bash: |
cd doc
make linkcheck
displayName: 'Run docs link check'
49 changes: 23 additions & 26 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,31 @@
"""Custom ``pytest`` configurations."""
try:
from pytest_astropy_header.display import (PYTEST_HEADER_MODULES,
TESTED_VERSIONS)
except ImportError:
PYTEST_HEADER_MODULES = {}
TESTED_VERSIONS = {}

from astropy.tests.helper import enable_deprecations_as_exceptions
try:
from acstools.version import version
except ImportError:
version = 'unknown'

# Turn deprecation warnings into exceptions.
# Uncomment the following line to treat all DeprecationWarnings as
# exceptions
# NOTE: socks warning fixed by https://github.com/Anorov/PySocks/pull/106
# but not released yet.
from astropy.tests.helper import enable_deprecations_as_exceptions
enable_deprecations_as_exceptions(warnings_to_ignore_entire_module=['socks'])

# 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.
PYTEST_HEADER_MODULES['Astropy'] = 'astropy'
PYTEST_HEADER_MODULES['beautifulsoup4'] = 'bs4'
PYTEST_HEADER_MODULES['requests'] = 'requests'
PYTEST_HEADER_MODULES['stsci.tools'] = 'stsci.tools'
PYTEST_HEADER_MODULES.pop('Pandas')
PYTEST_HEADER_MODULES.pop('h5py')

# For easy inspection on what dependencies were used in test.
def pytest_report_header(config):
import sys
import warnings
from astropy.utils.introspection import resolve_name

s = "\nFull Python Version: \n{0}\n\n".format(sys.version)

for module_name in ('numpy', 'astropy', 'scipy', 'matplotlib',
'stsci.tools'):
try:
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
module = resolve_name(module_name)
except ImportError:
s += "{0}: not available\n".format(module_name)
else:
try:
version = module.__version__
except AttributeError:
version = 'unknown (no __version__ attribute)'
s += "{0}: {1}\n".format(module_name, version)

return s
TESTED_VERSIONS['acstools'] = version
3 changes: 0 additions & 3 deletions doc/rtd-pip-requirements

This file was deleted.

12 changes: 6 additions & 6 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,10 @@

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
'python': ('http://docs.python.org/', None),
'numpy': ('http://docs.scipy.org/doc/numpy/', None),
'scipy': ('http://docs.scipy.org/doc/scipy/reference/', None),
'skimage': ('http://scikit-image.org/docs/0.11.x/', None),
'matplotlib': ('http://matplotlib.org/', None),
'astropy': ('http://docs.astropy.org/en/stable/', None)
'python': ('https://docs.python.org/', None),
'numpy': ('https://docs.scipy.org/doc/numpy/', None),
'scipy': ('https://docs.scipy.org/doc/scipy/reference/', None),
'skimage': ('https://scikit-image.org/docs/0.11.x/', None),
'matplotlib': ('https://matplotlib.org/', None),
'astropy': ('https://docs.astropy.org/en/stable/', None)
}
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[build-system]
requires = ["setuptools>=30.3.0",
"setuptools_scm",
"wheel"]
build-backend = "setuptools.build_meta"
43 changes: 39 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,26 +1,62 @@
[metadata]
package_name = acstools
description = Python Tools for ACS (Advanced Camera for Surveys) Data
name = acstools
description = Python Tools for HST ACS
long_description = Python Tools for HST ACS (Advanced Camera for Surveys) Data
long_description_content_type = text/plain
keywords = astronomy, astrophysics, calibration
author = Matt Davis, Warren Hack, Norman Grogin, Pey Lian Lim, Sara Ogaz, Leornado Ubeda, Mihai Cara, David Borncamp, Nathan Miles
author_email = [email protected]
license = BSD
license_file = LICENSE.md
url = https://github.com/spacetelescope/acstools
edit_on_github = False
github_project = spacetelescope/acstools
classifier =
Intended Audience :: Science/Research
License :: OSI Approved :: BSD License
Operating System :: OS Independent
Programming Language :: Python :: 3
Programming Language :: Python :: Implementation :: CPython
Topic :: Scientific/Engineering :: Astronomy
Topic :: Scientific/Engineering :: Physics
Topic :: Software Development :: Libraries :: Python Modules

[options]
packages = find:
zip_safe = False
setup_requires=
setuptools_scm
install_requires =
numpy
astropy>=2
beautifulsoup4
requests
python_requires = >=3.5

[options.extras_require]
all =
matplotlib
scipy
scikit-image
stsci.tools
stsci.imagestats
test =
pytest
pytest-astropy-header
ci-watson
docs =
sphinx-automodapi

[entry_points]
acs_destripe = acstools.acs_destripe:main
acs_destripe_plus = acstools.acs_destripe_plus:main

[tool:pytest]
minversion = 3.0
minversion = 4.0
testpaths = "acstools" "doc"
norecursedirs = build doc/build
astropy_header = true
xfail_strict = true
junit_family=xunit2

[flake8]
Expand All @@ -33,4 +69,3 @@ junit_family=xunit2
# E704: multiple statements on one line (def)
# W504: line break after binary operator
ignore = E221,E226,E262,E265,E501,E704,W504
exclude = __init__.py
Loading

0 comments on commit 9380248

Please sign in to comment.