Skip to content

Commit 05373e7

Browse files
Update project settings (#169)
1 parent 9d148d4 commit 05373e7

25 files changed

+315
-47
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ coverage.xml
4444
*.cover
4545
*.py,cover
4646
.pytest_cache/
47+
pytest.xml
4748

4849
# Translations
4950
*.mo

.pre-commit-config.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
repos:
99
- repo: https://github.com/astral-sh/ruff-pre-commit
10-
rev: v0.11.0
10+
rev: v0.11.13
1111
hooks:
1212
- id: ruff
1313
args:
@@ -29,6 +29,10 @@ repos:
2929
hooks:
3030
- id: codespell
3131
additional_dependencies: [tomli]
32+
- repo: https://github.com/gitleaks/gitleaks
33+
rev: v8.21.2
34+
hooks:
35+
- id: gitleaks
3236
- repo: https://github.com/pre-commit/pre-commit-hooks
3337
rev: v5.0.0
3438
hooks:
@@ -85,4 +89,8 @@ repos:
8589
- --max-average=B
8690
- --max-modules=B
8791
- --max-absolute=C
92+
- repo: https://github.com/rbubley/mirrors-prettier
93+
rev: v3.3.3
94+
hooks:
95+
- id: prettier
8896
exclude: '\.nc$|^tests/fixture/|\.ipynb$'

CHANGELOG.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136

137137
**Implemented enhancements:**
138138

139-
- Add a command-line interface [\#82](https://github.com/btschwertfeger/python-cmethods/issues/82)
139+
- Add a command-line interface [\#82](https://github.com/btschwertfeger/python-cmethods/issues/82)
140140
- Resolve "Add a command-line interface" [\#83](https://github.com/btschwertfeger/python-cmethods/pull/83) ([btschwertfeger](https://github.com/btschwertfeger))
141141

142142
**Merged pull requests:**
@@ -175,7 +175,7 @@
175175

176176
**Closed issues:**
177177

178-
- The latest documentation still describes the legacy max\_scaling\_factor [\#60](https://github.com/btschwertfeger/python-cmethods/issues/60)
178+
- The latest documentation still describes the legacy max_scaling_factor [\#60](https://github.com/btschwertfeger/python-cmethods/issues/60)
179179

180180
**Merged pull requests:**
181181

@@ -223,7 +223,7 @@
223223

224224
**Merged pull requests:**
225225

226-
- Clarified difference between stochastic and non-stochastic climate variables in doc and readme [\#36](https://github.com/btschwertfeger/python-cmethods/pull/36) ([btschwertfeger](https://github.com/btschwertfeger))
226+
- Clarified difference between stochastic and non-stochastic climate variables in doc and readme [\#36](https://github.com/btschwertfeger/python-cmethods/pull/36) ([btschwertfeger](https://github.com/btschwertfeger))
227227
- Fix typos [\#38](https://github.com/btschwertfeger/python-cmethods/pull/38) ([btschwertfeger](https://github.com/btschwertfeger))
228228

229229
## [v1.0.1](https://github.com/btschwertfeger/python-cmethods/tree/v1.0.1) (2023-04-17)
@@ -237,7 +237,7 @@
237237

238238
**Fixed bugs:**
239239

240-
- Multiplicative Quantile Delta Mapping is not applying scaling where the delta is infinite [\#32](https://github.com/btschwertfeger/python-cmethods/issues/32)
240+
- Multiplicative Quantile Delta Mapping is not applying scaling where the delta is infinite [\#32](https://github.com/btschwertfeger/python-cmethods/issues/32)
241241
- Fixed PyPI repository URL [\#16](https://github.com/btschwertfeger/python-cmethods/pull/16) ([btschwertfeger](https://github.com/btschwertfeger))
242242
- Fixed bug where division lead to nan or inf values [\#33](https://github.com/btschwertfeger/python-cmethods/pull/33) ([btschwertfeger](https://github.com/btschwertfeger))
243243

@@ -257,7 +257,7 @@
257257

258258
**Breaking changes:**
259259

260-
- Remove the unnecessary `CMethods.py` module to access the CMethods class more easily [\#10](https://github.com/btschwertfeger/python-cmethods/issues/10)
260+
- Remove the unnecessary `CMethods.py` module to access the CMethods class more easily [\#10](https://github.com/btschwertfeger/python-cmethods/issues/10)
261261

262262
**Implemented enhancements:**
263263

@@ -282,7 +282,7 @@
282282

283283
**Breaking changes:**
284284

285-
- adjust\_3d forces group to be "time.month" if group is set to the default \(None\) [\#5](https://github.com/btschwertfeger/python-cmethods/issues/5)
285+
- adjust_3d forces group to be "time.month" if group is set to the default \(None\) [\#5](https://github.com/btschwertfeger/python-cmethods/issues/5)
286286

287287
**Implemented enhancements:**
288288

@@ -340,6 +340,4 @@
340340

341341
[Full Changelog](https://github.com/btschwertfeger/python-cmethods/compare/41c1837e5d23c300656c8ee2ce0079d6a8baac2f...v0.5)
342342

343-
344-
345-
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
343+
\* _This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)_

Makefile

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,47 @@
66
# https://github.com/btschwertfeger
77
#
88

9-
VENV := venv
9+
UV := uv
1010
PYTHON := python
11+
PYTEST := $(UV) run pytest
1112
TESTS := tests
12-
PYTEST_OPTS := -vv
13-
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
13+
PYTEST_OPTS := -vv --junit-xml=pytest.xml
14+
PYTEST_COV_OPTS := $(PYTEST_OPTS) --cov=cmethods --cov-report=xml:coverage.xml --cov-report=term
1415

16+
## ======= M A K E F I L E - T A R G E T S =====================================
17+
## help Show this help message
18+
##
1519
.PHONY: help
1620
help:
1721
@grep "^##" Makefile | sed -e "s/##//"
1822

19-
## build Builds python-cmethods
23+
## ======= B U I L D I N G =====================================================
24+
## build Builds the package
2025
##
2126
.PHONY: build
2227
build:
2328
$(PYTHON) -m build .
2429

30+
## rebuild Rebuild the package
31+
##
32+
.PHONY: rebuild
33+
rebuild: clean build
34+
35+
## ======= I N S T A L L A T I O N =============================================
36+
## install Install the package
37+
##
38+
.PHONY: install
39+
install: check-uv
40+
$(UV) pip install .
41+
2542
## dev Installs the package in edit mode
2643
##
2744
.PHONY: dev
2845
dev:
2946
@git lfs install
30-
$(PYTHON) -m pip install -e ".[dev,test,jupyter,examples]" -r doc/requirements.txt
31-
32-
## install Install the package
33-
##
34-
.PHONY: install
35-
install:
36-
$(PYTHON) -m pip install .
47+
$(UV) pip install -e ".[dev,test,jupyter,examples]" -r doc/requirements.txt
3748

49+
## ======= T E S T I N G =======================================================
3850
## test Run the unit tests
3951
##
4052
.PHONY: test
@@ -50,13 +62,18 @@ tests: test
5062
retest:
5163
$(PYTHON) -m pytest $(PYTEST_OPTS) --lf $(TESTS)
5264

53-
5465
## wip Run tests marked as wip
5566
##
5667
.PHONY: wip
5768
wip:
5869
$(PYTHON) -m pytest $(PYTEST_OPTS) -m "wip" $(TESTS)
5970

71+
## coverage Run all tests and generate the coverage report
72+
##
73+
.PHONY: coverage
74+
coverage:
75+
$(PYTEST) $(PYTEST_COV_OPTS) $(TEST_DIR)
76+
6077
## doc Build the documentation
6178
##
6279
.PHONY: doc
@@ -69,7 +86,8 @@ doc:
6986
doctest:
7087
cd doc && make doctest
7188

72-
## pre-commit Pre-Commit
89+
## ======= M I S C E L A N I O U S =============================================
90+
## pre-commit Run the pre-commit targets
7391
##
7492
.PHONY: pre-commit
7593
pre-commit:
@@ -92,7 +110,7 @@ ruff-fix:
92110
.PHONY: changelog
93111
changelog:
94112
docker run -it --rm \
95-
-v $(ROOT_DIR):/usr/local/src/your-app/ \
113+
-v $(PWD):/usr/local/src/your-app/ \
96114
githubchangeloggenerator/github-changelog-generator \
97115
-u btschwertfeger \
98116
-p python-cmethods \
@@ -115,3 +133,12 @@ clean:
115133
find tests -name "__pycache__" | xargs rm -rf
116134
find cmethods -name "__pycache__" | xargs rm -rf
117135
find examples -name "__pycache__" | xargs rm -rf
136+
137+
## check-uv Check if uv is installed
138+
##
139+
.PHONY: check-uv
140+
check-uv:
141+
@if ! command -v $(UV) >/dev/null; then \
142+
echo "Error: uv is not installed. Please visit https://github.com/astral-sh/uv for installation instructions."; \
143+
exit 1; \
144+
fi

cmethods/__init__.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
# -*- mode: python; coding: utf-8 -*-
22
#
33
# Copyright (C) 2023 Benjamin Thomas Schwertfeger
4-
# All rights reserved.
54
# https://github.com/btschwertfeger
65
#
6+
# This program is free software: you can redistribute it and/or modify
7+
# it under the terms of the GNU General Public License as published by
8+
# the Free Software Foundation, either version 3 of the License, or
9+
# (at your option) any later version.
10+
#
11+
# This program is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU General Public License
17+
# along with this program. If not, see
18+
# https://www.gnu.org/licenses/gpl-3.0.html.
19+
#
720
# pylint: disable=consider-using-f-string,logging-not-lazy
821

922
r"""

cmethods/core.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
# -*- mode: python; coding: utf-8 -*-
22
#
33
# Copyright (C) 2024 Benjamin Thomas Schwertfeger
4-
# All rights reserved.
54
# https://github.com/btschwertfeger
65
#
6+
# This program is free software: you can redistribute it and/or modify
7+
# it under the terms of the GNU General Public License as published by
8+
# the Free Software Foundation, either version 3 of the License, or
9+
# (at your option) any later version.
10+
#
11+
# This program is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU General Public License
17+
# along with this program. If not, see
18+
# https://www.gnu.org/licenses/gpl-3.0.html.
19+
#
720

821
"""
922
Module providing the main function that is used to apply the implemented bias

cmethods/distribution.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
# -*- mode: python; coding: utf-8 -*-
22
#
33
# Copyright (C) 2024 Benjamin Thomas Schwertfeger
4-
# All rights reserved.
54
# https://github.com/btschwertfeger
65
#
6+
# This program is free software: you can redistribute it and/or modify
7+
# it under the terms of the GNU General Public License as published by
8+
# the Free Software Foundation, either version 3 of the License, or
9+
# (at your option) any later version.
10+
#
11+
# This program is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU General Public License
17+
# along with this program. If not, see
18+
# https://www.gnu.org/licenses/gpl-3.0.html.
19+
#
720

821
"""
922
Module providing functions for distribution-based bias adjustments. Functions are not

cmethods/scaling.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
# -*- mode: python; coding: utf-8 -*-
22
#
33
# Copyright (C) 2024 Benjamin Thomas Schwertfeger
4-
# All rights reserved.
54
# https://github.com/btschwertfeger
65
#
6+
# This program is free software: you can redistribute it and/or modify
7+
# it under the terms of the GNU General Public License as published by
8+
# the Free Software Foundation, either version 3 of the License, or
9+
# (at your option) any later version.
10+
#
11+
# This program is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU General Public License
17+
# along with this program. If not, see
18+
# https://www.gnu.org/licenses/gpl-3.0.html.
19+
#
720

821
"""
922
Module providing functions for scaling-based bias adjustments. Functions are not

cmethods/static.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
# -*- mode: python; coding: utf-8 -*-
22
#
33
# Copyright (C) 2023 Benjamin Thomas Schwertfeger
4-
# All rights reserved.
54
# https://github.com/btschwertfeger
65
#
6+
# This program is free software: you can redistribute it and/or modify
7+
# it under the terms of the GNU General Public License as published by
8+
# the Free Software Foundation, either version 3 of the License, or
9+
# (at your option) any later version.
10+
#
11+
# This program is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU General Public License
17+
# along with this program. If not, see
18+
# https://www.gnu.org/licenses/gpl-3.0.html.
19+
#
720

821
"""Module providing static information for the python-cmethods package"""
922

cmethods/types.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
# -*- mode: python; coding: utf-8 -*-
22
#
33
# Copyright (C) 2023 Benjamin Thomas Schwertfeger
4-
# All rights reserved.
54
# https://github.com/btschwertfeger
65
#
6+
# This program is free software: you can redistribute it and/or modify
7+
# it under the terms of the GNU General Public License as published by
8+
# the Free Software Foundation, either version 3 of the License, or
9+
# (at your option) any later version.
10+
#
11+
# This program is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU General Public License
17+
# along with this program. If not, see
18+
# https://www.gnu.org/licenses/gpl-3.0.html.
19+
#
720

821
"""Module providing custom types"""
922

0 commit comments

Comments
 (0)