Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Test] Debug test failure #286

Closed
wants to merge 57 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
53a56e9
Add SIFT script to python package installation
djhoese Mar 3, 2020
3e4c876
Move satpy import higher in the importer module
djhoese Mar 3, 2020
5e94389
Try fixing custom gl-ci-helpers raw URL
djhoese Mar 3, 2020
27993fc
Set numpy version back to stable on Travis CI
djhoese Mar 3, 2020
a79f335
Try explicitly specifying coverage dependency
djhoese Mar 3, 2020
f8833eb
Try installing pyqt5 with pip on Travis Windows
djhoese Mar 4, 2020
da985ea
Add missing semicolon to travis config
djhoese Mar 4, 2020
fe49b2b
Add bundle building scripts and build environments to Travis
djhoese Mar 4, 2020
7ba08b6
Add conda-pack to build environment
djhoese Mar 4, 2020
d1c0494
Add missing semicolon in travis script
djhoese Mar 4, 2020
cfa350c
Fix additional argument handling for build_conda_pack.py
djhoese Mar 4, 2020
b8460d6
Fix not returning the version in conda pack build
djhoese Mar 4, 2020
1207f7b
Add sftp upload first attempt
djhoese Mar 4, 2020
11996dc
Fix bundle script setting of PYTHONNOUSERSITE
djhoese Mar 4, 2020
4d2030c
Merge remote-tracking branch 'origin/master' into feature-conda-pack
djhoese Mar 6, 2020
d3b47cd
Remove separate bundle environments on travis
djhoese Mar 6, 2020
9af7c0a
Add missing blank line in build_conda_pack.py
djhoese Mar 6, 2020
db8e858
Fix missing quote in travis config
djhoese Mar 6, 2020
11bd7bd
Add upload to FTP
djhoese Mar 7, 2020
19d65bd
Add experimental bundle delete commands
djhoese Mar 7, 2020
1803567
Only use FTP upload on master branch
djhoese Mar 7, 2020
9b86c49
Only run FTP upload on non-PRs
djhoese Mar 7, 2020
8f8971d
Force uninstall pyqt before reinstalling from pip on Windows
djhoese Mar 8, 2020
7cddecf
Add TODO to guidebook and small fix in open file wizard
djhoese Mar 8, 2020
bbf9b8a
Add pyqt5 check to travis install
djhoese Mar 8, 2020
5b5bd92
Move pyqt5 test on travis to early step
djhoese Mar 8, 2020
60bfa38
Continue debugging travis ci windows
djhoese Mar 9, 2020
cc67c40
Shot in the dark travis debugging
djhoese Mar 9, 2020
7bf6a2a
Shot in the dark travis debugging
djhoese Mar 9, 2020
956ad2d
Add -y to pyqt reinstall
djhoese Mar 9, 2020
3be12e7
Travis hates me
djhoese Mar 9, 2020
4ae0061
Add more debug information to windows CI
djhoese Mar 9, 2020
6431400
See if conda run does anything
djhoese Mar 9, 2020
a25b0c4
More Travis debugging
djhoese Mar 10, 2020
ba0f2fb
Try forcing conda version in travis
djhoese Mar 10, 2020
3761ae9
Try conda from conda-forge
djhoese Mar 10, 2020
4a7c416
Use conda install instead of conda update
djhoese Mar 10, 2020
ac41766
Add conda info because why not
djhoese Mar 10, 2020
791bc78
Clear up travis CI print outs
djhoese Mar 10, 2020
a2f3e25
Remove pip fallback on Windows CI
djhoese Mar 10, 2020
83f48a2
Add another conda list pyqt command to travis ci
djhoese Mar 10, 2020
5ea853d
Force uninstall of pyqt PyPI packages
djhoese Mar 10, 2020
0e3f8bb
Add conda list for things from pypi
djhoese Mar 10, 2020
60976ff
Cleanup some of the debugging
djhoese Mar 10, 2020
593fd4e
Try changing the pythonpath looking for web engine
djhoese Mar 10, 2020
0099b70
Change from c++ to c for "simpler" environment possibly
djhoese Mar 10, 2020
d49317d
Try bash windows language to see what container gets used
djhoese Mar 11, 2020
4a66e04
Simplify travis environment for more testing
djhoese Mar 11, 2020
d37b2d4
Rearrange travis keys to see if something changes
djhoese Mar 11, 2020
ce5ec2e
Add the Windows environment as an allowed failure
djhoese Mar 11, 2020
8a507a5
Only run tests on non-Windows because of missing DirectX support
djhoese Mar 12, 2020
fa01afa
Finish windows SIFT install script
katherinekolman May 13, 2020
570a83b
Fix Linux/Mac test failure
katherinekolman May 14, 2020
48d572c
Revert test to original + force matplotlib version to 3.2.0
katherinekolman May 18, 2020
a226060
Try installing matplotlib later
katherinekolman May 18, 2020
6e891d4
Try older version of matplotlib
katherinekolman May 20, 2020
0f57d8c
Check image size and offset values
katherinekolman May 20, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
79 changes: 60 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
language: python
env:
global:
- PYTHON_VERSION=$TRAVIS_PYTHON_VERSION
- NUMPY_VERSION=1.17
- NUMPY_VERSION=stable
- MAIN_CMD='python setup.py'
- CONDA_DEPENDENCIES='hdf5 rasterio matplotlib numba pyproj coveralls pytest pytest-mock
pytest-cov pytest-qt vispy netcdf4 h5py imageio imageio-ffmpeg ffmpeg
- CONDA_DEPENDENCIES='hdf5 rasterio numba pyproj coveralls pytest pytest-mock
pytest-cov coverage pytest-qt vispy netcdf4 h5py imageio imageio-ffmpeg ffmpeg
pillow pyshp pyqtgraph shapely sqlalchemy pyqt appdirs pyyaml satpy eccodes scikit-image
donfig'
donfig conda-pack'
- PIP_DEPENDENCIES='pytest-xvfb'
- SETUP_XVFB=True
- EVENT_TYPE='push pull_request'
Expand All @@ -21,30 +20,72 @@ matrix:
- env: PYTHON_VERSION=3.7
os: osx
language: generic
- env: PYTHON_VERSION=3.7
os: windows
language: shell
- os: windows
env: PYTHON_VERSION=3.7
language: c
allow_failures:
- os: windows
env: PYTHON_VERSION=3.7
language: c
install:
- git clone --depth 1 git://github.com/astropy/ci-helpers.git
- source ci-helpers/travis/setup_conda.sh
- if [ "${TRAVIS_OS_NAME}" = "windows" ]; then git clone --depth 1 git://github.com/vtkiorg/gl-ci-helpers.git;
- if [ "${TRAVIS_OS_NAME}" == "windows" ]; then
git clone --depth 1 -b feature-travis-windows git://github.com/djhoese/gl-ci-helpers.git;
powershell -Command "Set-ExecutionPolicy RemoteSigned -scope CurrentUser";
powershell gl-ci-helpers/appveyor/install_opengl.ps1;
fi;
- if [ "${TRAVIS_OS_NAME}" = "windows" ]; then powershell -Command "Set-ExecutionPolicy
RemoteSigned -scope CurrentUser"; fi;
- if [ "${TRAVIS_OS_NAME}" = "windows" ]; then powershell gl-ci-helpers/appveyor/install_opengl.ps1;
- if [ "${TRAVIS_OS_NAME}" == "linux" ] || [ "${TRAVIS_OS_NAME}" == "osx" ]; then
conda install -y pygrib matplotlib==3.1.3;
fi;
- if [ "${TRAVIS_OS_NAME}" = "windows" ]; then pip install PyQt5==5.9; fi;
- if [ "${TRAVIS_OS_NAME}" = "linux" ] || [ "${TRAVIS_OS_NAME}" = "osx" ]; then conda
install pygrib; fi;
- pip install -e . --no-deps
before_script:
- export DISPLAY=:99.0
- if [ "${TRAVIS_OS_NAME}" = "osx" ]; then ( sudo Xvfb :99 -ac -screen 0 1400x900x24
- if [ "${TRAVIS_OS_NAME}" == "osx" ]; then ( sudo Xvfb :99 -ac -screen 0 1400x900x24
+render +iglx; echo ok )& fi;
script:
- pip install -e .
- pytest -s --cov-report term --cov=uwsift uwsift/tests
# Tests need DirectX to run which is not available on Travis right now
- if [ "${TRAVIS_OS_NAME}" != "windows" ]; then
pytest -s --cov-report term --cov=uwsift uwsift/tests;
fi
# Reinstall SIFT *into* the environment so conda-pack can bundle it
- pip install --no-deps .
# Unstable version
- if [[ $TRAVIS_TAG == "" ]]; then
version=$(python -c "from uwsift import __version__; print(__version__)");
if [[ "${TRAVIS_OS_NAME}" == "windows" ]]; then
ext="zip";
platform="windows";
else
ext="tar.gz";
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
platform="darwin";
else
platform="linux";
fi;
fi;
oflag="-o SIFT_${version}dev_${platform}_$(date +%Y%m%d_%H%M%S).${ext}";
else
oflag="";
fi
- python build_conda_pack.py -j -1 $oflag
- ls -l
after_success:
- if [[ $PYTHON_VERSION == 3.7 ]]; then coveralls; fi;
- if [[ $PYTHON_VERSION == "3.7" ]]; then coveralls; fi;
- if [[ $TRAVIS_TAG == "" ]]; then
odir="experimental/";
else
odir="";
fi
- echo "${SFTP_UPLOAD_KEY}" | base64 --decode >/tmp/sftp_rsa
# if this isn't a pull request, upload the new version
# if we made a real release, delete all experimental releases
- if [[ $TRAVIS_PULL_REQUEST_BRANCH == "" ]]; then
curl -k --ftp-create-dirs -T SIFT_*.*.*_*.* --key /tmp/sftp_rsa sftp://sift@ftp.ssec.wisc.edu/${odir};
if [[ $TRAVIS_TAG != "" ]]; then
curl -k -l --key /tmp/sftp_rsa sftp://sift@ftp.ssec.wisc.edu/experimental | grep SIFT_*.*.*_*.* | xargs -I{} -- curl -k -v --key /tmp/sftp_rsa sftp://sift@ftp.ssec.wisc.edu/experimental -Q "DELE {}";
fi;
fi
deploy:
- provider: pypi
user: __token__
Expand Down
76 changes: 76 additions & 0 deletions build_conda_pack.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/usr/bin/env python3
"""Create a conda-pack'd SIFT installation tarball.

Note: This script will place extra files in the currently activated python
environment in order to include these files in the produced tarball.

SIFT must be installed in the current environment with::

pip install --no-deps .

Instead of installing it in development mode (`-e`).

Example::

python build_conda_pack.py -c
"""

import os
import sys
import shutil
import subprocess


def get_version():
try:
from uwsift import __version__
return __version__
except ImportError:
raise RuntimeError("Could not determine SIFT version. Is SIFT installed?")


def main():
import argparse
parser = argparse.ArgumentParser(
description="Build SIFT installation tarball (remaining arguments "
"are passed to conda-pack)")
parser.add_argument('--arcroot',
help="Directory name inside the tarball (default: SIFT_X.Y.Z)")
parser.add_argument('-o', '--output',
help="Pathname for bundled file. Default is "
"'SIFT_X.Y.Z_<platform>.<ext>' where platform is "
"'linux', 'darwin', or 'win32' and ext is "
"'.tar.gz' for linux and OSX, '.zip' for Windows.")
args, unknown_args = parser.parse_known_args()

version = get_version()
if args.arcroot is None:
args.arcroot = f"SIFT_{version}"
if args.output is None:
ext = '.zip' if 'win' in sys.platform else '.tar.gz'
args.output = f"SIFT_{version}_{sys.platform}{ext}"

# Copy appropriate wrapper scripts
dst = sys.prefix
script_dir = os.path.realpath(os.path.dirname(__file__))
if 'nux' in sys.platform:
script = os.path.join(script_dir, 'bundle_scripts', 'SIFT.sh')
shutil.copyfile(script, os.path.join(dst, 'SIFT.sh'))
elif 'darwin' in sys.platform:
script = os.path.join(script_dir, 'bundle_scripts', 'SIFT.sh')
shutil.copyfile(script, os.path.join(dst, 'SIFT.command'))
elif 'win' in sys.platform:
script = os.path.join(script_dir, 'bundle_scripts', 'SIFT.bat')
shutil.copyfile(script, os.path.join(dst, 'SIFT.bat'))
else:
raise RuntimeError(f"Unknown platform: {sys.platform}")

subprocess.check_call(['conda-pack', '--arcroot', args.arcroot,
'--output', args.output] + unknown_args)
os.chmod(args.output, 0o755)

# TODO: Do additional risky cleanup to reduce output file size


if __name__ == "__main__":
sys.exit(main())
13 changes: 13 additions & 0 deletions bundle_scripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Bundle Scripts

The scripts in this directory are specially constructed to run from a
conda-pack'd bundled installation of SIFT. The types of scripts included are
currently:

1. `SIFT.X` where `X` corresponds to a scripting extension specific to each
platform. This is `.sh` for Linux (CentOS 7+), `.command` for OSX, and
`.bat` for Windows. These scripts are placed in the root directory of
the released bundle.

Note to reuse code as much as possible some scripts may be copied to
the appropriate name rather than existing as separate files.
19 changes: 19 additions & 0 deletions bundle_scripts/SIFT.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@echo off
REM Initialize SIFT installation if necessary and run SIFT

set base_dir=%~p0

REM Activate the conda environment
call %base_dir%Scripts\activate

REM Create a signal file that we have run conda-unpack
set installed=%base_dir%.installed
if not exist "%installed%" (
echo Running one-time initialization of SIFT installation...
conda-unpack
echo %base_dir% > %installed%
)

echo Running SIFT...

python -m uwsift %*
30 changes: 30 additions & 0 deletions bundle_scripts/SIFT.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# Usage: SIFT.sh <command line arguments>
# Description: Initialize the SIFT installation if necessary and run SIFT
set -e

# get current base directory for this script
SOURCE="${BASH_SOURCE[0]}"
while [[ -h "$SOURCE" ]] ; do SOURCE="$(readlink "$SOURCE")"; done
BASE="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

# Remove user environment variables that may conflict with installation
unset LD_PRELOAD
unset LD_LIBRARY_PATH
unset DYLD_LIBRARY_PATH
unset PYTHONPATH
export PYTHONNOUSERSITE=1

# Activate the conda-pack'd environment
source $BASE/activate

# Check if we already ran conda-unpack
install_signal="${BASE}/.installed"
if [[ ! -f "${install_signal}" ]]; then
echo "Running one-time initialization of SIFT installation..."
conda-unpack
echo "${BASE}" > "${install_signal}"
echo "Running SIFT..."
fi

python -m uwsift "$@"
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,11 @@ def run(self):
python_requires='>=3.6',
extras_require=extras_require,
packages=find_packages(),
# entry_points={},
entry_points={
"console_scripts": [
"SIFT = uwsift.__main__:main",
],
},
cmdclass={
'bump': BumpCommand,
}
Expand Down
16 changes: 10 additions & 6 deletions sift.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import sys
from PyInstaller.compat import is_win, is_darwin, is_linux
from PyInstaller.utils.hooks import collect_submodules
from PyInstaller.utils.hooks import collect_submodules, collect_data_files
import vispy.glsl
import vispy.io
import satpy
Expand All @@ -23,14 +23,16 @@ data_files = [
for shape_dir in ["ne_50m_admin_0_countries", "ne_110m_admin_0_countries", "ne_50m_admin_1_states_provinces_lakes",
"fonts", "colormaps", "grib_definitions"]:
data_files.append((os.path.join("uwsift", "data", shape_dir), os.path.join("sift_data", shape_dir)))
data_files.extend(collect_data_files('pyspectral'))

hidden_imports = [
"vispy.ext._bundled.six",
"vispy.app.backends._pyqt4",
"vispy.app.backends._pyqt5",
"sqlalchemy.ext.baked",
"satpy",
"skimage",
"skimage.measure",
"pyproj.datadir",
] + collect_submodules("rasterio") + collect_submodules('satpy')
if is_win:
hidden_imports += collect_submodules("encodings")
Expand All @@ -51,13 +53,15 @@ def _include_if_exists(binaries, lib_dir, lib_pattern):
# Add missing shared libraries
binaries = []
if is_linux:
lib_dir = sys.executable.replace(os.path.join("bin", "python"), "lib")
bin_idx = sys.executable.rfind("/bin")
lib_dir = os.path.join(sys.executable[:bin_idx], "lib")
binaries += [(os.path.join(lib_dir, 'libfontconfig*.so'), '.')]
if not is_win:
# Add extra pygrib .def files
share_dir = sys.executable.replace(os.path.join("bin", "python"), "share")
lib_dir = sys.executable.replace(os.path.join("bin", "python"), "lib")
bin_dir = sys.executable.replace(os.path.join("bin", "python"), "bin")
bin_idx = sys.executable.rfind("/bin")
share_dir = os.path.join(sys.executable[:bin_idx], "share")
lib_dir = os.path.join(sys.executable[:bin_idx], "lib")
bin_dir = os.path.join(sys.executable[:bin_idx], "bin")
data_files.append((os.path.join(share_dir, 'eccodes'), os.path.join('share', 'eccodes')))
# Add ffmpeg
binaries += [(os.path.join(bin_dir, 'ffmpeg'), '.')]
Expand Down
4 changes: 4 additions & 0 deletions uwsift/view/export_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,15 +279,19 @@ def _append_colorbar(self, mode, im, u):
offset = 0
if mode == 'vertical':
new_im = Image.new(im.mode, (orig_w + fig_w, orig_h))
print('vert new_im size: ', new_im.size)
for i in [im, fig_im]:
new_im.paste(i, (offset, 0))
offset += i.size[0]
print('vert offset: ', offset)
return new_im
else:
new_im = Image.new(im.mode, (orig_w, orig_h + fig_h))
print('horiz new_im size: ', new_im.size)
for i in [im, fig_im]:
new_im.paste(i, (0, offset))
offset += i.size[1]
print('horiz offset: ', offset)
return new_im

def _create_filenames(self, uuids, base_filename):
Expand Down
1 change: 1 addition & 0 deletions uwsift/view/open_file_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def collect_selected_ids(self):
if id_items['name'].checkState():
id_dict = {key: id_item.data(QtCore.Qt.UserRole)
for key, id_item in id_items.items() if id_item is not None}
id_dict['modifiers'] = None
selected_ids.append(DatasetID(**id_dict))
return selected_ids

Expand Down
2 changes: 2 additions & 0 deletions uwsift/workspace/guidebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ def collect_info(self, info):
z = {}

band_short_name = info.get(Info.DATASET_NAME, '???')
# FIXME: Don't use pure DATASET_NAME since resolution should not be part of the SHORT_NAME
# And/or don't use SHORT_NAME for grouping
if Info.SHORT_NAME not in info:
z[Info.SHORT_NAME] = band_short_name
else:
Expand Down
12 changes: 3 additions & 9 deletions uwsift/workspace/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,15 @@
from uwsift.workspace.guidebook import ABI_AHI_Guidebook, Guidebook
from .metadatabase import Resource, Product, Content

from satpy import Scene, available_readers, __version__ as satpy_version
from satpy.dataset import DatasetID

_SATPY_READERS = None # cache: see `available_satpy_readers()` below
SATPY_READER_CACHE_FILE = os.path.join(USER_CACHE_DIR,
'available_satpy_readers.yaml')


LOG = logging.getLogger(__name__)

try:
from satpy import Scene, available_readers, __version__ as satpy_version
from satpy.dataset import DatasetID
except ImportError:
LOG.warning("SatPy is not installed and will not be used for importing.")
Scene = None
DatasetID = None

try:
from skimage.measure import find_contours
except ImportError:
Expand Down