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

SMRF package #170

Merged
merged 61 commits into from
Jun 29, 2020
Merged
Show file tree
Hide file tree
Changes from 60 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
8d147af
RME cloud factor was from 1984-2008 which is cool but not needed, fix…
scotthavens Jun 18, 2020
4f911bf
removed uneeded test data files, halving the size of the test data
scotthavens Jun 18, 2020
ba3cfe2
added setuptools scm, added to smrf.__init__ to get a __version__ on …
scotthavens Jun 18, 2020
c1cca42
added importlib metadata to requirements, not fully sure if it needs …
scotthavens Jun 18, 2020
5cb72b7
added 2 tests for output netcdf and backup config to ensure that the …
scotthavens Jun 19, 2020
6c1d6be
Merge branch 'stoporad' into smrf_package
scotthavens Jun 19, 2020
e31a034
removed many old IPW functions
scotthavens Jun 19, 2020
7afab1a
moved the test directory into smrf
scotthavens Jun 19, 2020
b4aa2ad
tests/outputs were being ignored
scotthavens Jun 19, 2020
bf88920
cleaning up
scotthavens Jun 19, 2020
92cbcf5
ensuring that the docs build
scotthavens Jun 19, 2020
1043ed6
updating travis and tox
scotthavens Jun 19, 2020
76bb89f
pandas 1.0 will not work with python 3.5
scotthavens Jun 19, 2020
e907d54
removing python 3.5 support, will have to used ipw based smrf on olde…
scotthavens Jun 19, 2020
05a1211
updated the manifest
scotthavens Jun 19, 2020
cde6f2c
removed logging to debug on travis
scotthavens Jun 19, 2020
0083e62
working on the docker image to figure out setuptools_scm and dependan…
scotthavens Jun 19, 2020
1da4c7d
travis apt update
scotthavens Jun 19, 2020
31cd24b
libeccodes is 18.04 not 16.04
scotthavens Jun 22, 2020
a283d2a
numpy version 1.19.0 was released over weekend and breaks precip temp…
scotthavens Jun 22, 2020
6147a88
travis addons for apt and homebrew for eccodes
scotthavens Jun 22, 2020
1e6dba3
docker built but it's a significant change to a multi-stage build wit…
scotthavens Jun 22, 2020
c434efa
print out python version and covert pip installs to python3
scotthavens Jun 22, 2020
d223795
need gcc for mac
scotthavens Jun 22, 2020
3f19c52
gcc version check
scotthavens Jun 22, 2020
1b674ff
package list
scotthavens Jun 22, 2020
5f5ee32
Bad yml
scotthavens Jun 22, 2020
607d1cb
osx not getting the correct gcc
scotthavens Jun 22, 2020
4896dbf
tox passenv
scotthavens Jun 22, 2020
9bb08a2
osx is not gold host env
scotthavens Jun 22, 2020
81d406d
some flake8 but now allowing flake8 to fail
scotthavens Jun 22, 2020
34c128c
travis requirements
scotthavens Jun 22, 2020
b493c60
added coveralls
scotthavens Jun 23, 2020
39f755c
requirements are downloaded twice
scotthavens Jun 23, 2020
15e9a13
cython to travis
scotthavens Jun 23, 2020
a3906fd
isort
scotthavens Jun 23, 2020
f340aa0
removed bumpversion
scotthavens Jun 23, 2020
df3a492
eccodes is not playing nice with the manylinux image
scotthavens Jun 23, 2020
0d579c1
updated license classifier
scotthavens Jun 23, 2020
19dc76c
moved to manylinux2014 which is based on CentOS 7, manylinux2010 will…
scotthavens Jun 23, 2020
9fe8fc2
script loader is broader to work with local dev, docker and wheel bui…
scotthavens Jun 23, 2020
096e611
travis fix, changed the name of smrf to smrf-dev for now
scotthavens Jun 24, 2020
a20a354
trying macos build
scotthavens Jun 24, 2020
d46f2f6
changed lines
scotthavens Jun 24, 2020
c302c39
travis
scotthavens Jun 24, 2020
933332d
added readme to setup.py, wheels build on linux and are uploaded to pypi
scotthavens Jun 24, 2020
4f27afd
adding the tests back into travis and deploy stage protected
scotthavens Jun 24, 2020
acbd48e
flake8 and fix #35 by cleaning up a bunch in storms, precip and snow.py
Jun 25, 2020
5469120
updates
Jun 25, 2020
3f50bf8
getting flake8 to pass
Jun 25, 2020
519ed04
tox
Jun 25, 2020
a33fa12
flake8 install deps
Jun 25, 2020
92cdb6a
just install everything
Jun 25, 2020
5babfaf
removed the importlib-metadata
Jun 25, 2020
610a59f
not sure how the output png got in there
Jun 25, 2020
77be89a
Merge branch 'master' into smrf_package
Jun 25, 2020
6d94639
removing temp dir references
scotthavens Jun 26, 2020
02e8f15
Merge branch 'smrf_package' of github.com:scotthavens/smrf into smrf_…
scotthavens Jun 26, 2020
86c5a26
logs weren't logging to file
scotthavens Jun 26, 2020
b7837f1
tests need to remove the handlers on root logger to remove almost all…
scotthavens Jun 26, 2020
893f30c
linux env for bash in travis sh files
scotthavens Jun 29, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions .bumpversion.cfg

This file was deleted.

12 changes: 2 additions & 10 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,11 @@
Dockerfile
.venv/

# Eclipse files
.project
.settings
.pydevproject
.DS_Store
._.*
test_data/stoporad.ip

*.lprof
*.prof
*.ipw

test_data/wrfout_d02_2016-03-10.nc
test_data/stoporad*
Expand Down Expand Up @@ -42,9 +36,9 @@ lib64/
parts/
sdist/
var/
*.egg-info/
# *.egg-info/
.installed.cfg
*.egg
# *.egg
jomey marked this conversation as resolved.
Show resolved Hide resolved

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down Expand Up @@ -84,8 +78,6 @@ target/
*.py~
*.swp

# git version stuff:
smrf/utils/gitinfo.py

#Auto generate config files
*config_full.ini
Expand Down
24 changes: 2 additions & 22 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Eclipse files
.project
.settings
.pydevproject
.DS_Store
._.*

Expand All @@ -16,7 +12,6 @@

# Examples files
examples/*/*/maxus*.nc
*/*/output/*
*/*/log.*

# Byte-compiled / optimized / DLL files
Expand Down Expand Up @@ -44,6 +39,7 @@ var/
*.egg-info/
.installed.cfg
*.egg
wheelhouse/

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down Expand Up @@ -83,9 +79,6 @@ target/
*.py~
*.swp

# git version stuff:
smrf/utils/gitinfo.py

#Auto generate config files
*config_full.ini
test_data/config.ini
Expand All @@ -98,24 +91,11 @@ docs/auto_config.rst
docs/modules.rst
docs/smrf.rst

#Ignore results in test_data
test_data/output/*
test_data/tmp/*
tests/RME/output/*
tests/RME/**/*.idx

#ignore maxus.
test_data/topo/maxus_100window.nc
test_data/topo/maxus.nc
examples/* *.nc
examples/reynolds_mountain_east/output/*
examples/simple_hill/* *.csv

*/tmp/*

# notebooks
.ipynb_checkpoints

# grib2 .idx files
*.grib2.*.idx

output/
109 changes: 100 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,106 @@
# Config file for automatic testing at travis-ci.org

sudo: required

language: python
# test stage will test all branches against:
# - linux python 3.5, 3.6, 3.7, 3.8
# - osx python 3.7
#
# deploy stage builds and test the wheels when jobs is
# - pull request
# - master branch
# - tagged commit, only this will be uploaded to pypi

services:
- docker

before_install:
- docker build --build-arg REQUIREMENTS=_dev -t usdaarsnwrc/smrf .
stages:
- test
- name: deploy
if: type = pull_request OR branch = master OR tag IS present AND repo = USDA-ARS-NWRC/smrf
jomey marked this conversation as resolved.
Show resolved Hide resolved

env:
global:
- CIBW_MANYLINUX_X86_64_IMAGE=manylinux2014
- CIBW_TEST_REQUIRES=nose
- CIBW_TEST_COMMAND="NOT_ON_GOLD_HOST=yup nosetests -vv --exe smrf"
- CIBW_BUILD="cp3*-manylinux_x86_64 cp3*-macosx_x86_64"
- CIBW_SKIP="?p27* pp* cp35*"
- CIBW_BUILD_VERBOSITY=1
- CIBW_BEFORE_BUILD_LINUX="{package}/travis/cibuildwheel_before_build_linux.sh"
- CIBW_BEFORE_BUILD_MACOS="{package}/travis/cibuildwheel_before_build_macos.sh"
- CIBW_ENVIRONMENT="NOT_ON_GOLD_HOST=yup"
- CIBW_ENVIRONMENT_MACOS="NOT_ON_GOLD_HOST=yup CC=gcc-7"
- TWINE_USERNAME=__token__
# Note: TWINE_PASSWORD is set to a PyPI API token in Travis settings

# defining the unittest jobs
unittest: &unittest
stage: test
os: linux
dist: bionic
language: python
addons:
apt:
packages:
- libeccodes-tools
homebrew:
packages:
- eccodes
- gcc@7
install:
- python3 --version
- python3 -m pip install tox-travis cython
script: tox

# build the wheels with cibuildwheel
ci-build-wheels: &ci-build-wheels
stage: deploy
services: docker
os: linux
dist: xenial
language: python
install: python3 -m pip install cibuildwheel==1.4.2
script: travis/build.sh

jobs:
include:
# test stage
- <<: *unittest
python: 3.6
env: TOXENV=py36,coverage

- <<: *unittest
python: 3.6
env: TOXENV=flake8

- <<: *unittest
python: 3.7
env: TOXENV=py37

- <<: *unittest
python: 3.8
env: TOXENV=py38

- <<: *unittest
os: osx
osx_image: xcode11.2 # Python 3.7.X running on macOS 10.14
language: shell
env:
- TOXENV=py37
- CC=gcc-7
- NOT_ON_GOLD_HOST=yup

script:
docker run -it usdaarsnwrc/smrf test
# Deploy source distribution
- stage: deploy
name: Deploy source distribution
language: python
python: 3.6
install: skip
script: travis/build-sdist.sh

# Deploy on linux
- <<: *ci-build-wheels
name: Build and deploy Linux wheels

# Deploy on osx
- <<: *ci-build-wheels
name: Build and deploy macOS wheels
os: osx
language: shell
71 changes: 29 additions & 42 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,59 +1,46 @@
# SMRF is built on the IPW
FROM usdaarsnwrc/ipw:latest

MAINTAINER Scott Havens <[email protected]>

ARG REQUIREMENTS=''

####################################################
# System requirements
####################################################

RUN apt-get update -y \
&& apt-get install -y --no-install-recommends libblas-dev \
# Multi-stage SMRF docker build
FROM python:3.6-slim-buster as builder

RUN mkdir /install \
&& mkdir /build \
&& apt-get update -y \
&& apt-get install -y --no-install-recommends \
gcc \
git \
liblapack-dev \
libatlas-base-dev \
libffi-dev \
libssl-dev \
gfortran \
libyaml-dev \
libfreetype6-dev \
libpng-dev \
libhdf5-serial-dev \
python3-dev \
python3-pip \
python3-tk \
curl \
libeccodes-dev \
libeccodes-tools \
&& rm -rf /var/lib/apt/lists/* \
&& apt autoremove -y curl

####################################################
# SMRF
####################################################
&& apt-get autoremove -y curl

COPY . / /code/smrf/
COPY . /build
WORKDIR /build

RUN mkdir /data \
&& cd /code/smrf \
&& python3 -m pip install --no-cache-dir --upgrade pip \
RUN python3 -m pip install --no-cache-dir --upgrade pip \
&& python3 -m pip install --no-cache-dir setuptools wheel \
&& python3 -m pip install --no-cache-dir -r /code/smrf/requirements${REQUIREMENTS}.txt \
&& python3 -m pip install --no-cache-dir --user -r requirements.txt \
&& python3 setup.py bdist_wheel \
&& python3 setup.py build_ext --inplace \
&& python3 setup.py install \
# && rm -r /root/.cache/pip \
&& apt-get autoremove -y gcc
&& python3 setup.py install --user

####################################################
# Create a shared data volume
####################################################
##############################################
# main image
##############################################
FROM python:3.6-slim-buster

COPY --from=builder /root/.local /usr/local

RUN apt-get update -y \
&& apt-get install -y --no-install-recommends libeccodes-tools \
&& python3 -m pip install --no-cache-dir nose \
&& nosetests -vv --exe smrf \
&& python3 -m pip uninstall -y nose \
&& rm -rf /var/lib/apt/lists/*

# Create a shared data volume
VOLUME /data
WORKDIR /data

COPY ./docker-entrypoint.sh /
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["/bin/bash"]
Loading