Skip to content

Commit 53a8c13

Browse files
Merge pull request #32 from ecmwf/fix/simplify_dependencies
Fix/simplify dependencies
2 parents 8f4b738 + 1fa34c6 commit 53a8c13

11 files changed

+128
-118
lines changed

.flake8

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,29 @@ on:
77
branches: [ "main", "develop" ]
88

99
jobs:
10-
10+
1111
quality_assurance:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/checkout@v2
15-
- run: pip install black flake8 isort
16-
- run: isort --check .
17-
- run: black --check .
18-
- run: flake8 .
19-
15+
- run: pip install ruff
16+
- run: ruff check
17+
2018
docs:
2119
runs-on: ubuntu-latest
2220
steps:
2321
- uses: actions/checkout@v2
2422
- run: pip install -r docs/requirements.txt
2523
- run: mkdocs build
26-
24+
2725
setup_and_test:
2826
runs-on: ubuntu-latest
2927
steps:
30-
- uses: actions/checkout@v2
31-
- uses: mamba-org/setup-micromamba@v1
32-
with:
33-
activate-environment: test
34-
environment-file: environment.yml
35-
auto-activate-base: false
28+
- uses: actions/checkout@v3
29+
- uses: actions/setup-python@v2
3630
- name: install hat package
3731
shell: bash -l {0}
38-
run: pip install .
32+
run: pip install .[test]
3933
- name: run tests
4034
shell: bash -l {0}
41-
run: |
42-
pip install pytest
43-
pytest
35+
run: pytest

.github/workflows/on-push.yml

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,40 +23,41 @@ jobs:
2323
name: setup
2424
runs-on: ubuntu-latest
2525
steps:
26-
- uses: actions/checkout@v2
26+
- uses: actions/checkout@v3
2727
- uses: actions/setup-python@v2
28-
- run: python -m pip install .
28+
- name: install hat package
29+
shell: bash -l {0}
30+
run: pip install .
2931

3032
test:
3133
name: test
3234
runs-on: ubuntu-latest
35+
needs: [setup]
3336
steps:
34-
- uses: actions/checkout@v2
35-
- uses: mamba-org/setup-micromamba@v1
36-
with:
37-
activate-environment: test
38-
environment-file: environment.yml
39-
auto-activate-base: false
40-
- name: install hat package
37+
- uses: actions/checkout@v3
38+
- uses: actions/setup-python@v2
39+
- name: developer install of hat package
4140
shell: bash -l {0}
42-
run: pip install .
41+
run: pip install .[test]
4342
- name: run tests
4443
shell: bash -l {0}
45-
run: |
46-
pip install pytest
47-
pytest
44+
run: pytest
4845

4946
distribution:
47+
name: distribution
5048
runs-on: ubuntu-latest
51-
needs: [setup, test]
52-
49+
needs: [setup]
5350
steps:
5451
- uses: actions/checkout@v3
55-
- name: Build distributions
52+
- uses: actions/setup-python@v2
53+
- name: install hat package
54+
shell: bash -l {0}
55+
run: pip install .
56+
- name: build distributions
5657
run: |
57-
$CONDA/bin/python -m pip install build
58-
$CONDA/bin/python -m build
59-
- name: Publish a Python distribution to PyPI
58+
pip install build
59+
python build
60+
- name: publish a Python distribution to PyPI
6061
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
6162
uses: pypa/gh-action-pypi-publish@release/v1
6263
with:

.pre-commit-config.yaml

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,31 @@
1+
default_language_version:
2+
python: python3
3+
default_stages:
4+
- commit
5+
- push
16
repos:
2-
- repo: https://github.com/pycqa/isort
3-
rev: 5.12.0
4-
hooks:
5-
- id: isort
6-
- repo: https://github.com/psf/black
7-
rev: 23.3.0
8-
hooks:
9-
- id: black
10-
# - repo: https://github.com/PyCQA/flake8
11-
# rev: 6.0.0
12-
# hooks:
13-
# - id: flake8
7+
- repo: https://github.com/charliermarsh/ruff-pre-commit
8+
rev: v0.5.6
9+
hooks:
10+
- id: ruff
11+
args: [ --fix ]
12+
- id: ruff-format
13+
- repo: https://github.com/pre-commit/pre-commit-hooks
14+
rev: v4.4.0
15+
hooks:
16+
- id: detect-private-key
17+
- id: check-ast
18+
- id: end-of-file-fixer
19+
- id: mixed-line-ending
20+
args: [--fix=lf]
21+
- id: trailing-whitespace
22+
- id: check-case-conflict
23+
- repo: local
24+
hooks:
25+
- id: forbid-to-commit
26+
name: Don't commit rej files
27+
entry: |
28+
Cannot commit .rej files. These indicate merge conflicts that arise during automated template updates.
29+
Fix the merge conflicts manually and remove the .rej files.
30+
language: fail
31+
files: '.*\.rej$'

README.md

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# HAT - Hydrological Analysis Toolkit
22

3-
HAT is a suite of tools to perform data analysis on hydrological datasets.
3+
The Hydrological Analysis Toolkit (HAT) is a software suite for hydrologists working with simulated and observed river discharge. HAT performs data analysis on hydrological datasets, with its main features being:
4+
- mapping station locations into hydrological model grids
5+
- extraction of timeseries
6+
- statistical analysis of hydrological timeseries
47

58
The documentation can be found at https://hydro-analysis-toolkit.readthedocs.io
69

7-
810
**DISCLAIMER**
911
This project is **BETA** and will be **Experimental** for the foreseeable future.
1012
Interfaces and functionality are likely to change, and the project itself may be scrapped.
@@ -15,28 +17,53 @@ Interfaces and functionality are likely to change, and the project itself may be
1517
Clone source code repository
1618

1719
$ git clone https://github.com/ecmwf/hat.git
20+
$ cd hat
1821

19-
Create conda python environment
22+
Create and activate conda environment
23+
24+
$ conda env create -n hat python=3.10
25+
$ conda activate hat
26+
27+
For default installation, run
2028

21-
$ cd hat
22-
$ conda env create -f environment.yml
2329
$ pip install .
2430

25-
### Usage
31+
For a developer installation (includes linting and test libraries), run
2632

27-
Start a hat environment
33+
$ pip install .[dev]
34+
$ pre-commit install
35+
36+
If you only plan to run the tests, instead run
37+
38+
$ pip install .[test]
39+
40+
If you plan to build a source and a wheel distribution, it is additionally required to run
41+
42+
$ pip install build
43+
44+
### Usage
2845

29-
$ conda activate hat
30-
3146
Run a command line tool
3247

3348
$ hat-extract-timeseries --help
3449

50+
### Running the tests
51+
52+
Tests are stored in the `tests/` folder and can be run with
53+
54+
$ pytest
55+
56+
### Deployment
57+
58+
To build a source and a wheel distribution, run
59+
60+
$ python build
61+
3562
### Contributing
3663

37-
The main repository is hosted on [GitHub](https://github.com/ecmwf/hat), testing, bug reports and contributions are highly welcomed and appreciated.
64+
The main repository is hosted on [GitHub](https://github.com/ecmwf/hat). Testing, bug reports and contributions are highly welcomed and appreciated.
3865

39-
Please report [bug](https://github.com/ecmwf/hat/issues) reports or [pull-requests](https://github.com/ecmwf/hat/pulls) on [GitHub](https://github.com/ecmwf/hat)
66+
Please report [bug](https://github.com/ecmwf/hat/issues) reports or [pull-requests](https://github.com/ecmwf/hat/pulls) on [GitHub](https://github.com/ecmwf/hat).
4067

4168
We want your feedback, please e-mail: [email protected]
4269

docs/index.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
# Welcome to HAT
22

3-
Hydrological Analysis Tools (HAT) is a suite of software for hydrologists working with simulated and observed river discharge.
3+
The Hydrological Analysis Toolkit (HAT) is a software suite for hydrologists working with simulated and observed river discharge. HAT performs data analysis on hydrological datasets, with its main features being:
4+
- mapping station locations into hydrological model grids
5+
- extraction of timeseries
6+
- statistical analysis of hydrological timeseries

docs/installation.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,16 @@
22

33
Clone source code repository
44

5-
git clone [email protected]:ecmwf-projects/hat.git
5+
git clone https://github.com/ecmwf/hat.git
6+
cd hat
67

78
Create conda python environment
89

9-
cd hat
10-
1110
# If on HPC..
1211
# module load conda
13-
14-
conda env create -f environment.yml
12+
conda env create -n hat python=3.10
1513
conda activate hat
1614

17-
Install HAT software
15+
Installation of required dependencies
1816

1917
pip install .
20-
21-
Open a new terminal to start

docs/usage.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
If you have already [installed](installation.md) hat then
44

5-
#### Activate environment
5+
#### Activate Environment
66

77
$ conda activate hat
88

@@ -21,4 +21,3 @@ In your python code you can import the hat module
2121
import hat
2222

2323
For examples, please see these [jupyter notebooks](https://github.com/ecmwf-projects/hat/tree/main/notebooks)
24-

environment.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

mkdocs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
site_name: Hydrological Analysis Tools
1+
site_name: Hydrological Analysis Toolkit
22
site_url: https://ecmwf.github.io/hat/
33

44
nav:
@@ -10,4 +10,4 @@ nav:
1010
- hat-extract-timeseries: hat_extract-timeseries.md
1111
- hat-hydrostats: hat_hydrostats.md
1212

13-
theme: readthedocs
13+
theme: readthedocs

pyproject.toml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
[build-system]
32
requires = ["setuptools>=65", "setuptools_scm[toml]>=6.2"]
43
build-backend = "setuptools.build_meta"
@@ -40,7 +39,12 @@ dependencies = [
4039
"ipyleaflet",
4140
"ipywidgets",
4241
"earthkit-data",
43-
"cfgrib"
42+
"cfgrib",
43+
"netCDF4",
44+
"eccodes",
45+
"plotly",
46+
"jupyter",
47+
"geopy"
4448
]
4549

4650
[project.urls]
@@ -50,25 +54,27 @@ dependencies = [
5054

5155
[project.optional-dependencies]
5256
test = [
53-
"pytest",
57+
"pytest"
5458
]
55-
docs = [
56-
"mkdocs",
57-
"mkdocs-material",
58-
"mkdocstrings-python",
59-
"mkdocs-autorefs",
60-
"mkdocs-gen-files",
61-
"pymdown-extensions",
62-
"markdown-exec[ansi]",
59+
dev = [
60+
"pytest",
61+
"ruff",
62+
"pre-commit"
6363
]
6464

6565
[project.scripts]
6666
hat-extract-timeseries = "hat.tools.extract_simulation_timeseries_cli:main"
6767
hat-hydrostats = "hat.tools.hydrostats_cli:main"
6868
hat-stations-mapping = "hat.mapping.station_mapping:main"
6969

70-
[tool.isort]
71-
profile="black"
70+
# Linting settings
71+
[tool.ruff]
72+
line-length = 120
73+
indent-width = 4
74+
75+
[tool.ruff.format]
76+
quote-style = "double"
77+
indent-style = "space"
7278

7379
# Testing
7480
[tool.pytest]
@@ -98,4 +104,4 @@ write_to_template = '''
98104
__version__ = "{version}"
99105
'''
100106
parentdir_prefix_version='hat-' # get version from GitHub-like tarballs
101-
fallback_version='0.7.1'
107+
fallback_version='0.7.1'

0 commit comments

Comments
 (0)