Commit f6c39c31 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Added URL checker CI job and fixed all dead URLs. Removed travis related file

Signed-off-by: Daniel Scheffler's avatarDaniel Scheffler <>
parent fcd57585
Pipeline #16662 failed
......@@ -48,6 +48,15 @@ test_styles:
when: always
stage: test
- source /root/miniconda3/bin/activate ci_env
- pip install -U urlchecker
- make urlcheck
when: always
stage: test
......@@ -139,3 +148,11 @@ create_github_release:
- /^v\d+\.\d+\.\d+([abc]\d*)?$/ # PEP-440 compliant version (tags)
- dev
stage: deploy
- deploy_pypi
# Config file for automatic testing at
# This file will be regenerated if you run
language: python
- 3.5
- 3.4
- 3.3
- 2.7
- 2.6
# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
install: pip install -U tox-travis
# command to run tests, e.g. python test
script: tox
# After you create the Github repo and add it to Travis, run the
# script to finish PyPI deployment setup
provider: pypi
distributions: sdist bdist_wheel
user: danschef
tags: true
repo: danschef/arosics
python: 2.7
......@@ -56,6 +56,9 @@ lint: ## check style with flake8
pycodestyle arosics --exclude="*.ipynb,*.ipynb*" --max-line-length=120 > ./tests/linting/pycodestyle.log
-pydocstyle arosics > ./tests/linting/pydocstyle.log
urlcheck: ## check for dead URLs
urlchecker check . --file-types .py,.rst,.md,.json
test: ## run tests quickly with the default Python
python test
......@@ -24,18 +24,6 @@ An Automated and Robust Open-Source Image Co-Registration Software for Multi-Sen
.. .. image::
.. .. image::
:alt: Documentation Status
.. .. image::
:alt: Updates
.. image::
.. image::
......@@ -81,8 +69,7 @@ also allows to align the output image to the reference image coordinate grid if
Here is an example of a Landsat-8 / Sentinel-2 image pair before and after co-registration using AROSICS:
.. image::
.. image::
Local co-registration - for spatially variable shifts but a bit slower
......@@ -573,7 +573,7 @@ class COREG(object):
# view both states
print('Matching window before and after correction (above and below): ')
# get layouts (docs on options:
# get layouts (docs on options:
layout_before = (hvIm_matchWin + hvIm_matchWin).opts(plot=dict(fig_inches=figsize))
layout_after = (hvIm_otherWin_orig + hvIm_otherWin_corr).opts(plot=dict(fig_inches=figsize))
......@@ -131,8 +131,8 @@ def setup(app):
# Add mappings for intersphinx extension (allows to link to the API reference of other sphinx documentations)
intersphinx_mapping = {
'geoarray': ('', None),
'python': ('', None),
'geoarray': ('', None),
'python': ('', None),
......@@ -64,7 +64,7 @@ req_setup = [
req_intplot = ['holoviews', 'ipython']
req_test = ['coverage', 'nose', 'nose2', 'nose-htmloutput', 'rednose'] + req_intplot
req_test = ['coverage', 'nose', 'nose2', 'nose-htmloutput', 'rednose', 'urlchecker'] + req_intplot
req_doc = ['sphinx-argparse', 'sphinx_rtd_theme', 'sphinx-autodoc-typehints']
......@@ -39,3 +39,4 @@ dependencies:
- pylint
- rednose
- sphinx-argparse
- urlchecker
......@@ -121,6 +121,60 @@ class CompleteWorkflow_INTER1_S2A_S2A(unittest.TestCase):
class Test_Issue70(unittest.TestCase):
def test_coreg_local_fullArrays(self):
import dill
with open('/home/gfz-fe/scheffler/temp/coreg_issue70/kwargs_dump_assertionerror_issue_70b.dill', 'rb') as inF:
kw = dill.load(inF)
kw['r_b4match'] = 1
kw['q'] = False
if CRL.success:
CRL.view_CoRegPoints(figsize=(20, 20), backgroundIm='tgt', hide_filtered=False)
print('Result not co-registered.')
def test_coreg_local_bandsonly(self):
import dill
with open('/home/gfz-fe/scheffler/temp/coreg_issue70/kwargs_dump_assertionerror_issue_70.dill', 'rb') as inF:
kw = dill.load(inF)
kw['r_b4match'] = 1
kw['q'] = False
if CRL.success:
CRL.view_CoRegPoints(figsize=(20, 20), backgroundIm='tgt', hide_filtered=False)
print('Result not co-registered.')
class Test_Issue47(unittest.TestCase):
def test_coreg_local(self):
import dill
with open('/home/gfz-fe/scheffler/temp/coreg_issue47/kwargs_dump_assertionerror_issue_47.dill', 'rb') as inF:
kw = dill.load(inF)
kw['r_b4match'] = 1
kw['q'] = False
kw['CPUs'] = 32
if not CRL.success:
print('Result not co-registered.')
CRL.view_CoRegPoints(backgroundIm='tgt', hide_filtered=False)
# CRL.view_CoRegPoints(figsize=(20, 20), backgroundIm='tgt', hide_filtered=False)
if __name__ == '__main__':
import nose2
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# AROSICS - Automated and Robust Open-Source Image Co-Registration Software
# Copyright (C) 2017-2020 Daniel Scheffler (GFZ Potsdam,
# This software was developed within the context of the GeoMultiSens project funded
# by the German Federal Ministry of Education and Research
# (project grant code: 01 IS 14 010 A-C).
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
# You should have received a copy of the GNU Lesser General Public License along
# with this program. If not, see <>.
"""Update encrypted deploy password in Travis config file."""
from __future__ import print_function
import base64
import json
import os
from getpass import getpass
import yaml
from cryptography.hazmat.primitives.serialization import load_pem_public_key
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.asymmetric.padding import PKCS1v15
from urllib import urlopen
except ImportError:
from urllib.request import urlopen
GITHUB_REPO = 'danschef/arosics'
TRAVIS_CONFIG_FILE = os.path.join(
os.path.dirname(os.path.abspath(__file__)), '.travis.yml')
def load_key(pubkey):
"""Load public RSA key.
Work around keys with incorrect header/footer format.
Read more about RSA encryption with cryptography:
return load_pem_public_key(pubkey.encode(), default_backend())
except ValueError:
# workaround for
pubkey = pubkey.replace('BEGIN RSA', 'BEGIN').replace('END RSA', 'END')
return load_pem_public_key(pubkey.encode(), default_backend())
def encrypt(pubkey, password):
"""Encrypt password using given RSA public key and encode it with base64.
The encrypted password can only be decrypted by someone with the
private key (in this case, only Travis).
key = load_key(pubkey)
encrypted_password = key.encrypt(password, PKCS1v15())
return base64.b64encode(encrypted_password)
def fetch_public_key(repo):
"""Download RSA public key Travis will use for this repo.
Travis API docs:
keyurl = '{0}/key'.format(repo)
data = json.loads(urlopen(keyurl).read().decode())
if 'key' not in data:
errmsg = "Could not find public key for repo: {}.\n".format(repo)
errmsg += "Have you already added your GitHub repo to Travis?"
raise ValueError(errmsg)
return data['key']
def prepend_line(filepath, line):
"""Rewrite a file adding a line to its beginning."""
with open(filepath) as f:
lines = f.readlines()
lines.insert(0, line)
with open(filepath, 'w') as f:
def load_yaml_config(filepath):
"""Load yaml config file at the given path."""
with open(filepath) as f:
return yaml.load(f)
def save_yaml_config(filepath, config):
"""Save yaml config file at the given path."""
with open(filepath, 'w') as f:
yaml.dump(config, f, default_flow_style=False)
def update_travis_deploy_password(encrypted_password):
"""Put `encrypted_password` into the deploy section of .travis.yml."""
config = load_yaml_config(TRAVIS_CONFIG_FILE)
config['deploy']['password'] = dict(secure=encrypted_password)
save_yaml_config(TRAVIS_CONFIG_FILE, config)
line = ('# This file was autogenerated and will overwrite'
' each time you run\n')
prepend_line(TRAVIS_CONFIG_FILE, line)
def main(args):
"""Add a PyPI password to .travis.yml so that Travis can deploy to PyPI.
Fetch the Travis public key for the repo, and encrypt the PyPI password
with it before adding, so that only Travis can decrypt and use the PyPI
public_key = fetch_public_key(args.repo)
password = args.password or getpass('PyPI password: ')
update_travis_deploy_password(encrypt(public_key, password.encode()))
print("Wrote encrypted password to .travis.yml -- you're ready to deploy")
if '__main__' == __name__:
import argparse
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--repo', default=GITHUB_REPO,
help='GitHub repo (default: %s)' % GITHUB_REPO)
help='PyPI password (will prompt if not provided)')
args = parser.parse_args()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment