Skip to content

Commit

Permalink
Merge pull request spacetelescope#10 from mcara/pep8-tify2
Browse files Browse the repository at this point in the history
Maintenance: PEP8, docs formatting, etc.
  • Loading branch information
mcara authored Jun 11, 2022
2 parents dea20cc + 82f64a1 commit 4125d1d
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 156 deletions.
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ build:
image: latest

python:
version: 3.7
version: 3.9
install:
- requirements: docs/rtd-pip-requirements.txt
- method: pip
Expand Down
82 changes: 50 additions & 32 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,53 @@
trigger:
- master

pool:
vmImage: 'ubuntu-latest'
strategy:
matrix:
Python36:
python.version: '3.6'
Python37:
python.version: '3.7'

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
displayName: 'Python $(python.version)'

- script: |
python -m pip install --upgrade pip
pip install -e ".[test]"
displayName: 'Install dependencies'

- script: |
python -m pip freeze
displayName: 'Package listing'

- script: |
python -m pip install pytest pytest-azurepipelines
pytest --cov=./
coverage xml
codecov -t "$CODECOV"
displayName: 'pytest'
env:
CODECOV: $(codecov)
variables:
PYTHONUNBUFFERED: '1'

jobs:
- template: azure-templates.yml
parameters:
name: Linux
os: linux

- template: azure-templates.yml
parameters:
name: MacOS
os: macos

- template: azure-templates.yml
parameters:
name: Windows
os: windows

- job: 'PEP8'
pool:
vmImage: 'Ubuntu-18.04'

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

- script: |
python -m pip install --upgrade flake8
flake8
displayName: 'Run check'
- job: 'Publish'
dependsOn: 'Linux'
pool:
vmImage: 'Ubuntu-18.04'

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

- script: |
python -m pip install astropy
python setup.py sdist
displayName: 'Build sdist'
68 changes: 68 additions & 0 deletions azure-templates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
jobs:
- job: ${{ format(parameters.name) }}
pool:
${{ if eq(parameters.os, 'windows') }}:
vmImage: windows-2019
${{ if eq(parameters.os, 'macos') }}:
vmImage: macOS-10.15
${{ if eq(parameters.os, 'linux') }}:
vmImage: ubuntu-18.04

strategy:
matrix:
Python38:
python.version: '3.8'
Python39:
python.version: '3.9'
Python310:
python.version: '3.10'
maxParallel: 4

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
architecture: 'x64'

- bash: |
export PIP_INSTALL='pip install --upgrade'
echo "##vso[task.setvariable variable=PIP_INSTALL]$PIP_INSTALL"
condition: ne( variables['Agent.OS'], 'Windows_NT' )
displayName: Pip on Linux/Darwin
- powershell: |
Set-Variable -Name PIP_INSTALL -Value 'python -m pip install --upgrade'
Write-Host "##vso[task.setvariable variable=PIP_INSTALL]$PIP_INSTALL"
condition: eq( variables['Agent.OS'], 'Windows_NT' )
displayName: Pip on Windows
- script: |
$(PIP_INSTALL) -e .[test]
displayName: build package
- script: |
python -m pip freeze
displayName: freeze output
- script: |
pytest --cov=./ -v --junitxml=junit/test-results.xml
displayName: run test
- bash: |
codecov -t $codecov_token
env:
codecov_token: $(CODECOV_TOKEN)
condition: ne( variables['Agent.OS'], 'Windows_NT' )
displayName: codecov upload on Linux/Darwin
- powershell: |
codecov -t "$(CODECOV_TOKEN)"
condition: eq( variables['Agent.OS'], 'Windows_NT' )
displayName: codecov upload on Windows
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: '**/test-*.xml'
testRunTitle: 'Python $(python.version)-${{ format(parameters.name) }}'

107 changes: 0 additions & 107 deletions docs/exts/numfig.py

This file was deleted.

8 changes: 0 additions & 8 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,13 @@ def check_sphinx_version(expected_version):
'astropy': ('http://docs.astropy.org/en/stable/', None),
}

if sys.version_info[0] == 2:
intersphinx_mapping['python'] = ('http://docs.python.org/2/', None)
# intersphinx_mapping['pythonloc'] = (
# 'http://docs.python.org/',
# os.path.abspath(os.path.join(os.path.dirname(__file__),
# 'local/python2_local_links.inv')))

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
# 'numfig',
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
Expand Down
4 changes: 2 additions & 2 deletions wiimatch/lsq_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,11 @@ def build_lsq_eqs(images, masks, sigmas, degree, center=None,


def pinv_solve(matrix, free_term, nimages, tol=None):
"""
r"""
Solves a system of linear equations
.. math::
a \ cdot c = b.
a \cdot c = b.
using Moore-Penrose pseudoinverse.
Expand Down
4 changes: 2 additions & 2 deletions wiimatch/tests/test_match.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
A module containing unit tests for the `wcsutil` module.
A module containing unit tests for the ``wcsutil`` module.
Licensed under a 3-clause BSD style license - see LICENSE.rst
:License: :doc:`../LICENSE`
"""
import pytest
Expand Down
7 changes: 3 additions & 4 deletions wiimatch/tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
"""
A module containing unit tests for the `wcsutil` module.
A module containing unit tests for the ``wcsutil`` module.
Licensed under a 3-clause BSD style license - see LICENSE.rst
:License: :doc:`../LICENSE`
"""
import pytest
import numpy as np

from wiimatch import utils
Expand All @@ -27,6 +26,6 @@ def test_utils_coordinates_no_center():

center = tuple(i // 2 for i in image_shape)
for orig, cc, i in zip(center, c[0], ind):
assert(i - orig, cc)
assert np.allclose(i - orig, cc)

assert np.allclose(c[1], center, rtol=1.e-8, atol=1.e-12)

0 comments on commit 4125d1d

Please sign in to comment.