diff --git a/.circleci/.installed_build_env_deps b/.circleci/.installed_build_env_deps new file mode 100644 index 0000000000..f0a0f42105 --- /dev/null +++ b/.circleci/.installed_build_env_deps @@ -0,0 +1,302 @@ +# packages in environment at /home/andrep/miniconda3/envs/fv3net: +# +# Name Version Build Channel +_libgcc_mutex 0.1 main +adal 1.2.2 py_0 conda-forge +apache-beam 2.18.0 py37h516909a_0 conda-forge +appdirs 1.4.3 py37h28b3542_0 +argcomplete 1.11.1 pypi_0 pypi +arrow-cpp 0.15.1 py37h7cd5009_5 +asciitree 0.3.3 py_2 +asn1crypto 1.3.0 py37_0 +attrs 19.3.0 py_0 +backcall 0.1.0 py37_0 +backoff 1.8.0 py_0 conda-forge +beautifulsoup4 4.8.2 py37_0 +black 19.10b0 py_0 +blas 1.0 mkl +bleach 3.1.0 py37_0 +blinker 1.4 py37_0 +bokeh 1.4.0 py37_0 +boost-cpp 1.71.0 h7b6447c_0 +boto 2.49.0 pypi_0 pypi +brotli 1.0.7 he6710b0_0 +bump2version 1.0.0 pypi_0 pypi +bzip2 1.0.8 h7b6447c_0 +c-ares 1.15.0 h7b6447c_1001 +ca-certificates 2020.1.1 0 +cachetools 3.1.1 py_0 +cairo 1.14.12 h8948797_3 +cartopy 0.17.0 py37hbb7e04d_1 +certifi 2019.11.28 py37_1 +cffi 1.14.0 py37h2e261b9_0 +cftime 1.1.1.1 py37heb32a55_0 +chardet 3.0.4 py37_1003 +click 7.1.1 py_0 +cloudpickle 1.3.0 py_0 +conda 4.8.3 py37_0 +conda-build 3.18.11 py37_0 +conda-package-handling 1.6.0 py37h7b6447c_0 +crcmod 1.7 py37_1002 conda-forge +cryptography 2.8 py37h1ba5d50_0 +curl 7.68.0 hf8cf82a_0 conda-forge +cycler 0.10.0 py37_0 +cython 0.29.15 py37he6710b0_0 +cytoolz 0.10.1 py37h7b6447c_0 +dask 2.12.0 py_0 +dask-core 2.12.0 py_0 +dbus 1.13.12 h746ee38_0 +decorator 4.4.2 py_0 +defusedxml 0.6.0 py_0 +dill 0.3.1.1 py37_0 +distributed 2.12.0 py37_0 +docopt 0.6.2 py37_0 +docrep 0.2.7 py_0 conda-forge +double-conversion 3.1.5 he6710b0_1 +entrypoints 0.3 py37_0 +expat 2.2.6 he6710b0_0 +f90nml 1.1.2 py37_0 conda-forge +fastavro 0.21.23 py37h7b6447c_0 +fasteners 0.15 py_0 +filelock 3.0.12 py_0 +flake8 3.7.9 py37_0 +fontconfig 2.13.0 h9420a91_0 +freetype 2.9.1 h8a8886c_1 +fribidi 1.0.5 h7b6447c_0 +fsspec 0.6.3 py_0 +future 0.18.2 py37_0 +gcs-oauth2-boto-plugin 2.5 pypi_0 pypi +gcsfs 0.6.0 py_0 conda-forge +geos 3.7.1 he6710b0_0 +gflags 2.2.2 he6710b0_0 +glib 2.63.1 h5a9c865_0 +glob2 0.7 py_0 +glog 0.4.0 he6710b0_0 +gmp 6.1.2 h6c8ec71_1 +google-api-core 1.16.0 py37_1 conda-forge +google-apitools 0.5.30 pypi_0 pypi +google-auth 1.11.2 py_0 +google-auth-oauthlib 0.4.1 py_2 +google-cloud-core 1.3.0 py_0 conda-forge +google-cloud-storage 1.26.0 py_0 conda-forge +google-reauth 0.1.0 pypi_0 pypi +google-resumable-media 0.5.0 py_1 conda-forge +googleapis-common-protos 1.51.0 py37_1 +graphite2 1.3.13 h23475e2_0 +graphviz 2.40.1 h21bd128_2 +grpc-cpp 1.26.0 hf8bcb03_0 +grpcio 1.27.2 py37hf8bcb03_0 +gst-plugins-base 1.14.0 hbbd80ab_1 +gstreamer 1.14.0 hb453b48_1 +gsutil 4.48 pypi_0 pypi +h5netcdf 0.8.0 py_0 conda-forge +h5py 2.10.0 py37h7918eee_0 +harfbuzz 1.8.8 hffaf4a1_0 +hdf4 4.2.13 h3ca952b_2 +hdf5 1.10.4 hb1b8bf9_0 +heapdict 1.0.1 py_0 +holoviews 1.12.7 py_0 +httplib2 0.12.0 py37_1000 conda-forge +hypothesis 5.5.4 py_0 +icu 58.2 h9c2bf20_1 +idna 2.9 py_1 +imageio 2.8.0 py_0 +importlib_metadata 1.5.0 py37_0 +intake 0.5.4 py_0 +intake-xarray 0.3.1 py_0 +intel-openmp 2020.0 166 +ipykernel 5.1.4 py37h39e3cac_0 +ipython 7.13.0 py37h5ca1d4c_0 +ipython_genutils 0.2.0 py37_0 +isort 4.3.21 py37_0 +jedi 0.16.0 py37_0 +jinja2 2.11.1 py_0 +joblib 0.14.1 py_0 +jpeg 9b h024ee3a_2 +json5 0.9.3 py_0 +jsonschema 3.2.0 py37_0 +jupyter_client 6.0.0 py_0 +jupyter_core 4.6.1 py37_0 +jupyterlab 1.2.6 pyhf63ae98_0 +jupyterlab_server 1.0.7 py_0 +kiwisolver 1.1.0 py37he6710b0_0 +krb5 1.16.4 h173b8e3_0 +ld_impl_linux-64 2.33.1 h53a641e_7 +libarchive 3.3.3 h5d8350f_5 +libboost 1.71.0 h97c9712_0 +libcurl 7.68.0 hda55be3_0 conda-forge +libedit 3.1.20181209 hc058e9b_0 +libevent 2.1.8 h1ba5d50_0 +libffi 3.2.1 hd88cf55_4 +libgcc-ng 9.1.0 hdf63c60_0 +libgfortran-ng 7.3.0 hdf63c60_0 +liblief 0.9.0 h7725739_2 +libnetcdf 4.7.3 hb80b6cc_0 +libpng 1.6.37 hbc83047_0 +libprotobuf 3.11.2 hd408876_0 +libsodium 1.0.16 h1bed415_0 +libssh2 1.8.2 h1ba5d50_0 +libstdcxx-ng 9.1.0 hdf63c60_0 +libtiff 4.1.0 h2733197_0 +libuuid 1.0.3 h1bed415_2 +libxcb 1.13 h1bed415_1 +libxml2 2.9.9 hea5a465_1 +libxslt 1.1.33 h7d1a2b0_0 +llvmlite 0.31.0 py37hd408876_0 +locket 0.2.0 py37_1 +lxml 4.5.0 py37hefd8a0e_0 +lz4-c 1.8.1.2 h14c3975_0 +lzo 2.10 h49e0be7_2 +markupsafe 1.1.1 py37h7b6447c_0 +matplotlib 3.1.3 py37_0 +matplotlib-base 3.1.3 py37hef1b27d_0 +mccabe 0.6.1 py37_1 +metpy 0.12.0 py_0 conda-forge +mistune 0.8.4 py37h7b6447c_0 +mkl 2020.0 166 +mkl-service 2.3.0 py37he904b0f_0 +mkl_fft 1.0.15 py37ha843d7b_0 +mkl_random 1.1.0 py37hd6b4f25_0 +mock 2.0.0 py37_0 +monotonic 1.5 py_0 +more-itertools 8.2.0 py_0 +msgpack-numpy 0.4.4.3 py_0 +msgpack-python 1.0.0 py37hfd86e86_1 +mypy_extensions 0.4.3 py37_0 +nbconvert 5.6.1 py37_0 +nbformat 5.0.4 py_0 +nc-time-axis 1.2.0 pypi_0 pypi +ncurses 6.2 he6710b0_0 +netcdf4 1.5.3 py37hbf33ddf_0 +networkx 2.4 py_0 +nose 1.3.7 py37_2 +notebook 6.0.3 py37_0 +numba 0.48.0 py37h0573a6f_0 +numcodecs 0.6.4 py37he6710b0_0 +numpy 1.18.1 py37h4f9e942_0 +numpy-base 1.18.1 py37hde5b4d6_1 +oauth2client 4.1.3 py_0 conda-forge +oauthlib 3.1.0 py_0 +olefile 0.46 py37_0 +openssl 1.1.1e h7b6447c_0 +owslib 0.18.0 py_0 +packaging 20.3 py_0 +pandas 1.0.1 py37h0573a6f_0 +pandoc 2.2.3.2 0 +pandocfilters 1.4.2 py37_1 +pango 1.42.4 h049681c_0 +param 1.9.3 py_0 +parso 0.6.2 py_0 +partd 1.1.0 py_0 +patchelf 0.10 he6710b0_0 +pathspec 0.7.0 py_0 +pbr 5.4.4 py_0 +pcre 8.43 he6710b0_0 +pexpect 4.8.0 py37_0 +pickleshare 0.7.5 py37_0 +pillow 7.0.0 py37hb39fc2d_0 +pint 0.11 py_1 conda-forge +pip 20.0.2 py37_1 +pixman 0.38.0 h7b6447c_0 +pkginfo 1.5.0.1 py37_0 +pluggy 0.13.1 py37_0 +pooch 1.0.0 py_0 conda-forge +proj4 5.2.0 he6710b0_1 +prometheus_client 0.7.1 py_0 +prompt_toolkit 3.0.3 py_0 +protobuf 3.11.2 py37he6710b0_0 +psutil 5.7.0 py37h7b6447c_0 +ptyprocess 0.6.0 py37_0 +py 1.8.1 py_0 +py-lief 0.9.0 py37h7725739_2 +pyarrow 0.15.1 py37h0573a6f_0 +pyasn1 0.4.8 py_0 +pyasn1-modules 0.2.7 py_0 +pycodestyle 2.5.0 py37_0 +pycosat 0.6.3 py37h7b6447c_0 +pycparser 2.20 py_0 +pydot 1.4.1 py37_0 +pyepsg 0.4.0 py37_0 +pyflakes 2.1.1 py37_0 +pygments 2.6.1 py_0 +pyjwt 1.7.1 py37_0 +pykdtree 1.3.1 py37hdd07704_2 +pykerberos 1.2.1 py37h14c3975_0 +pymongo 3.9.0 py37he6710b0_0 +pyopenssl 19.1.0 py37_0 +pyparsing 2.4.6 py_0 +pyproj 1.9.6 py37h14380d9_0 +pyqt 5.9.2 py37h05f1152_2 +pyrsistent 0.15.7 py37h7b6447c_0 +pyshp 2.1.0 py_0 +pysocks 1.7.1 py37_0 +pytest 5.4.1 py37_0 +pytest-mpl 0.11 py_1 conda-forge +python 3.7.7 h191fe78_0_cpython +python-avro 1.9.2.1 py37hc8dfbb8_1 conda-forge +python-dateutil 2.8.1 py_0 +python-hdfs 2.5.8 py_0 +python-kubernetes 10.1.0 py37hc8dfbb8_1 conda-forge +python-libarchive-c 2.8 py37_13 +python-snappy 0.5.4 py37he6710b0_0 +python_abi 3.7 1_cp37m conda-forge +pytz 2019.3 py_0 +pyu2f 0.1.4 pypi_0 pypi +pyviz_comms 0.7.3 py_0 +pywavelets 1.1.1 py37h7b6447c_0 +pyyaml 5.3 py37h7b6447c_0 +pyzmq 18.1.1 py37he6710b0_0 +qt 5.9.7 h5867ecd_1 +re2 2019.08.01 he6710b0_0 +readline 7.0 h7b6447c_5 +regex 2020.2.20 py37h7b6447c_0 +requests 2.23.0 py37_0 +requests-kerberos 0.12.0 py37_0 +requests-oauthlib 1.3.0 py_0 +retry-decorator 1.1.1 pypi_0 pypi +ripgrep 11.0.2 he32d670_0 +rsa 4.0 py_0 +ruamel_yaml 0.15.87 py37h7b6447c_0 +scikit-image 0.16.2 py37h0573a6f_0 +scikit-learn 0.22.1 py37hd81dba3_0 +scipy 1.4.1 py37h0b6359f_0 +send2trash 1.5.0 py37_0 +setuptools 46.1.1 py37_0 +shapely 1.6.4 py37h86c5351_0 +sip 4.19.8 py37hf484d3e_0 +six 1.14.0 pypi_0 pypi +snappy 1.1.7 hbae5bb6_3 +socksipy-branch 1.1 pypi_0 pypi +sortedcontainers 2.1.0 py37_0 +soupsieve 2.0 py_0 +sqlite 3.31.1 h7b6447c_0 +tblib 1.6.0 py_0 +terminado 0.8.3 py37_0 +testpath 0.4.4 py_0 +thrift-cpp 0.11.0 h02b749d_3 +tk 8.6.8 hbc83047_0 +toml 0.10.0 py37h28b3542_0 +toolz 0.10.0 py_0 +tornado 6.0.4 py37h7b6447c_1 +tqdm 4.43.0 py_0 +traitlets 4.3.3 py37_0 +typed-ast 1.4.1 py37h7b6447c_0 +typing_extensions 3.7.4.1 py37_0 +uriparser 0.9.3 he6710b0_1 +urllib3 1.25.8 py37_0 +wcwidth 0.1.8 py_0 +webencodings 0.5.1 py37_1 +websocket-client 0.56.0 py37_0 +wheel 0.34.2 py37_0 +xarray 0.15.0 py_0 +xgcm 0.2.0 py_0 conda-forge +xmltodict 0.12.0 pypi_0 pypi +xz 5.2.4 h14c3975_4 +yaml 0.1.7 had09818_2 +yq 2.10.0 pypi_0 pypi +zarr 2.3.2 py_0 +zeromq 4.3.1 he6710b0_3 +zict 2.0.0 py_0 +zipp 2.2.0 py_0 +zlib 1.2.11 h7b6447c_3 +zstd 1.3.7 h0b5b093_0 diff --git a/.circleci/config.yml b/.circleci/config.yml index e0905b3826..79b9b68447 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,6 +1,8 @@ version: 2.1 +orbs: + gcp-gcr: circleci/gcp-gcr@0.6.1 jobs: - build: + pytest_default: docker: - image: us.gcr.io/vcm-ml/circleci-miniconda-gfortran:latest auth: @@ -9,16 +11,82 @@ jobs: environment: GOOGLE_APPLICATION_CREDENTIALS=key.json steps: - - checkout - - run: | - echo $ENCODED_GOOGLE_CREDENTIALS | \ - base64 --decode > $GOOGLE_APPLICATION_CREDENTIALS - - run: conda install make - - run: make update_submodules - - run: make create_environment - - run: | - source activate fv3net - pytest -m "not regression" --mpl --mpl-baseline-path=tests/baseline_images + - checkout + - run: + name: "Save GCS for tests." + command: | + echo $ENCODED_GOOGLE_CREDENTIALS | \ + base64 --decode > $GOOGLE_APPLICATION_CREDENTIALS + - run: make update_submodules + - run: + name: "Concatenate package dependency files" + command: cat environment.yml .circleci/.installed_build_env_deps > combined_deps.txt + - restore_cache: + keys: + - v2-fv3net-env-{{ checksum "combined_deps.txt" }} + - run: + name: "Install fv3net dependencies" + command: | + make install_deps + cat .circleci/.installed_build_env_deps + - save_cache: + key: v2-fv3net-env-{{ checksum "combined_deps.txt" }} + paths: + - /opt/conda/envs/fv3net + - run: + name: "Install fv3net packages" + command: make install_local_packages + - run: | + source activate fv3net + pytest -m "not regression" --mpl --mpl-baseline-path=tests/baseline_images + + build_default: + machine: + docker_layer_caching: true + environment: + GOOGLE_PROJECT_ID: vcm-ml + GOOGLE_COMPUTE_ZONE: us-central1 + GOOGLE_APPLICATION_CREDENTIALS: /tmp/key.json + steps: + - gcp-gcr/gcr-auth: + gcloud-service-key: DECODED_GOOGLE_CREDENTIALS + - checkout + - run: sudo apt-get install make + - run: + name: "Pull submodules" + command: | + git submodule update --init --recursive + - run: + name: Build fv3net images + command: | + if [[ -z "$CIRCLE_TAG" ]] + then + use_version="latest" + else + use_version=$CIRCLE_TAG + fi + make build_images VERSION=$use_version + - run: + name: Run tests in fv3net image + command: | + echo $DECODED_GOOGLE_CREDENTIALS > $GOOGLE_APPLICATION_CREDENTIALS + bash docker/fv3net/run_tests_in_image.sh $CIRCLE_TAG + - run: + name: Push fv3net images + command: | + echo $CIRCLE_BRANCH + echo $CIRCLE_TAG + if [[ "$CIRCLE_BRANCH" == "master" ]] + then + echo "pushing untagged images as 'latest'" + make push_images VERSION=latest + fi + if [[ ! -z "$CIRCLE_TAG" ]] + then + echo "pushing tagged images $CIRCLE_TAG" + make push_images VERSION=$CIRCLE_TAG + fi + lint: docker: - image: circleci/python:3.7 @@ -26,9 +94,29 @@ jobs: - checkout - run: sudo pip install black==19.10b0 flake8 - run: make lint + + workflows: version: 2 test_and_lint: jobs: - lint - - build + - pytest_default + build_and_push: + jobs: + - pytest_default: + filters: + tags: + only: /^v.*/ + branches: + only: master + - build_default: + requires: + - pytest_default + filters: + tags: + only: /^v.*/ + branches: + only: master + + diff --git a/.circleci/dockerfile b/.circleci/dockerfile index 5ba9143062..65d7b937e9 100644 --- a/.circleci/dockerfile +++ b/.circleci/dockerfile @@ -7,6 +7,9 @@ RUN apt-get install -y curl && \ dpkg -i linux-libc-dev.deb && \ rm -f linux-libc-dev.deb && \ apt-get install -y gfortran && \ - apt-get clean + apt-get install -y make && \ + apt-get clean && \ + conda update -n base conda && \ + conda clean -i CMD [ "/bin/bash" ] diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..d4a2c4405e --- /dev/null +++ b/.editorconfig @@ -0,0 +1,21 @@ +# http://editorconfig.org + +root = true + +[*] +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true +insert_final_newline = true +charset = utf-8 +end_of_line = lf + +[*.bat] +indent_style = tab +end_of_line = crlf + +[LICENSE] +insert_final_newline = false + +[Makefile] +indent_style = tab diff --git a/.environment-scripts/build_environment.sh b/.environment-scripts/build_environment.sh index a2e10ce0e5..43d7acd1cf 100755 --- a/.environment-scripts/build_environment.sh +++ b/.environment-scripts/build_environment.sh @@ -3,5 +3,6 @@ CONDA_ENV=$1 CONDA_BASE=$(conda info --base) -conda env create -n $CONDA_ENV -f environment.yml 2> /dev/null || \ +conda env create -n $CONDA_ENV -f environment.yml 2> /dev/null && \ + conda list -n $CONDA_ENV > .circleci/.installed_build_env_deps || \ echo "Conda env already exists proceeding to VCM package installation" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fea518f86f..51d2ab5e99 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,5 +1,8 @@ # Contributions Guides and Standards +Please record all changes and updates in [HISTORY.rst](./HISTORY.rst) under the +upcoming section. It is especially important to log changes that break backwards +compatibility so we can appropriately adjust the versioning. ## fv3net diff --git a/HISTORY.rst b/HISTORY.rst index 59077a786a..2036354d01 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,8 +4,10 @@ History Current ------- +* Added bump2version for automated versioning of `fv3net` resources +* Add CircleCI build/push capabilities for `fv3net` images + 0.1.0 (2020-03-20) ------------------ - * First release of fv3net diff --git a/MANIFEST.in b/MANIFEST.in index 065852ee15..95f6e132b0 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1,8 @@ -include fv3net/regression/sklearn/default_norm_outputs.dat \ No newline at end of file + +include HISTORY.rst +include LICENSE +include README.rst + +recursive-include tests * +recursive-exclude * __pycache__ +recursive-exclude * *.py[co] diff --git a/Makefile b/Makefile index e2ab8f5066..03648b5493 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,8 @@ ################################################################################# # GLOBALS # ################################################################################# -VERSION = v0.1.1 + +VERSION ?= v0.1.0 ENVIRONMENT_SCRIPTS = .environment-scripts PROJECT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) BUCKET = [OPTIONAL] your-bucket-for-syncing-data (do not include 's3://') @@ -23,22 +24,22 @@ endif ################################################################################# # COMMANDS # ################################################################################# -.PHONY: wheels build_images push_image -wheels: - pip wheel --no-deps . - pip wheel --no-deps external/vcm + +.PHONY: build_images push_image # pattern rule for building docker images build_image_%: - docker build -f docker/$*/Dockerfile . -t us.gcr.io/vcm-ml/$*:$(VERSION) + docker build . -f docker/$*/Dockerfile -t us.gcr.io/vcm-ml/$*:$(VERSION) -build_image_prognostic_run: wheels +enter_%: + docker run -ti -w /fv3net -v $(shell pwd):/fv3net us.gcr.io/vcm-ml/$*:$(VERSION) bash build_images: build_image_fv3net build_image_prognostic_run -push_image: - docker push us.gcr.io/vcm-ml/fv3net:$(VERSION) - docker push us.gcr.io/vcm-ml/prognostic_run:$(VERSION) +push_images: push_image_prognostic_run push_image_fv3net + +push_image_%: + docker push us.gcr.io/vcm-ml/$*:$(VERSION) enter: build_image docker run -it -v $(shell pwd):/code \ @@ -48,6 +49,9 @@ enter: build_image # -e GOOGLE_APPLICATION_CREDENTIALS=/google_creds.json \ # -v $(HOME)/.config/gcloud/application_default_credentials.json:/google_creds.json \ +build_ci_image: + docker build -t us.gcr.io/vcm-ml/circleci-miniconda-gfortran:latest - < .circleci/dockerfile + ## Make Dataset .PHONY: data update_submodules create_environment overwrite_baseline_images diff --git a/README.md b/README.md index 00601d57ae..c23d5039e7 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,12 @@ succesfully, the fv3net environment can be activated with conda activate fv3net +The `build_environment.sh` script also outputs a list of all installed dependencies +with their version under `.circleci/.installed_build_env_deps`. This file is used +along with `environment.yml` as a key for caching the `fv3net` dependencies. Whenver +`make create_environment` or the build script is run, this file will be updated +and committed to keep track of versions over time. + # Deploying cloud data pipelines The main data processing pipelines for this project currently utilize Google Cloud @@ -208,4 +214,14 @@ If it does not pass, than it can be autoformatted using make reformat -

Project based on the cookiecutter data science project template. #cookiecutterdatascience

+# How to contribute to fv3net + +Please see the [contribution guide.](./CONTRIBUTING.md) + +# How to get updates and releases + +For details on what's included or upcoming for a release, please see the [HISTORY.rst](./HISTORY.rst) document. + +For instructions on preparing a release, please read [RELEASE.rst](./RELEASE.rst). + +

Project based on the cookiecutter data science project template. #cookiecutterdatascience

\ No newline at end of file diff --git a/RELEASE.rst b/RELEASE.rst new file mode 100644 index 0000000000..946906546d --- /dev/null +++ b/RELEASE.rst @@ -0,0 +1,24 @@ +==================== +Release Instructions +==================== + +Release naming guidelines +------------------------- + +If `x.y.z` is the version, bump `y` (minor) on new features or breaking changes, and `z` on smaller changes. + +Release steps +------------- + +1. Prepare master branch for release (make sure all PRs are merged and tests pass). + +2. Create a branch for the version bump and run `bumpversion ` where part + is the section of the version to bump. I.e., for x.y.z, the corresponding "part" + would be "major" for x, "minor" for y, and "patch" for z. + This will create a new commit, having updated all version references to the new, + higher version. + +3. Push the bump branch to Github to open a PR. + +3. Merge this branch to master on Github and create a release version consistent + with the version bump. diff --git a/docker/fv3net/Dockerfile b/docker/fv3net/Dockerfile index d12deb541c..8aae5977e8 100644 --- a/docker/fv3net/Dockerfile +++ b/docker/fv3net/Dockerfile @@ -10,6 +10,7 @@ USER root RUN apt-get update && apt-get install -y gfortran ADD environment.yml $FV3NET/ ADD .environment-scripts $ENVIRONMENT_SCRIPTS +ADD .circleci $FV3NET/.circleci RUN fix-permissions $FV3NET WORKDIR $FV3NET diff --git a/docker/fv3net/run_tests_in_image.sh b/docker/fv3net/run_tests_in_image.sh new file mode 100755 index 0000000000..c515016b00 --- /dev/null +++ b/docker/fv3net/run_tests_in_image.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +FV3NET_IMAGE="us.gcr.io/vcm-ml/fv3net" + +set -e + +if [[ -z $1 ]]; then + VERSION_TAG="latest" +else + VERSION_TAG=$1 +fi + +if [[ -z $GOOGLE_APPLICATION_CREDENTIALS ]]; then + docker run -it $FV3NET_IMAGE:$VERSION_TAG py.test +else + docker run -v $GOOGLE_APPLICATION_CREDENTIALS:/tmp/json.key \ + --env GOOGLE_APPLICATION_CREDENTIALS=/tmp/json.key \ + -it $FV3NET_IMAGE:$VERSION_TAG "py.test" +fi \ No newline at end of file diff --git a/docker/prognostic_run/Dockerfile b/docker/prognostic_run/Dockerfile index 10eeca50e1..7bf03eb49c 100644 --- a/docker/prognostic_run/Dockerfile +++ b/docker/prognostic_run/Dockerfile @@ -3,6 +3,11 @@ FROM us.gcr.io/vcm-ml/fv3gfs-python:v0.3.1 COPY docker/prognostic_run/requirements.txt /tmp/requirements.txt RUN pip3 install -r /tmp/requirements.txt -COPY fv3net-0.1.0-py3-none-any.whl /wheels/fv3net-0.1.0-py3-none-any.whl -COPY vcm-0.1.0-py3-none-any.whl /wheels/vcm-0.1.0-py3-none-any.whl -RUN pip3 install --no-deps /wheels/fv3net-0.1.0-py3-none-any.whl && pip3 install /wheels/vcm-0.1.0-py3-none-any.whl + +# cache external package installation +COPY external/fv3config /fv3net/external/fv3config +COPY external/vcm /fv3net/external/vcm +RUN pip3 install -e /fv3net/external/vcm -e /fv3net/external/fv3config + +COPY . /fv3net +RUN pip3 install --no-deps -e /fv3net diff --git a/docker/prognostic_run/requirements.txt b/docker/prognostic_run/requirements.txt index 31775b90e4..629b2e3787 100644 --- a/docker/prognostic_run/requirements.txt +++ b/docker/prognostic_run/requirements.txt @@ -3,4 +3,5 @@ dask joblib zarr scikit-image +google-cloud-logging backoff diff --git a/environment.yml b/environment.yml index ae13d0cef8..b0dbed2127 100644 --- a/environment.yml +++ b/environment.yml @@ -45,7 +45,9 @@ dependencies: - python=3.7 - holoviews - bokeh=1.4 + - backoff - pip: - gsutil - nc-time-axis>=1.2.0 + - bump2version>=0.5.11 - yq diff --git a/external/vcm/HISTORY.rst b/external/vcm/HISTORY.rst index 76048dd6ce..48ad78de73 100644 --- a/external/vcm/HISTORY.rst +++ b/external/vcm/HISTORY.rst @@ -2,7 +2,10 @@ History ======= -0.1.0 (2019-10-11) ------------------- +Current +------- + -* First release on PyPI. +0.1.0 (2020-03-20) +------------------ +First VCM release (w/ fv3net for now) diff --git a/external/vcm/MANIFEST.in b/external/vcm/MANIFEST.in index 849804c3fb..1ee9e9352a 100644 --- a/external/vcm/MANIFEST.in +++ b/external/vcm/MANIFEST.in @@ -3,8 +3,6 @@ include HISTORY.rst include LICENSE include README.rst -recursive-include fv3config/data * - recursive-include tests * recursive-exclude * __pycache__ recursive-exclude * *.py[co] diff --git a/external/vcm/RELEASE.rst b/external/vcm/RELEASE.rst new file mode 100644 index 0000000000..fcdcb06ace --- /dev/null +++ b/external/vcm/RELEASE.rst @@ -0,0 +1,6 @@ +==================== +Release Instructions +==================== + +Currently, `vcm` releases are tied to `fv3net`. Please see that documentation +for release guidelines. [`fv3net` release](../../../RELEASE.rst) diff --git a/fv3net/__init__.py b/fv3net/__init__.py index d2f8e47558..457fa6a713 100644 --- a/fv3net/__init__.py +++ b/fv3net/__init__.py @@ -1,6 +1,7 @@ import pathlib +__author__ = """Vulcan Technologies LLC""" +__version__ = "0.1.0" + TOP_LEVEL_DIR = pathlib.Path(__file__).parent.parent.absolute() COARSENED_DIAGS_ZARR_NAME = "gfsphysics_15min_coarse.zarr" - -__version__ = "0.1.0" diff --git a/setup.cfg b/setup.cfg index 0374c3e79c..3e351a8ab2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,48 @@ +[bumpversion] +current_version = 0.1.0 +commit = True +tag = False + +[bumpversion:file:setup.py] +search = version="{current_version}" +replace = version="{new_version}" + +[bumpversion:file:fv3net/__init__.py] +search = {current_version} +replace = {new_version} + +[bumpversion:file:Makefile] +search = VERSION ?= v{current_version} +replace = VERSION ?= v{new_version} + +[bumpversion:file:docker/prognostic_run/Dockerfile] +search = -{current_version}- +replace = -{new_version}- + +[bumpversion:file:workflows/coarsen_restarts/submit_job.sh] +search = vcm-{current_version} +replace = vcm-{new_version} + +[bumpversion:file:workflows/create_training_data/submit_job.sh] +search = vcm-{current_version} +replace = vcm-{new_version} + +[bumpversion:file:workflows/diagnostics_to_zarr/submit_job.sh] +search = vcm-{current_version} +replace = vcm-{new_version} + +[bumpversion:file:workflows/extract_tars/submit_job.sh] +search = vcm-{current_version} +replace = vcm-{new_version} + +[bumpversion:file:workflows/end_to_end/dataflow.py] +search = vcm-{current_version} +replace = vcm-{new_version} + +[bumpversion:file:workflows/prognostic_run_diags/argo.yaml] +search = fv3net:v{current_version} +replace = fv3net:v{new_version} + [flake8] exclude = docs ignore = E203,W293,W503