Skip to content

Commit ee0b02f

Browse files
35 add devtools to repos (#36)
* added sphinx docs * updated script headers for docs and removed minimal dependency comments * updated whatsnew * added pytest on github including mindeps and testdata available on github * added badges to readme * add pooch to deps
1 parent 67ebebd commit ee0b02f

26 files changed

+1841
-59
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: pytest-py39-mindeps
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
# Allows you to run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Set up Python 3.9
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: '3.9'
22+
- name: Set fixed versions in requirements.txt extracted from pyproject.toml
23+
run: |
24+
python -m pip install --upgrade pip
25+
python -m pip install toml-to-requirements
26+
toml-to-req --toml-file pyproject.toml --optional-lists dev
27+
sed -i -E 's/>=/==/' requirements.txt
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
python -m pip install -r requirements.txt
32+
python -m pip install -e .[dev]
33+
- name: list env contents
34+
run: |
35+
conda info
36+
conda list
37+
pip list
38+
- name: Lint with flake8
39+
run: |
40+
# stop the build if there are Python syntax errors or undefined names
41+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
42+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
43+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
44+
- name: Test with pytest
45+
env:
46+
CDSAPI_KEY: ${{ secrets.CDSAPI_KEY }}
47+
COPERNICUS_MARINE_SERVICE_USERNAME: ${{ secrets.COPERNICUS_MARINE_SERVICE_USERNAME }}
48+
COPERNICUS_MARINE_SERVICE_PASSWORD: ${{ secrets.COPERNICUS_MARINE_SERVICE_PASSWORD }}
49+
run: |
50+
pytest --cov=kenmerkendewaarden --cov-report xml --cov-report term

.github/workflows/pytest.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: pytest
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
# Allows you to run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
python-version: ["3.9", "3.12"]
18+
os: [ubuntu-latest]
19+
runs-on: ${{ matrix.os }}
20+
21+
steps:
22+
- uses: actions/checkout@v2
23+
- name: Set up Python
24+
uses: actions/setup-python@v4
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
python -m pip install -e .[dev]
31+
- name: list env contents
32+
run: |
33+
conda info
34+
conda list
35+
pip list
36+
- name: Lint with flake8
37+
run: |
38+
# stop the build if there are Python syntax errors or undefined names
39+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
40+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
41+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
42+
- name: Test with pytest
43+
env:
44+
CDSAPI_KEY: ${{ secrets.CDSAPI_KEY }}
45+
COPERNICUS_MARINE_SERVICE_USERNAME: ${{ secrets.COPERNICUS_MARINE_SERVICE_USERNAME }}
46+
COPERNICUS_MARINE_SERVICE_PASSWORD: ${{ secrets.COPERNICUS_MARINE_SERVICE_PASSWORD }}
47+
run: |
48+
pytest --cov=kenmerkendewaarden --cov-report xml --cov-report term
49+
- uses: codecov/codecov-action@v4
50+
env:
51+
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}

.github/workflows/sphinx-docs.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: sphinx-docs
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
7+
permissions:
8+
contents: read
9+
pages: write
10+
id-token: write
11+
12+
jobs:
13+
build:
14+
runs-on: windows-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
- uses: actions/setup-python@v3
18+
- name: install pandoc
19+
# pip install is not seen somehow, so via choco
20+
run: |
21+
choco install pandoc
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
python -m pip install -e .[docs]
26+
- name: Sphinx build
27+
run: |
28+
sphinx-build docs docs/_build
29+
- uses: actions/upload-pages-artifact@v1
30+
with:
31+
path: docs/_build/
32+
33+
# Deploy the artifact to GitHub pages.
34+
# This is a separate job so that only actions/deploy-pages has the necessary permissions.
35+
deploy:
36+
needs: build
37+
runs-on: ubuntu-latest
38+
permissions:
39+
pages: write
40+
id-token: write
41+
environment:
42+
name: github-pages
43+
url: ${{ steps.deployment.outputs.page_url }}
44+
steps:
45+
- id: deployment
46+
uses: actions/deploy-pages@v1

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
[![pytest](https://github.com/deltares-research/kenmerkendewaarden/actions/workflows/pytest.yml/badge.svg?branch=main)](https://github.com/deltares-research/kenmerkendewaarden/actions/workflows/pytest.yml)
2+
[![codecov](https://img.shields.io/codecov/c/github/deltares-research/kenmerkendewaarden.svg?style=flat-square)](https://app.codecov.io/gh/deltares-research/kenmerkendewaarden?displayType=list)
3+
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Deltares-research_kenmerkendewaarden&metric=alert_status)](https://sonarcloud.io/dashboard?id=Deltares-research_kenmerkendewaarden)
4+
15
# kenmerkendewaarden
26
Voor het afleiden van kengetallen als slotgemiddelden, gemiddelde getijkrommen, havengetallen, overschrijdingsfrequenties op basis van waterstandsmetingen. Meer informatie over Kenmerkende Waarden is beschikbaar op [rijkswaterstaat.nl](https://www.rijkswaterstaat.nl/water/waterbeheer/metingen/meten-bij-rijkswaterstaat/waternormalen)
37

48
## LET OP
5-
Deze repository bevat een voorlopige versie van de methodieken, welke nog worden aangepast. Als dat zover is, wordt een nieuwe tag/release gemaakt.
9+
Deze repository bevat een voorlopige versie van de methodieken en zijn nog niet geschikt voor productie.
610

711
## installation
812
- open anaconda prompt

docs/_static/.keep

Whitespace-only changes.

docs/_static/deltares-white.svg

Lines changed: 1 addition & 0 deletions
Loading

docs/_static/deltares.svg

Lines changed: 1 addition & 0 deletions
Loading

docs/_static/enabling-delta-life.svg

Lines changed: 1 addition & 0 deletions
Loading

docs/_static/theme-deltares.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/* enlarge deltares & github icon size; only works with local/url svg files; not with fa icons */
2+
img.icon-link-image {
3+
height: 2.5em !important;
4+
}

docs/conf.py

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
#
4+
# ddlpy documentation build configuration file, created by
5+
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
6+
#
7+
# This file is execfile()d with the current directory set to its
8+
# containing dir.
9+
#
10+
# Note that not all possible configuration values are present in this
11+
# autogenerated file.
12+
#
13+
# All configuration values have a default; values that are commented out
14+
# serve to show the default.
15+
16+
# If extensions (or modules to document with autodoc) are in another
17+
# directory, add these directories to sys.path here. If the directory is
18+
# relative to the documentation root, use os.path.abspath to make it
19+
# absolute, like shown here.
20+
#
21+
import os
22+
import sys
23+
sys.path.insert(0, os.path.abspath('..'))
24+
25+
import dfm_tools
26+
27+
# -- General configuration ---------------------------------------------
28+
29+
# If your documentation needs a minimal Sphinx version, state it here.
30+
#
31+
# needs_sphinx = '1.0'
32+
33+
# Add any Sphinx extension module names here, as strings. They can be
34+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
35+
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx_mdinclude', "nbsphinx"]
36+
37+
# Add any paths that contain templates here, relative to this directory.
38+
templates_path = ['_templates']
39+
40+
# The suffix(es) of source filenames.
41+
# You can specify multiple suffix as a list of string:
42+
#
43+
# source_suffix = ['.rst', '.md']
44+
source_suffix = '.rst'
45+
46+
# The master toctree document.
47+
master_doc = 'index'
48+
49+
# General information about the project.
50+
project = u'dfm_tools'
51+
copyright = u"Deltares"
52+
author = u"Jelmer Veenstra"
53+
54+
# The version info for the project you're documenting, acts as replacement
55+
# for |version| and |release|, also used in various other places throughout
56+
# the built documents.
57+
#
58+
# The short X.Y version.
59+
version = dfm_tools.__version__
60+
# The full version, including alpha/beta/rc tags.
61+
release = dfm_tools.__version__
62+
63+
# The language for content autogenerated by Sphinx. Refer to documentation
64+
# for a list of supported languages.
65+
#
66+
# This is also used if you do content translation via gettext catalogs.
67+
# Usually you set "language" from the command line for these cases.
68+
language = "en"
69+
70+
# List of patterns, relative to source directory, that match files and
71+
# directories to ignore when looking for source files.
72+
# This patterns also effect to html_static_path and html_extra_path
73+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
74+
75+
# The name of the Pygments (syntax highlighting) style to use.
76+
pygments_style = 'sphinx'
77+
78+
# If true, `todo` and `todoList` produce output, else they produce nothing.
79+
todo_include_todos = False
80+
81+
82+
# -- Options for HTML output -------------------------------------------
83+
84+
# The theme to use for HTML and HTML Help pages. See the documentation for
85+
# a list of builtin themes.
86+
#
87+
html_theme = 'pydata_sphinx_theme'
88+
89+
# Theme options are theme-specific and customize the look and feel of a
90+
# theme further. For a list of options available for each theme, see the
91+
# documentation.
92+
#
93+
html_theme_options = {
94+
"navigation_with_keys": False,
95+
"navbar_align": "content",
96+
"icon_links": [
97+
{
98+
"name": "GitHub",
99+
"url": "https://github.com/Deltares/dfm_tools", # required
100+
"icon": "https://upload.wikimedia.org/wikipedia/commons/9/91/Octicons-mark-github.svg",
101+
"type": "url",
102+
},
103+
{
104+
"name": "Deltares",
105+
"url": "https://deltares.nl/en/",
106+
"icon": "_static/deltares-white.svg",
107+
"type": "local",
108+
},
109+
],
110+
"navbar_end": ["theme-switcher", "navbar-icon-links"],
111+
}
112+
113+
# Add any paths that contain custom static files (such as style sheets) here,
114+
# relative to this directory. They are copied after the builtin static files,
115+
# so a file named "default.css" will overwrite the builtin "default.css".
116+
html_static_path = ["_static"]
117+
html_css_files = ["theme-deltares.css"]

0 commit comments

Comments
 (0)