Skip to content

Commit

Permalink
Pull request #23: DAS-IP: Adds pre-commit hooks
Browse files Browse the repository at this point in the history
Merge in SITC/harmony-browse-image-generator from mhs/DAS-IP/add-pre-commit-darker to main
  • Loading branch information
flamingbear committed Jan 4, 2024
1 parent 69472d5 commit 586d30a
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 16 deletions.
19 changes: 19 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/akaihola/darker
rev: 1.7.2
hooks:
- id: darker
args:
- --isort
- --skip-string-normalization
additional_dependencies:
- isort~=5.13.1
49 changes: 33 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,41 @@ Image Browse Services (GIBS).
## Repository structure:

```
|- .pre-commit-config.yaml
|- CHANGELOG.md
|- README.md
|- bin
|- conda_requirements.txt
|- dev-requirements.txt
|- docker
|- docs
|- harmony_browse_image_generator
|- CHANGELOG.md
|- conda_requirements.txt
|- pip_requirements.txt
|- README.md
|- tests
```

* bin - A directory containing utility scripts to build the service and test
images. This also includes scripts that Bamboo uses to deploy new service
images to AWS ECR.
* CHANGELOG.md - This file contains a record of changes applied to each new
* `.pre-commit-config` - a pre-commit configuration file describing functions to
be run on every git commit.
* `CHANGELOG.md` - This file contains a record of changes applied to each new
release of a service Docker image. Any release of a new service version
should have a record of what was changed in this file.
* README.md - This file, containing guidance on developing the service.
* docker - A directory containing the Dockerfiles for the service and test
* `README.md` - This file, containing guidance on developing the service.
* `bin` - A directory containing utility scripts to build the service and test
images. This also includes scripts that Bamboo uses to deploy new service
images to AWS ECR.
* `conda_requirements.txt` - A list of service dependencies, such as GDAL, that
cannot be installed via Pip.
* `dev-requirements.txt` - list of packages required for service development.
* `docker` - A directory containing the Dockerfiles for the service and test
images. It also contains `service_version.txt`, which contains the semantic
version number of the service image. Any time an update is made that should
have an accompanying service image release, this file should be updated.
* harmony_browse_image_generator - The directory containing Python source code
* `docs` - directory with example usage notebooks.
* `harmony_browse_image_generator` - The directory containing Python source code
for the HyBIG. `adapter.py` contains the `BrowseImageGeneratorAdapter`
class that is invoked by calls to the service.
* conda_requirements.txt - A list of service dependencies, such as GDAL, that
cannot be installed via Pip.
* pip_requirements.txt - A list of service Python package dependencies.
* tests - A directory containing the service unit test suite.
* `pip_requirements.txt` - A list of service Python package dependencies.
* `tests` - A directory containing the service unit test suite.

## Local development:

Expand All @@ -44,8 +51,18 @@ regarding creation of a local Harmony instance.

If testing small functions locally that do not require inputs from the main
Harmony application, it is recommended that you create a Python virtual
environment via conda, and install the necessary dependencies for the service
within that environment via conda or Pip.
environment via conda, and then install the necessary dependencies for the
service within that environment via conda and pip then install the pre-commit hooks.

```
> conda create -name hybig-env python==3.11
> conda install --file conda_requirements.txt
> pip install -r pip_requirements.txt
> pip install -r dev-requirements.txt
> pre-commit install
```


## Tests:

Expand Down
1 change: 1 addition & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pre-commit==3.4.0

0 comments on commit 586d30a

Please sign in to comment.