cookiecutter-hydro 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cookiecutter_hydro-0.0.1/LICENSE +21 -0
- cookiecutter_hydro-0.0.1/PKG-INFO +74 -0
- cookiecutter_hydro-0.0.1/README.md +56 -0
- cookiecutter_hydro-0.0.1/cookiecutter.json +22 -0
- cookiecutter_hydro-0.0.1/cookiecutter_hydro/__init__.py +0 -0
- cookiecutter_hydro-0.0.1/cookiecutter_hydro/cli.py +9 -0
- cookiecutter_hydro-0.0.1/hooks/post_gen_project.py +37 -0
- cookiecutter_hydro-0.0.1/hooks/pre_gen_project.py +22 -0
- cookiecutter_hydro-0.0.1/pyproject.toml +122 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/.devcontainer/devcontainer.json +27 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/.devcontainer/postCreateCommand.sh +7 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/.editorconfig +5 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/.github/actions/setup-poetry-env/action.yml +42 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/.github/workflows/main.yml +50 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/.gitignore +167 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/.pre-commit-config.yaml +22 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/Dockerfile +21 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/LICENSE +111 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/Makefile +39 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/README.md +10 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/poetry.toml +2 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/pyproject.toml +100 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/tests/test_foo.py +5 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/tox.ini +18 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/__init__.py +0 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/data/README.md +14 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/data/__init__.py +13 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/data/boundaries/__init__.py +20 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/data/boundaries/processed/.gitkeep +0 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/data/boundaries/raw/.gitkeep +0 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/data/layers/processed/.gitkeep +0 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/data/layers/raw/.gitkeep +0 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/data/observations/processed/.gitkeep +0 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/data/observations/raw/.gitkeep +0 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/notebooks/.gitkeep +0 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/notebooks/README.md +9 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/output/__init__.py +13 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/references/refs.bib +0 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/reports/figures/.gitkeep +0 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/reports/report.md +0 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/src/.gitkeep +0 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/src/__init__.py +0 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/src/foo.py +17 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/src/modflow/.gitkeep +0 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/src/modflow/__init__.py +0 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/src/pastas/.gitkeep +0 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/src/pastas/__init__.py +0 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/src/swap/.gitkeep +0 -0
- cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/src/swap/__init__.py +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Florian Maas
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: cookiecutter-hydro
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A cookiecutter template for scientific Python projects in the field of hydrology.
|
|
5
|
+
Home-page: https://github.com/zawadzkim/cookiecutter-hydro
|
|
6
|
+
Keywords: cookiecutter,template,poetry
|
|
7
|
+
Author: Mateusz Zawadzki
|
|
8
|
+
Author-email: zawadzkimat@outlook.com
|
|
9
|
+
Requires-Python: >=3.11,<4.0
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Requires-Dist: cookiecutter (>=2.1.1,<3.0.0)
|
|
14
|
+
Project-URL: Documentation, https://zawadzkim.github.io/cookiecutter-hydro/
|
|
15
|
+
Project-URL: Repository, https://github.com/zawadzkim/cookiecutter-hydro
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
[](https://pypi.org/project/cookiecutter-hydro/)
|
|
19
|
+
[](https://github.com/zawadzkim/cookiecutter-hydro/actions/workflows/main.yml?query=branch%3Amain)
|
|
20
|
+
[](https://pypi.org/project/cookiecutter-hydro/)
|
|
21
|
+
[](https://zawadzkim.github.io/cookiecutter-hydro/)
|
|
22
|
+
[](https://img.shields.io/github/license/zawadzkim/cookiecutter-hydro)
|
|
23
|
+
|
|
24
|
+
## Main features
|
|
25
|
+
|
|
26
|
+
- [Poetry](https://python-poetry.org/) for dependency management
|
|
27
|
+
- [GitHub Actions](https://github.com/features/actions)
|
|
28
|
+
- Pre-commit hooks with [pre-commit](https://pre-commit.com/)
|
|
29
|
+
- Code quality with [ruff](https://github.com/charliermarsh/ruff), [mypy](https://mypy.readthedocs.io/en/stable/), [deptry](https://github.com/zawadzkim/deptry/) and [prettier](https://prettier.io/)
|
|
30
|
+
- Containerization with [Docker](https://www.docker.com/)
|
|
31
|
+
- Development environment with [VSCode devcontainers](https://code.visualstudio.com/docs/devcontainers/containers)
|
|
32
|
+
|
|
33
|
+
## Quickstart
|
|
34
|
+
|
|
35
|
+
On your local machine, navigate to the directory in which you want to
|
|
36
|
+
create a project directory, and run the following two commands:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install cookiecutter-hydro
|
|
40
|
+
cchydro
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Alternatively, install `cookiecutter` and directly pass the URL to this
|
|
44
|
+
Github repository to the `cookiecutter` command:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install cookiecutter
|
|
48
|
+
cookiecutter https://github.com/zawadzkim/cookiecutter-hydro.git
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Create a repository on GitHub, and then run the following commands, replacing `<project-name>`, with the name that you gave the Github repository and
|
|
52
|
+
`<github_author_handle>` with your Github username.
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
cd <project_name>
|
|
56
|
+
git init -b main
|
|
57
|
+
git add .
|
|
58
|
+
git commit -m "Init commit"
|
|
59
|
+
git remote add origin git@github.com:<github_author_handle>/<project_name>.git
|
|
60
|
+
git push -u origin main
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Finally, install the environment and the pre-commit hooks with
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
make install
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
You are now ready to start development on your project!
|
|
70
|
+
|
|
71
|
+
## Acknowledgements
|
|
72
|
+
|
|
73
|
+
This project is a fork of [Cookiecutter Poetry](https://github.com/zawadzkim/cookiecutter-hydro-example) and is partly inspired by [Cookiecutter Data Science](https://github.com/drivendataorg/cookiecutter-data-science) project, but is tailored for use in hydrological research.
|
|
74
|
+
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
[](https://pypi.org/project/cookiecutter-hydro/)
|
|
2
|
+
[](https://github.com/zawadzkim/cookiecutter-hydro/actions/workflows/main.yml?query=branch%3Amain)
|
|
3
|
+
[](https://pypi.org/project/cookiecutter-hydro/)
|
|
4
|
+
[](https://zawadzkim.github.io/cookiecutter-hydro/)
|
|
5
|
+
[](https://img.shields.io/github/license/zawadzkim/cookiecutter-hydro)
|
|
6
|
+
|
|
7
|
+
## Main features
|
|
8
|
+
|
|
9
|
+
- [Poetry](https://python-poetry.org/) for dependency management
|
|
10
|
+
- [GitHub Actions](https://github.com/features/actions)
|
|
11
|
+
- Pre-commit hooks with [pre-commit](https://pre-commit.com/)
|
|
12
|
+
- Code quality with [ruff](https://github.com/charliermarsh/ruff), [mypy](https://mypy.readthedocs.io/en/stable/), [deptry](https://github.com/zawadzkim/deptry/) and [prettier](https://prettier.io/)
|
|
13
|
+
- Containerization with [Docker](https://www.docker.com/)
|
|
14
|
+
- Development environment with [VSCode devcontainers](https://code.visualstudio.com/docs/devcontainers/containers)
|
|
15
|
+
|
|
16
|
+
## Quickstart
|
|
17
|
+
|
|
18
|
+
On your local machine, navigate to the directory in which you want to
|
|
19
|
+
create a project directory, and run the following two commands:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install cookiecutter-hydro
|
|
23
|
+
cchydro
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Alternatively, install `cookiecutter` and directly pass the URL to this
|
|
27
|
+
Github repository to the `cookiecutter` command:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install cookiecutter
|
|
31
|
+
cookiecutter https://github.com/zawadzkim/cookiecutter-hydro.git
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Create a repository on GitHub, and then run the following commands, replacing `<project-name>`, with the name that you gave the Github repository and
|
|
35
|
+
`<github_author_handle>` with your Github username.
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
cd <project_name>
|
|
39
|
+
git init -b main
|
|
40
|
+
git add .
|
|
41
|
+
git commit -m "Init commit"
|
|
42
|
+
git remote add origin git@github.com:<github_author_handle>/<project_name>.git
|
|
43
|
+
git push -u origin main
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Finally, install the environment and the pre-commit hooks with
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
make install
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
You are now ready to start development on your project!
|
|
53
|
+
|
|
54
|
+
## Acknowledgements
|
|
55
|
+
|
|
56
|
+
This project is a fork of [Cookiecutter Poetry](https://github.com/zawadzkim/cookiecutter-hydro-example) and is partly inspired by [Cookiecutter Data Science](https://github.com/drivendataorg/cookiecutter-data-science) project, but is tailored for use in hydrological research.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"author": "Mateusz Zawadzki",
|
|
3
|
+
"email": "zawadzkimat@outlook.com",
|
|
4
|
+
"author_github_handle": "zawadzkim",
|
|
5
|
+
"project_name": "example-project",
|
|
6
|
+
"project_slug": "{{cookiecutter.project_name|lower|replace('-', '_')}}",
|
|
7
|
+
"project_description": "This is a template repository for Python projects that use Poetry for their dependency management.",
|
|
8
|
+
"include_github_actions": ["y", "n"],
|
|
9
|
+
"deptry": ["y", "n"],
|
|
10
|
+
"dockerfile": ["y", "n"],
|
|
11
|
+
"devcontainer": ["y", "n"],
|
|
12
|
+
"model": ["flopy", "swap", "pastas", "None"],
|
|
13
|
+
"gensor": ["y", "n"],
|
|
14
|
+
"open_source_license": [
|
|
15
|
+
"MIT license",
|
|
16
|
+
"BSD license",
|
|
17
|
+
"ISC license",
|
|
18
|
+
"Apache Software License 2.0",
|
|
19
|
+
"GNU General Public License v3",
|
|
20
|
+
"Not open source"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
import shutil
|
|
6
|
+
|
|
7
|
+
PROJECT_DIRECTORY = os.path.realpath(os.path.curdir)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def remove_file(filepath: str) -> None:
|
|
11
|
+
os.remove(os.path.join(PROJECT_DIRECTORY, filepath))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def remove_dir(filepath: str) -> None:
|
|
15
|
+
shutil.rmtree(os.path.join(PROJECT_DIRECTORY, filepath))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
if __name__ == "__main__":
|
|
19
|
+
if "{{cookiecutter.include_github_actions}}" != "y":
|
|
20
|
+
remove_dir(".github")
|
|
21
|
+
|
|
22
|
+
if "{{cookiecutter.model}}" != "flopy":
|
|
23
|
+
remove_dir("{{cookiecutter.project_slug}}/src/modflow")
|
|
24
|
+
remove_dir("{{cookiecutter.project_slug}}/data/layers")
|
|
25
|
+
remove_dir("{{cookiecutter.project_slug}}/data/boundaries")
|
|
26
|
+
|
|
27
|
+
if "{{cookiecutter.model}}" != "swap":
|
|
28
|
+
remove_dir("{{cookiecutter.project_slug}}/src/swap")
|
|
29
|
+
|
|
30
|
+
if "{{cookiecutter.model}}" != "pastas":
|
|
31
|
+
remove_dir("{{cookiecutter.project_slug}}/src/pastas")
|
|
32
|
+
|
|
33
|
+
if "{{cookiecutter.dockerfile}}" != "y":
|
|
34
|
+
remove_file("Dockerfile")
|
|
35
|
+
|
|
36
|
+
if "{{cookiecutter.devcontainer}}" != "y":
|
|
37
|
+
remove_dir(".devcontainer")
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
PROJECT_NAME_REGEX = r"^[-a-zA-Z][-a-zA-Z0-9]+$"
|
|
7
|
+
project_name = "{{cookiecutter.project_name}}"
|
|
8
|
+
if not re.match(PROJECT_NAME_REGEX, project_name):
|
|
9
|
+
print(
|
|
10
|
+
f"ERROR: The project name {project_name} is not a valid Python module name. Please do not use a _ and use - instead"
|
|
11
|
+
)
|
|
12
|
+
# Exit to cancel project
|
|
13
|
+
sys.exit(1)
|
|
14
|
+
|
|
15
|
+
PROJECT_SLUG_REGEX = r"^[_a-zA-Z][_a-zA-Z0-9]+$"
|
|
16
|
+
project_slug = "{{cookiecutter.project_slug}}"
|
|
17
|
+
if not re.match(PROJECT_SLUG_REGEX, project_slug):
|
|
18
|
+
print(
|
|
19
|
+
f"ERROR: The project slug {project_slug} is not a valid Python module name. Please do not use a - and use _ instead"
|
|
20
|
+
)
|
|
21
|
+
# Exit to cancel project
|
|
22
|
+
sys.exit(1)
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "cookiecutter-hydro"
|
|
3
|
+
version = "0.0.1"
|
|
4
|
+
description = "A cookiecutter template for scientific Python projects in the field of hydrology."
|
|
5
|
+
authors = ["Mateusz Zawadzki <zawadzkimat@outlook.com>"]
|
|
6
|
+
repository = "https://github.com/zawadzkim/cookiecutter-hydro"
|
|
7
|
+
documentation = "https://zawadzkim.github.io/cookiecutter-hydro/"
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
keywords = ['cookiecutter', 'template', 'poetry']
|
|
10
|
+
packages = [
|
|
11
|
+
{include = "cookiecutter_hydro"}
|
|
12
|
+
]
|
|
13
|
+
include = [
|
|
14
|
+
'{{cookiecutter.project_name}}/**/*',
|
|
15
|
+
'cookiecutter.json',
|
|
16
|
+
'hooks/*'
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
[tool.poetry.dependencies]
|
|
20
|
+
python = "^3.11"
|
|
21
|
+
cookiecutter = "^2.1.1"
|
|
22
|
+
|
|
23
|
+
[tool.poetry.group.dev.dependencies]
|
|
24
|
+
pytest = "^7.2.0"
|
|
25
|
+
pre-commit = "^2.20.0"
|
|
26
|
+
pytest-cookies = "^0.6.1"
|
|
27
|
+
tox = "^3.25.1"
|
|
28
|
+
deptry = "^0.16.2"
|
|
29
|
+
mypy = "^0.991"
|
|
30
|
+
pytest-cov = "^4.0.0"
|
|
31
|
+
|
|
32
|
+
[tool.poetry.group.docs.dependencies]
|
|
33
|
+
mkdocs = "^1.4.2"
|
|
34
|
+
mkdocs-material = "^8.5.10"
|
|
35
|
+
mkdocstrings-python = "^1.11.1"
|
|
36
|
+
mkdocs-autorefs = "^1.2.0"
|
|
37
|
+
|
|
38
|
+
[build-system]
|
|
39
|
+
requires = ["poetry-core>=1.0.0"]
|
|
40
|
+
build-backend = "poetry.core.masonry.api"
|
|
41
|
+
|
|
42
|
+
[tool.poetry.scripts]
|
|
43
|
+
cchydro = 'cookiecutter_hydro.cli:main'
|
|
44
|
+
|
|
45
|
+
[tool.pytest.ini_options]
|
|
46
|
+
testpaths = ["tests"]
|
|
47
|
+
|
|
48
|
+
[tool.coverage.report]
|
|
49
|
+
skip_empty = true
|
|
50
|
+
|
|
51
|
+
[tool.coverage.run]
|
|
52
|
+
branch = true
|
|
53
|
+
source = ["cookiecutter_hydro"]
|
|
54
|
+
|
|
55
|
+
[tool.mypy]
|
|
56
|
+
files = ['cookiecutter_hydro']
|
|
57
|
+
disallow_untyped_defs = "True"
|
|
58
|
+
disallow_any_unimported = "True"
|
|
59
|
+
no_implicit_optional = "True"
|
|
60
|
+
check_untyped_defs = "True"
|
|
61
|
+
warn_return_any = "True"
|
|
62
|
+
warn_unused_ignores = "True"
|
|
63
|
+
show_error_codes = "True"
|
|
64
|
+
|
|
65
|
+
[tool.deptry]
|
|
66
|
+
extend_exclude = [
|
|
67
|
+
".+/test_foo.py"
|
|
68
|
+
]
|
|
69
|
+
|
|
70
|
+
[tool.deptry.per_rule_ignores]
|
|
71
|
+
DEP002 = ["cookiecutter"]
|
|
72
|
+
|
|
73
|
+
[tool.ruff]
|
|
74
|
+
target-version = "py37"
|
|
75
|
+
line-length = 120
|
|
76
|
+
fix = true
|
|
77
|
+
|
|
78
|
+
[tool.ruff.lint]
|
|
79
|
+
select = [
|
|
80
|
+
# flake8-2020
|
|
81
|
+
"YTT",
|
|
82
|
+
# flake8-bandit
|
|
83
|
+
"S",
|
|
84
|
+
# flake8-bugbear
|
|
85
|
+
"B",
|
|
86
|
+
# flake8-builtins
|
|
87
|
+
"A",
|
|
88
|
+
# flake8-comprehensions
|
|
89
|
+
"C4",
|
|
90
|
+
# flake8-debugger
|
|
91
|
+
"T10",
|
|
92
|
+
# flake8-simplify
|
|
93
|
+
"SIM",
|
|
94
|
+
# isort
|
|
95
|
+
"I",
|
|
96
|
+
# mccabe
|
|
97
|
+
"C90",
|
|
98
|
+
# pycodestyle
|
|
99
|
+
"E", "W",
|
|
100
|
+
# pyflakes
|
|
101
|
+
"F",
|
|
102
|
+
# pygrep-hooks
|
|
103
|
+
"PGH",
|
|
104
|
+
# pyupgrade
|
|
105
|
+
"UP",
|
|
106
|
+
# ruff
|
|
107
|
+
"RUF",
|
|
108
|
+
# tryceratops
|
|
109
|
+
"TRY",
|
|
110
|
+
]
|
|
111
|
+
ignore = [
|
|
112
|
+
# LineTooLong
|
|
113
|
+
"E501",
|
|
114
|
+
# DoNotAssignLambda
|
|
115
|
+
"E731",
|
|
116
|
+
]
|
|
117
|
+
|
|
118
|
+
[tool.ruff.lint.per-file-ignores]
|
|
119
|
+
"tests/*" = ["S101", "S603"]
|
|
120
|
+
|
|
121
|
+
[tool.ruff.lint.isort]
|
|
122
|
+
required-imports = ["from __future__ import annotations"]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
|
2
|
+
// README at: https://github.com/devcontainers/templates/tree/main/src/python
|
|
3
|
+
{
|
|
4
|
+
"name": "{{cookiecutter.project_name}}",
|
|
5
|
+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
|
6
|
+
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
|
|
7
|
+
"features": {
|
|
8
|
+
"ghcr.io/devcontainers-contrib/features/poetry:2": {}
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
// Use 'postCreateCommand' to run commands after the container is created.
|
|
12
|
+
"postCreateCommand": "./.devcontainer/postCreateCommand.sh",
|
|
13
|
+
|
|
14
|
+
// Configure tool-specific properties.
|
|
15
|
+
"customizations": {
|
|
16
|
+
"vscode": {
|
|
17
|
+
"extensions": ["ms-python.python", "editorconfig.editorconfig", "yzhang.markdown-all-in-one"],
|
|
18
|
+
"settings": {
|
|
19
|
+
"python.testing.pytestArgs": ["tests"],
|
|
20
|
+
"python.testing.unittestEnabled": false,
|
|
21
|
+
"python.testing.pytestEnabled": true,
|
|
22
|
+
"python.defaultInterpreterPath": "/workspaces/{{cookiecutter.project_name}}/.venv/bin/python",
|
|
23
|
+
"python.testing.pytestPath": "/workspaces/{{cookiecutter.project_name}}/.venv/bin/pytest"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/.github/actions/setup-poetry-env/action.yml
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: "setup-poetry-env"
|
|
2
|
+
description: "Composite action to setup the Python and poetry environment."
|
|
3
|
+
|
|
4
|
+
inputs:
|
|
5
|
+
python-version:
|
|
6
|
+
required: false
|
|
7
|
+
description: "The python version to use"
|
|
8
|
+
default: "3.11"
|
|
9
|
+
|
|
10
|
+
runs:
|
|
11
|
+
using: "composite"
|
|
12
|
+
steps:
|
|
13
|
+
- name: Set up python
|
|
14
|
+
uses: actions/setup-python@v5
|
|
15
|
+
with:
|
|
16
|
+
python-version: {% raw %}${{ inputs.python-version }}{% endraw %}
|
|
17
|
+
|
|
18
|
+
- name: Install Poetry
|
|
19
|
+
env:
|
|
20
|
+
POETRY_VERSION: "1.7.1"
|
|
21
|
+
run: curl -sSL https://install.python-poetry.org | python - -y
|
|
22
|
+
shell: bash
|
|
23
|
+
|
|
24
|
+
- name: Add Poetry to Path
|
|
25
|
+
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
26
|
+
shell: bash
|
|
27
|
+
|
|
28
|
+
- name: Configure Poetry virtual environment in project
|
|
29
|
+
run: poetry config virtualenvs.in-project true
|
|
30
|
+
shell: bash
|
|
31
|
+
|
|
32
|
+
- name: Load cached venv
|
|
33
|
+
id: cached-poetry-dependencies
|
|
34
|
+
uses: actions/cache@v4
|
|
35
|
+
with:
|
|
36
|
+
path: .venv
|
|
37
|
+
key: {% raw %}venv-${{ runner.os }}-${{ inputs.python-version }}-${{ hashFiles('poetry.lock') }}{% endraw %}
|
|
38
|
+
|
|
39
|
+
- name: Install dependencies
|
|
40
|
+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
|
|
41
|
+
run: poetry install --no-interaction
|
|
42
|
+
shell: bash
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
name: Main
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
types: [opened, synchronize, reopened, ready_for_review]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
quality:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- name: Check out
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- uses: actions/cache@v4
|
|
18
|
+
with:
|
|
19
|
+
path: ~/.cache/pre-commit
|
|
20
|
+
key: {% raw %}pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}{% endraw %}
|
|
21
|
+
|
|
22
|
+
- name: Set up the environment
|
|
23
|
+
uses: ./.github/actions/setup-poetry-env
|
|
24
|
+
|
|
25
|
+
- name: Run checks
|
|
26
|
+
run: make check
|
|
27
|
+
|
|
28
|
+
tests-and-type-check:
|
|
29
|
+
runs-on: ubuntu-latest
|
|
30
|
+
strategy:
|
|
31
|
+
matrix:
|
|
32
|
+
python-version: "3.11"
|
|
33
|
+
fail-fast: false
|
|
34
|
+
defaults:
|
|
35
|
+
run:
|
|
36
|
+
shell: bash
|
|
37
|
+
steps:
|
|
38
|
+
- name: Check out
|
|
39
|
+
uses: actions/checkout@v4
|
|
40
|
+
|
|
41
|
+
- name: Set up the environment
|
|
42
|
+
uses: ./.github/actions/setup-poetry-env
|
|
43
|
+
with:
|
|
44
|
+
python-version: {% raw %}${{ matrix.python-version }}{% endraw %}
|
|
45
|
+
|
|
46
|
+
- name: Run tests
|
|
47
|
+
run: poetry run pytest tests
|
|
48
|
+
|
|
49
|
+
- name: Check typing
|
|
50
|
+
run: poetry run mypy
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
docs/source
|
|
2
|
+
|
|
3
|
+
# From https://raw.githubusercontent.com/github/gitignore/main/Python.gitignore
|
|
4
|
+
|
|
5
|
+
# Byte-compiled / optimized / DLL files
|
|
6
|
+
__pycache__/
|
|
7
|
+
*.py[cod]
|
|
8
|
+
*$py.class
|
|
9
|
+
|
|
10
|
+
# C extensions
|
|
11
|
+
*.so
|
|
12
|
+
|
|
13
|
+
# Distribution / packaging
|
|
14
|
+
.Python
|
|
15
|
+
build/
|
|
16
|
+
develop-eggs/
|
|
17
|
+
dist/
|
|
18
|
+
downloads/
|
|
19
|
+
eggs/
|
|
20
|
+
.eggs/
|
|
21
|
+
lib/
|
|
22
|
+
lib64/
|
|
23
|
+
parts/
|
|
24
|
+
sdist/
|
|
25
|
+
var/
|
|
26
|
+
wheels/
|
|
27
|
+
share/python-wheels/
|
|
28
|
+
*.egg-info/
|
|
29
|
+
.installed.cfg
|
|
30
|
+
*.egg
|
|
31
|
+
MANIFEST
|
|
32
|
+
|
|
33
|
+
# PyInstaller
|
|
34
|
+
# Usually these files are written by a python script from a template
|
|
35
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
36
|
+
*.manifest
|
|
37
|
+
*.spec
|
|
38
|
+
|
|
39
|
+
# Installer logs
|
|
40
|
+
pip-log.txt
|
|
41
|
+
pip-delete-this-directory.txt
|
|
42
|
+
|
|
43
|
+
# Unit test / coverage reports
|
|
44
|
+
htmlcov/
|
|
45
|
+
.tox/
|
|
46
|
+
.nox/
|
|
47
|
+
.coverage
|
|
48
|
+
.coverage.*
|
|
49
|
+
.cache
|
|
50
|
+
nosetests.xml
|
|
51
|
+
coverage.xml
|
|
52
|
+
*.cover
|
|
53
|
+
*.py,cover
|
|
54
|
+
.hypothesis/
|
|
55
|
+
.pytest_cache/
|
|
56
|
+
cover/
|
|
57
|
+
|
|
58
|
+
# Translations
|
|
59
|
+
*.mo
|
|
60
|
+
*.pot
|
|
61
|
+
|
|
62
|
+
# Django stuff:
|
|
63
|
+
*.log
|
|
64
|
+
local_settings.py
|
|
65
|
+
db.sqlite3
|
|
66
|
+
db.sqlite3-journal
|
|
67
|
+
|
|
68
|
+
# Flask stuff:
|
|
69
|
+
instance/
|
|
70
|
+
.webassets-cache
|
|
71
|
+
|
|
72
|
+
# Scrapy stuff:
|
|
73
|
+
.scrapy
|
|
74
|
+
|
|
75
|
+
# Sphinx documentation
|
|
76
|
+
docs/_build/
|
|
77
|
+
|
|
78
|
+
# PyBuilder
|
|
79
|
+
.pybuilder/
|
|
80
|
+
target/
|
|
81
|
+
|
|
82
|
+
# Jupyter Notebook
|
|
83
|
+
.ipynb_checkpoints
|
|
84
|
+
|
|
85
|
+
# IPython
|
|
86
|
+
profile_default/
|
|
87
|
+
ipython_config.py
|
|
88
|
+
|
|
89
|
+
# pyenv
|
|
90
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
91
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
92
|
+
# .python-version
|
|
93
|
+
|
|
94
|
+
# pipenv
|
|
95
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
96
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
97
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
98
|
+
# install all needed dependencies.
|
|
99
|
+
#Pipfile.lock
|
|
100
|
+
|
|
101
|
+
# poetry
|
|
102
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
103
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
104
|
+
# commonly ignored for libraries.
|
|
105
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
106
|
+
#poetry.lock
|
|
107
|
+
|
|
108
|
+
# pdm
|
|
109
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
110
|
+
#pdm.lock
|
|
111
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
112
|
+
# in version control.
|
|
113
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
114
|
+
.pdm.toml
|
|
115
|
+
|
|
116
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
117
|
+
__pypackages__/
|
|
118
|
+
|
|
119
|
+
# Celery stuff
|
|
120
|
+
celerybeat-schedule
|
|
121
|
+
celerybeat.pid
|
|
122
|
+
|
|
123
|
+
# SageMath parsed files
|
|
124
|
+
*.sage.py
|
|
125
|
+
|
|
126
|
+
# Environments
|
|
127
|
+
.env
|
|
128
|
+
.venv
|
|
129
|
+
env/
|
|
130
|
+
venv/
|
|
131
|
+
ENV/
|
|
132
|
+
env.bak/
|
|
133
|
+
venv.bak/
|
|
134
|
+
|
|
135
|
+
# Spyder project settings
|
|
136
|
+
.spyderproject
|
|
137
|
+
.spyproject
|
|
138
|
+
|
|
139
|
+
# Rope project settings
|
|
140
|
+
.ropeproject
|
|
141
|
+
|
|
142
|
+
# mkdocs documentation
|
|
143
|
+
/site
|
|
144
|
+
|
|
145
|
+
# mypy
|
|
146
|
+
.mypy_cache/
|
|
147
|
+
.dmypy.json
|
|
148
|
+
dmypy.json
|
|
149
|
+
|
|
150
|
+
# Pyre type checker
|
|
151
|
+
.pyre/
|
|
152
|
+
|
|
153
|
+
# pytype static type analyzer
|
|
154
|
+
.pytype/
|
|
155
|
+
|
|
156
|
+
# Cython debug symbols
|
|
157
|
+
cython_debug/
|
|
158
|
+
|
|
159
|
+
# Vscode config files
|
|
160
|
+
.vscode/
|
|
161
|
+
|
|
162
|
+
# PyCharm
|
|
163
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
164
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
165
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
166
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
167
|
+
#.idea/
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
+
rev: "v4.4.0"
|
|
4
|
+
hooks:
|
|
5
|
+
- id: check-case-conflict
|
|
6
|
+
- id: check-merge-conflict
|
|
7
|
+
- id: check-toml
|
|
8
|
+
- id: check-yaml
|
|
9
|
+
- id: end-of-file-fixer
|
|
10
|
+
- id: trailing-whitespace
|
|
11
|
+
|
|
12
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
13
|
+
rev: "v0.5.2"
|
|
14
|
+
hooks:
|
|
15
|
+
- id: ruff
|
|
16
|
+
args: [--exit-non-zero-on-fix]
|
|
17
|
+
- id: ruff-format
|
|
18
|
+
|
|
19
|
+
- repo: https://github.com/pre-commit/mirrors-prettier
|
|
20
|
+
rev: "v3.0.3"
|
|
21
|
+
hooks:
|
|
22
|
+
- id: prettier
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# syntax=docker/dockerfile:1
|
|
2
|
+
|
|
3
|
+
FROM python:3.9-slim-buster
|
|
4
|
+
|
|
5
|
+
ENV POETRY_VERSION=1.4 \
|
|
6
|
+
POETRY_VIRTUALENVS_CREATE=false
|
|
7
|
+
|
|
8
|
+
# Install poetry
|
|
9
|
+
RUN pip install "poetry==$POETRY_VERSION"
|
|
10
|
+
|
|
11
|
+
# Copy only requirements to cache them in docker layer
|
|
12
|
+
WORKDIR /code
|
|
13
|
+
COPY poetry.lock pyproject.toml /code/
|
|
14
|
+
|
|
15
|
+
# Project initialization:
|
|
16
|
+
RUN poetry install --no-interaction --no-ansi --no-root --no-dev
|
|
17
|
+
|
|
18
|
+
# Copy Python code to the Docker image
|
|
19
|
+
COPY {{cookiecutter.project_slug}} /code/{{cookiecutter.project_slug}}/
|
|
20
|
+
|
|
21
|
+
CMD [ "python", "{{cookiecutter.project_slug}}/src/foo.py"]
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
{% if cookiecutter.open_source_license == 'MIT license' -%}
|
|
2
|
+
MIT License
|
|
3
|
+
|
|
4
|
+
Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.author }}
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
23
|
+
{% elif cookiecutter.open_source_license == 'BSD license' %}
|
|
24
|
+
|
|
25
|
+
BSD License
|
|
26
|
+
|
|
27
|
+
Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.author }}
|
|
28
|
+
All rights reserved.
|
|
29
|
+
|
|
30
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
31
|
+
are permitted provided that the following conditions are met:
|
|
32
|
+
|
|
33
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
34
|
+
list of conditions and the following disclaimer.
|
|
35
|
+
|
|
36
|
+
* Redistributions in binary form must reproduce the above copyright notice, this
|
|
37
|
+
list of conditions and the following disclaimer in the documentation and/or
|
|
38
|
+
other materials provided with the distribution.
|
|
39
|
+
|
|
40
|
+
* Neither the name of the copyright holder nor the names of its
|
|
41
|
+
contributors may be used to endorse or promote products derived from this
|
|
42
|
+
software without specific prior written permission.
|
|
43
|
+
|
|
44
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
45
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
46
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
47
|
+
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
|
48
|
+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
49
|
+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
50
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
|
51
|
+
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
|
52
|
+
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
|
53
|
+
OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
54
|
+
{% elif cookiecutter.open_source_license == 'ISC license' -%}
|
|
55
|
+
ISC License
|
|
56
|
+
|
|
57
|
+
Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.author }}
|
|
58
|
+
|
|
59
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
|
60
|
+
|
|
61
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
62
|
+
{% elif cookiecutter.open_source_license == 'Apache Software License 2.0' -%}
|
|
63
|
+
Apache Software License 2.0
|
|
64
|
+
|
|
65
|
+
Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.author }}
|
|
66
|
+
|
|
67
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
68
|
+
you may not use this file except in compliance with the License.
|
|
69
|
+
You may obtain a copy of the License at
|
|
70
|
+
|
|
71
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
72
|
+
|
|
73
|
+
Unless required by applicable law or agreed to in writing, software
|
|
74
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
75
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
76
|
+
See the License for the specific language governing permissions and
|
|
77
|
+
limitations under the License.
|
|
78
|
+
{% elif cookiecutter.open_source_license == 'GNU General Public License v3' -%}
|
|
79
|
+
GNU GENERAL PUBLIC LICENSE
|
|
80
|
+
Version 3, 29 June 2007
|
|
81
|
+
|
|
82
|
+
{{ cookiecutter.project_description }}
|
|
83
|
+
Copyright (C) {% now 'local', '%Y' %} {{ cookiecutter.author }}
|
|
84
|
+
|
|
85
|
+
This program is free software: you can redistribute it and/or modify
|
|
86
|
+
it under the terms of the GNU General Public License as published by
|
|
87
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
88
|
+
(at your option) any later version.
|
|
89
|
+
|
|
90
|
+
This program is distributed in the hope that it will be useful,
|
|
91
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
92
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
93
|
+
GNU General Public License for more details.
|
|
94
|
+
|
|
95
|
+
You should have received a copy of the GNU General Public License
|
|
96
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
97
|
+
|
|
98
|
+
Also add information on how to contact you by electronic and paper mail.
|
|
99
|
+
|
|
100
|
+
You should also get your employer (if you work as a programmer) or school,
|
|
101
|
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
102
|
+
For more information on this, and how to apply and follow the GNU GPL, see
|
|
103
|
+
<http://www.gnu.org/licenses/>.
|
|
104
|
+
|
|
105
|
+
The GNU General Public License does not permit incorporating your program
|
|
106
|
+
into proprietary programs. If your program is a subroutine library, you
|
|
107
|
+
may consider it more useful to permit linking proprietary applications with
|
|
108
|
+
the library. If this is what you want to do, use the GNU Lesser General
|
|
109
|
+
Public License instead of this License. But first, please read
|
|
110
|
+
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
111
|
+
{% endif %}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
.PHONY: install
|
|
2
|
+
install: ## Install the poetry environment and install the pre-commit hooks
|
|
3
|
+
@echo "🚀 Creating virtual environment using pyenv and poetry"
|
|
4
|
+
@poetry install
|
|
5
|
+
@ poetry run pre-commit install
|
|
6
|
+
@poetry shell
|
|
7
|
+
|
|
8
|
+
.PHONY: check
|
|
9
|
+
check: ## Run code quality tools.
|
|
10
|
+
@echo "🚀 Checking Poetry lock file consistency with 'pyproject.toml': Running poetry check --lock"
|
|
11
|
+
@poetry check --lock
|
|
12
|
+
@echo "🚀 Linting code: Running pre-commit"
|
|
13
|
+
@poetry run pre-commit run -a
|
|
14
|
+
@echo "🚀 Static type checking: Running mypy"
|
|
15
|
+
@poetry run mypy
|
|
16
|
+
{%- if cookiecutter.deptry == 'y' %}
|
|
17
|
+
@echo "🚀 Checking for obsolete dependencies: Running deptry"
|
|
18
|
+
@poetry run deptry .
|
|
19
|
+
{%- endif %}
|
|
20
|
+
|
|
21
|
+
.PHONY: test
|
|
22
|
+
test: ## Test the code with pytest
|
|
23
|
+
@echo "🚀 Testing code: Running pytest"
|
|
24
|
+
@poetry run pytest --doctest-modules
|
|
25
|
+
|
|
26
|
+
.PHONY: build
|
|
27
|
+
build: clean-build ## Build wheel file using poetry
|
|
28
|
+
@echo "🚀 Creating wheel file"
|
|
29
|
+
@poetry build
|
|
30
|
+
|
|
31
|
+
.PHONY: clean-build
|
|
32
|
+
clean-build: ## clean build artifacts
|
|
33
|
+
@rm -rf dist
|
|
34
|
+
|
|
35
|
+
.PHONY: help
|
|
36
|
+
help:
|
|
37
|
+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
|
|
38
|
+
|
|
39
|
+
.DEFAULT_GOAL := help
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# {{cookiecutter.project_name}}
|
|
2
|
+
|
|
3
|
+
[](https://img.shields.io/github/commit-activity/m/{{cookiecutter.author_github_handle}}/{{cookiecutter.project_name}})
|
|
4
|
+
[](https://img.shields.io/github/license/{{cookiecutter.author_github_handle}}/{{cookiecutter.project_name}})
|
|
5
|
+
|
|
6
|
+
{{cookiecutter.project_description}}
|
|
7
|
+
|
|
8
|
+
- **Github repository**: <https://github.com/{{cookiecutter.author_github_handle}}/{{cookiecutter.project_name}}/>
|
|
9
|
+
|
|
10
|
+
## My Hydrological Anlanysis repo
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "{{cookiecutter.project_slug}}"
|
|
3
|
+
version = "0.0.1"
|
|
4
|
+
description = "{{cookiecutter.project_description}}"
|
|
5
|
+
authors = ["{{cookiecutter.author}} <{{cookiecutter.email}}>"]
|
|
6
|
+
repository = "https://github.com/{{cookiecutter.author_github_handle}}/{{cookiecutter.project_name}}"
|
|
7
|
+
documentation = "https://{{cookiecutter.author_github_handle}}.github.io/{{cookiecutter.project_name}}/"
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
packages = [
|
|
10
|
+
{include = "{{cookiecutter.project_slug}}"}
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
[tool.poetry.dependencies]
|
|
14
|
+
python = "^3.11"
|
|
15
|
+
{% if cookiecutter.model == 'flopy' -%}
|
|
16
|
+
flopy = "^3.8"
|
|
17
|
+
{% elif cookiecutter.model == 'swap' -%}
|
|
18
|
+
pyswap = "*"
|
|
19
|
+
{% elif cookiecutter.model == 'pastas' -%}
|
|
20
|
+
pastas = "^1.7"
|
|
21
|
+
{% endif -%}
|
|
22
|
+
{% if cookiecutter.gensor == 'y' -%}
|
|
23
|
+
gensor = "*"
|
|
24
|
+
{% endif -%}
|
|
25
|
+
|
|
26
|
+
[tool.poetry.group.dev.dependencies]
|
|
27
|
+
pytest = "^7.2.0"
|
|
28
|
+
{% if cookiecutter.deptry == 'y' -%}
|
|
29
|
+
deptry = "^0.16.2"
|
|
30
|
+
{% endif -%}
|
|
31
|
+
mypy = "^1.5.1"
|
|
32
|
+
pre-commit = "^3.4.0"
|
|
33
|
+
tox = "^4.11.1"
|
|
34
|
+
|
|
35
|
+
[build-system]
|
|
36
|
+
requires = ["poetry-core>=1.0.0"]
|
|
37
|
+
build-backend = "poetry.core.masonry.api"
|
|
38
|
+
|
|
39
|
+
[tool.mypy]
|
|
40
|
+
files = ["{{cookiecutter.project_slug}}"]
|
|
41
|
+
disallow_untyped_defs = "True"
|
|
42
|
+
disallow_any_unimported = "True"
|
|
43
|
+
no_implicit_optional = "True"
|
|
44
|
+
check_untyped_defs = "True"
|
|
45
|
+
warn_return_any = "True"
|
|
46
|
+
warn_unused_ignores = "True"
|
|
47
|
+
show_error_codes = "True"
|
|
48
|
+
|
|
49
|
+
[tool.pytest.ini_options]
|
|
50
|
+
testpaths = ["tests"]
|
|
51
|
+
|
|
52
|
+
[tool.ruff]
|
|
53
|
+
target-version = "py39"
|
|
54
|
+
line-length = 120
|
|
55
|
+
fix = true
|
|
56
|
+
select = [
|
|
57
|
+
# flake8-2020
|
|
58
|
+
"YTT",
|
|
59
|
+
# flake8-bandit
|
|
60
|
+
"S",
|
|
61
|
+
# flake8-bugbear
|
|
62
|
+
"B",
|
|
63
|
+
# flake8-builtins
|
|
64
|
+
"A",
|
|
65
|
+
# flake8-comprehensions
|
|
66
|
+
"C4",
|
|
67
|
+
# flake8-debugger
|
|
68
|
+
"T10",
|
|
69
|
+
# flake8-simplify
|
|
70
|
+
"SIM",
|
|
71
|
+
# isort
|
|
72
|
+
"I",
|
|
73
|
+
# mccabe
|
|
74
|
+
"C90",
|
|
75
|
+
# pycodestyle
|
|
76
|
+
"E", "W",
|
|
77
|
+
# pyflakes
|
|
78
|
+
"F",
|
|
79
|
+
# pygrep-hooks
|
|
80
|
+
"PGH",
|
|
81
|
+
# pyupgrade
|
|
82
|
+
"UP",
|
|
83
|
+
# ruff
|
|
84
|
+
"RUF",
|
|
85
|
+
# tryceratops
|
|
86
|
+
"TRY",
|
|
87
|
+
]
|
|
88
|
+
ignore = [
|
|
89
|
+
# LineTooLong
|
|
90
|
+
"E501",
|
|
91
|
+
# DoNotAssignLambda
|
|
92
|
+
"E731",
|
|
93
|
+
]
|
|
94
|
+
|
|
95
|
+
[tool.ruff.format]
|
|
96
|
+
preview = true
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
[tool.ruff.per-file-ignores]
|
|
100
|
+
"tests/*" = ["S101"]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
[tox]
|
|
2
|
+
skipsdist = true
|
|
3
|
+
envlist = py38, py39, py310, py311
|
|
4
|
+
|
|
5
|
+
[gh-actions]
|
|
6
|
+
python =
|
|
7
|
+
3.8: py38
|
|
8
|
+
3.9: py39
|
|
9
|
+
3.10: py310
|
|
10
|
+
3.11: py311
|
|
11
|
+
|
|
12
|
+
[testenv]
|
|
13
|
+
passenv = PYTHON_VERSION
|
|
14
|
+
allowlist_externals = poetry
|
|
15
|
+
commands =
|
|
16
|
+
poetry install -v
|
|
17
|
+
pytest --doctest-modules tests --cov --cov-config=pyproject.toml --cov-report=xml
|
|
18
|
+
mypy
|
cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/__init__.py
ADDED
|
File without changes
|
cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/data/README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
## Data module
|
|
2
|
+
|
|
3
|
+
This modules helps to structure the data for the models. General use guidelines are as follows. In the root of the data module there are three folders:
|
|
4
|
+
|
|
5
|
+
- boundaries: These are boundary conditions for the model
|
|
6
|
+
- layers: layer surfaces and their properties
|
|
7
|
+
- observations: observation data used, e.g., for model calibration
|
|
8
|
+
|
|
9
|
+
Additionally, each folder has two subdirectories for storing raw and processed data:
|
|
10
|
+
|
|
11
|
+
- raw: raw (e.g., unclipped, unfiltered) data
|
|
12
|
+
- processed: output data which should be included in the repository and for other people to use to reproduce our results. These files should be clearly named, indluding versioning, etc. Remember that the files put in GitHub should not be too big. If you have big data, perhaps cloud storage like Amazon S3 should be considered.
|
|
13
|
+
|
|
14
|
+
The structure may appear complex, but in the end the files in each of these directories are imported directly into your script or notebook with `.` notation (from data.boundaries.processed import ghb_layer1)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""Path for the data:
|
|
2
|
+
|
|
3
|
+
Attributes:
|
|
4
|
+
|
|
5
|
+
data (Traversable): base path of the data directory.
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from importlib import resources
|
|
10
|
+
from importlib.abc import Traversable
|
|
11
|
+
|
|
12
|
+
data: Traversable = resources.files(__name__)
|
|
13
|
+
"""The whole directory of test groundwater sensor data."""
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""Path for the data:
|
|
2
|
+
|
|
3
|
+
Attributes:
|
|
4
|
+
|
|
5
|
+
boundaries (Traversable): base path of the boundary condition directory.
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from importlib import resources
|
|
10
|
+
from importlib.abc import Traversable
|
|
11
|
+
|
|
12
|
+
boundaries: Traversable = resources.files(__name__)
|
|
13
|
+
"""The whole directory of test groundwater sensor data."""
|
|
14
|
+
|
|
15
|
+
processed: Traversable = boundaries.joinpath("processed")
|
|
16
|
+
"""Processed boundary condition data."""
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
raw: Traversable = boundaries.joinpath("raw")
|
|
20
|
+
"""Raw boundary condition data."""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Jupyter notebooks
|
|
2
|
+
|
|
3
|
+
My favourite way to work on data hydrological models is to use jupyter notebooks. They give an amazing platform to build the models and document them at the same time. It is also good to split the workflows into multiple notebooks to avoid creating monstrous, unreadable files. As pointed out in [this article](https://www.svds.com/jupyter-notebook-best-practices-for-data-science/), it is also increadibly important to keep a consistent way of naming your notebooks. This structure makes a lot of sense:
|
|
4
|
+
|
|
5
|
+
[ISO 8601 date]-[DS-initials]-[2-4 word description].ipynb
|
|
6
|
+
|
|
7
|
+
e.g.: 2015-06-28-jw-initial-data-clean.ipynb
|
|
8
|
+
|
|
9
|
+
This allows you to search for notebooks by date or topic.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""Path for the data:
|
|
2
|
+
|
|
3
|
+
Attributes:
|
|
4
|
+
|
|
5
|
+
output (Traversable): base path of the data directory.
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from importlib import resources
|
|
10
|
+
from importlib.abc import Traversable
|
|
11
|
+
|
|
12
|
+
output: Traversable = resources.files(__name__)
|
|
13
|
+
"""All files in the output directory."""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/src/.gitkeep
ADDED
|
File without changes
|
cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/src/__init__.py
ADDED
|
File without changes
|
cookiecutter_hydro-0.0.1/{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/src/foo.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
def foo(bar: str) -> str:
|
|
2
|
+
"""Summary line.
|
|
3
|
+
|
|
4
|
+
Extended description of function.
|
|
5
|
+
|
|
6
|
+
Parameters:
|
|
7
|
+
bar (str): Description of input argument.
|
|
8
|
+
|
|
9
|
+
Returns:
|
|
10
|
+
Description of return value
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
return bar
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
if __name__ == "__main__": # pragma: no cover
|
|
17
|
+
pass
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|