diff --git a/README.md b/README.md index 6e63f65..8f742a7 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,5 @@ bin/test Run an example: ``` -pip install -U "python-dotenv[cli]" dotenv python -m harmony_netcdf_to_zarr --harmony-action invoke --harmony-input "`cat example/harmony-operation.json`" ``` \ No newline at end of file diff --git a/bin/push-image b/bin/push-image index d9aaffe..df7223e 100755 --- a/bin/push-image +++ b/bin/push-image @@ -5,7 +5,7 @@ set -ex image="harmony/netcdf-to-zarr" tag=${1:-latest} -region=${AWS_DEFAULT_REGION-"us-west-2"} +region=${AWS_DEFAULT_REGION:-"us-west-2"} account=$(aws sts get-caller-identity --output text --query 'Account') # Need to remove \r returned on all aws commands run from Bamboo diff --git a/bin/repl-with-zarr-opener b/bin/repl-with-zarr-opener index 3ffe93a..a5c3d33 100755 --- a/bin/repl-with-zarr-opener +++ b/bin/repl-with-zarr-opener @@ -18,8 +18,8 @@ def open_localstack_zarr(name): client_kwargs=dict( region_name='us-west-2', endpoint_url='http://localhost:4572', - aws_access_key_id='ACCESS_KEY', - aws_secret_access_key='SECRET_KEY')) + aws_access_key_id='DUMMY_ACCESS_KEY', + aws_secret_access_key='DUMMY_SECRET_KEY')) store = fs.get_mapper(root=name, check=False) return zarr.open(store) EOF)" diff --git a/bin/run-in-docker b/bin/run-in-docker index 6e6d58f..024baa5 100755 --- a/bin/run-in-docker +++ b/bin/run-in-docker @@ -1,11 +1,20 @@ #!/bin/bash +# This script mounts the contents of the current directory, and optionally the Python library in a peer +# directory into the Harmony docker image and runs it. It is meant to allow development and testing +# without repeatedly rebuilding the docker image. To run a completely clean container using only what +# is in the image, as will be done in deployed environments, run +# `docker run --rm -it --env-file=.env harmony/netcdf-to-zarr` + set -ex find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf +# CLI flags. Mount the current directory into the docker container's working directory args="-v $(pwd):/home" +# If a peer directory exists for the Harmony python library, also mount it into the container, otherwise +# it will use the version installed when the container was built if [ -d ../harmony-service-lib-py ]; then (cd ../harmony-service-lib-py && make clean) args="$args -v $(pwd)/../harmony-service-lib-py/harmony:/usr/lib/harmony-service-lib-py/harmony" diff --git a/bin/test-in-docker b/bin/test-in-docker index f465356..4ee6f01 100755 --- a/bin/test-in-docker +++ b/bin/test-in-docker @@ -2,6 +2,12 @@ set -e +# This script mounts the contents of the current directory, and optionally the Python library in a peer +# directory into the Harmony docker image and runs the test suite. It is meant to allow development and +# testing without repeatedly rebuilding the docker image. To run a completely clean container using only +# what is in the image, as will be done in CI environments, run +# `docker run --rm -it --env-file=.env harmony/netcdf-to-zarr-tests` + find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf args="-v $(pwd):/home" diff --git a/example/dotenv b/example/dotenv index a37b6f7..e4ef041 100644 --- a/example/dotenv +++ b/example/dotenv @@ -1,4 +1,4 @@ -# The environent. If set to "dev" or "test" the code will not attempt to call back to +# The environment. If set to "dev" or "test" the code will not attempt to call back to # Harmony and will instead log the callbacks that would have been made. ENV=dev diff --git a/harmony_netcdf_to_zarr/__main__.py b/harmony_netcdf_to_zarr/__main__.py index cc17ded..1bed76e 100644 --- a/harmony_netcdf_to_zarr/__main__.py +++ b/harmony_netcdf_to_zarr/__main__.py @@ -3,7 +3,7 @@ __main__.py ========= -Runs the harmony_gdal CLI +Runs the harmony_netcdf_to_zarr CLI """ import sys diff --git a/requirements/dev.txt b/requirements/dev.txt index cc536f5..0781389 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,4 +1,5 @@ pytest >= 5.1.2 safety >= 1.8.5 coverage >= 4.5.4 -moto >= 1.3.14 \ No newline at end of file +moto >= 1.3.14 +python-dotenv>=0.12.0 diff --git a/tests/util/file_creation.py b/tests/util/file_creation.py index 43c9612..3349439 100644 --- a/tests/util/file_creation.py +++ b/tests/util/file_creation.py @@ -71,7 +71,6 @@ def create_full_dataset(filename=None): [ -5.5, 0.0, 5.5], [-11.0, -5.5, 0.0] ] - #lats.make_scale('lat') lons[:, :] = np.rot90(lats, 3, axes=(0, 1)) times[0] = 166536 # January 1st 2020