Skip to content

Commit 9c04f88

Browse files
authored
docs: clean docstrings and change doc palette (#18)
* docs: clean docstrings and change doc palette Signed-off-by: develop-cs <43383361+develop-cs@users.noreply.github.com> * chore: update coverage Signed-off-by: develop-cs <43383361+develop-cs@users.noreply.github.com> * docs: fix favicon Signed-off-by: develop-cs <43383361+develop-cs@users.noreply.github.com> --------- Signed-off-by: develop-cs <43383361+develop-cs@users.noreply.github.com>
1 parent 2327399 commit 9c04f88

File tree

14 files changed

+322
-236
lines changed

14 files changed

+322
-236
lines changed

.github/workflows/ci-cd-mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
with:
3737
path: "docs/site/"
3838
publish:
39-
if: success() && github.ref == 'refs/heads/main'
39+
if: success() && startsWith(github.ref, 'refs/tags')
4040
name: Publish doc
4141
needs: build
4242
permissions:

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,20 @@ repos:
2727
- id: check-added-large-files
2828
args: [--maxkb=500]
2929
- repo: https://github.com/astral-sh/ruff-pre-commit
30-
rev: v0.8.3
30+
rev: v0.8.6
3131
hooks:
3232
- id: ruff
3333
args: [--fix]
3434
- id: ruff-format
3535
- repo: https://github.com/pre-commit/mirrors-mypy
36-
rev: v1.13.0
36+
rev: v1.14.1
3737
hooks:
3838
- id: mypy
3939
args: [--config-file=pyproject.toml]
4040
files: src
4141
additional_dependencies: [pydantic~=2.0,types-pytz,types-requests,types-python-dateutil]
4242
- repo: https://github.com/gitleaks/gitleaks
43-
rev: v8.21.2
43+
rev: v8.22.1
4444
hooks:
4545
- id: gitleaks
4646
- repo: https://github.com/pypa/pip-audit
@@ -49,12 +49,12 @@ repos:
4949
- id: pip-audit
5050
args: [--skip-editable]
5151
- repo: https://github.com/compilerla/conventional-pre-commit
52-
rev: v3.6.0
52+
rev: v4.0.0
5353
hooks:
5454
- id: conventional-pre-commit
5555
stages: [commit-msg]
5656
args: [feat, fix, ci, chore, test, docs]
5757
- repo: https://github.com/kynan/nbstripout
58-
rev: 0.7.1
58+
rev: 0.8.1
5959
hooks:
6060
- id: nbstripout

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</p>
77
<p align="center">
88
<img src="https://github.com/MAIF/meteole/actions/workflows/ci-cd.yml/badge.svg?branch=main" alt="CI">
9-
<img src="https://img.shields.io/badge/coverage-86%25-dark_green" alt="Coverage">
9+
<img src="https://img.shields.io/badge/coverage-89%25-dark_green" alt="Coverage">
1010
<img src="https://img.shields.io/pypi/v/meteole" alt="Versions">
1111
<img src="https://img.shields.io/pypi/pyversions/meteole" alt="Python">
1212
<img src="https://img.shields.io/pypi/dm/meteole" alt="Downloads">
@@ -120,7 +120,7 @@ vigi.get_vignette()
120120

121121
<img src="docs/pages/assets/img/png/vignette_exemple.png" width="600" height="300" alt="vignette de vigilance">
122122

123-
To have more documentation from MeteoFrance in Vigilance Bulletin :
123+
To have more documentation from Meteo-France in Vigilance Bulletin :
124124
- [Meteo France Documentation](https://donneespubliques.meteofrance.fr/?fond=produit&id_produit=305&id_rubrique=50)
125125

126126
## Contributing

docs/mkdocs.yaml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@ repo_name: MAIF/meteole
55
site_author: OSSbyMAIF Team
66
docs_dir: pages
77
theme:
8-
name: 'material'
8+
name: material
99
logo: assets/img/svg/meteole-fond-clair.svg
10-
favicon: assets/img/svg/meteole-git.svg
10+
favicon: assets/img/png/meteole-git.png
1111
palette:
1212
# Palette toggle for automatic mode
1313
- media: "(prefers-color-scheme)"
1414
toggle:
1515
icon: material/brightness-auto
1616
name: Switch to light mode
17-
primary: white
18-
accent: red
17+
primary: light green
18+
accent: lime
1919

2020
# Palette toggle for light mode
2121
- media: "(prefers-color-scheme: light)"
2222
scheme: default
23-
primary: white
24-
accent: red
23+
primary: light green
24+
accent: lime
2525
toggle:
2626
icon: material/brightness-7
2727
name: Switch to dark mode
@@ -30,13 +30,13 @@ theme:
3030
- media: "(prefers-color-scheme: dark)"
3131
scheme: slate
3232
primary: black
33-
accent: red
33+
accent: lime
3434
toggle:
3535
icon: material/brightness-4
3636
name: Switch to system preference
3737
font:
38-
text: 'Roboto'
39-
code: 'Roboto Mono'
38+
text: Urbanist
39+
code: Source Code Pro
4040
language: en
4141
features:
4242
- content.tabs.link
@@ -81,6 +81,4 @@ nav:
8181
- User Guide:
8282
- How to: how_to.md
8383
- Advanced User Guide:
84-
- Coverages: coverage_parameters.md
85-
extra_css:
86-
- assets/css/mkdocs_extra.css
84+
- Coverages: coverage_parameters.md
99 KB
Loading

docs/pages/assets/img/svg/meteole-git.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "meteole"
7-
version = "0.0.1"
7+
version = "0.1.0b1"
88
requires-python = ">3.8.0"
99
description = "A Python client library for forecast model APIs (e.g., Météo-France)."
1010
readme = "README.md"
1111
license = {text = "Apache-2.0"}
1212
authors = [
1313
{name = "ThomasBouche"},
14-
{name = "develop-cs"},
1514
{name = "GratienDSX"},
1615
]
1716

src/meteole/__init__.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import logging
21
from importlib.metadata import version
32

43
from meteole._arome import AromeForecast
@@ -8,21 +7,3 @@
87
__all__ = ["AromeForecast", "ArpegeForecast", "Vigilance"]
98

109
__version__ = version("meteole")
11-
12-
13-
def setup_logger():
14-
"""Setup logger with proper StreamHandler and formatter"""
15-
logger = logging.getLogger(__name__)
16-
logger.setLevel(logging.INFO)
17-
18-
handler = logging.StreamHandler()
19-
handler.setLevel(logging.INFO)
20-
21-
# formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
22-
formatter = logging.Formatter("%(message)s")
23-
handler.setFormatter(formatter)
24-
25-
return logger.addHandler(handler)
26-
27-
28-
logger = setup_logger()

src/meteole/_arome.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
"""The interface for the observational data from the meteo-France API.
2-
3-
See :
4-
- https://portail-api.meteofrance.fr/web/fr/api/arome
5-
"""
6-
71
from __future__ import annotations
82

93
import logging
104
from typing import final
115

126
from meteole.clients import BaseClient, MeteoFranceClient
13-
from meteole.forecast import Forecast
7+
from meteole.forecast import WeatherForecast
148

159
logger = logging.getLogger(__name__)
1610

@@ -50,8 +44,17 @@
5044

5145

5246
@final
53-
class AromeForecast(Forecast):
54-
"""Access the AROME numerical forecast data."""
47+
class AromeForecast(WeatherForecast):
48+
"""Access the AROME numerical weather forecast data from Meteo-France API.
49+
50+
Doc:
51+
- https://portail-api.meteofrance.fr/web/fr/api/arome
52+
53+
Attributes:
54+
territory: Covered area (e.g., FRANCE, ANTIL, ...).
55+
precision: Precision value of the forecast.
56+
capabilities: DataFrame containing details on all available coverage ids.
57+
"""
5558

5659
# Model constants
5760
MODEL_NAME: str = "arome"
@@ -62,9 +65,14 @@ class AromeForecast(Forecast):
6265
DEFAULT_PRECISION: float = 0.01
6366
CLIENT_CLASS: type[BaseClient] = MeteoFranceClient
6467

65-
def _validate_parameters(self):
66-
"""Assert the parameters are valid."""
68+
def _validate_parameters(self) -> None:
69+
"""Check the territory and the precision parameters.
70+
71+
Raise:
72+
ValueError: At least, one parameter is not good.
73+
"""
6774
if self.precision not in [0.01, 0.025]:
6875
raise ValueError("Parameter `precision` must be in (0.01, 0.025). It is inferred from argument `territory`")
76+
6977
if self.territory not in AVAILABLE_AROME_TERRITORY:
7078
raise ValueError(f"Parameter `territory` must be in {AVAILABLE_AROME_TERRITORY}")

src/meteole/_arpege.py

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
1-
"""The interface for the observational data from the meteo-France API.
2-
3-
See :
4-
- https://portail-api.meteofrance.fr/web/fr/api/arpege
5-
"""
6-
71
from __future__ import annotations
82

93
from typing import Any, final
104

115
from meteole.clients import BaseClient, MeteoFranceClient
12-
from meteole.forecast import Forecast
6+
from meteole.forecast import WeatherForecast
137

148
AVAILABLE_ARPEGE_TERRITORY: list[str] = ["EUROPE", "GLOBE", "ATOURX", "EURAT"]
159

@@ -68,8 +62,17 @@
6862

6963

7064
@final
71-
class ArpegeForecast(Forecast):
72-
"""Access the ARPEGE numerical forecast data."""
65+
class ArpegeForecast(WeatherForecast):
66+
"""Access the ARPEGE numerical weather forecast data from Meteo-France API.
67+
68+
Doc:
69+
- https://portail-api.meteofrance.fr/web/fr/api/arpege
70+
71+
Attributes:
72+
territory: Covered area (e.g., FRANCE, ANTIL, ...).
73+
precision: Precision value of the forecast.
74+
capabilities: DataFrame containing details on all available coverage ids.
75+
"""
7376

7477
# Model constants
7578
MODEL_NAME: str = "arpege"
@@ -87,24 +90,20 @@ def __init__(
8790
territory: str = "EUROPE",
8891
**kwargs: Any,
8992
):
90-
"""
91-
Initializes an ArpegeForecast object for accessing ARPEGE forecast data.
93+
"""Initializes an ArpegeForecast object.
9294
9395
The `precision` of the forecast is inferred from the specified `territory`.
9496
9597
Args:
96-
territory (str, optional): The ARPEGE territory to fetch. Defaults to "EUROPE".
97-
api_key (str | None, optional): The API key for authentication. Defaults to None.
98-
token (str | None, optional): The API token for authentication. Defaults to None.
99-
application_id (str | None, optional): The Application ID for authentication. Defaults to None.
100-
cache_dir (str | None, optional): Path to the cache directory. Defaults to None.
101-
If not provided, the cache directory is set to "/tmp/cache".
98+
territory: The ARPEGE territory to fetch. Defaults to "EUROPE".
99+
api_key: The API key for authentication. Defaults to None.
100+
token: The API token for authentication. Defaults to None.
101+
application_id: The Application ID for authentication. Defaults to None.
102102
103103
Notes:
104104
- See `MeteoFranceClient` for additional details on the parameters `api_key`, `token`,
105105
and `application_id`.
106106
- Available territories are listed in the `AVAILABLE_TERRITORY` constant.
107-
108107
"""
109108
super().__init__(
110109
client=client,
@@ -113,7 +112,11 @@ def __init__(
113112
**kwargs,
114113
)
115114

116-
def _validate_parameters(self):
117-
"""Assert the parameters are valid."""
115+
def _validate_parameters(self) -> None:
116+
"""Check the territory and the precision parameters.
117+
118+
Raise:
119+
ValueError: At least, one parameter is not good.
120+
"""
118121
if self.territory not in AVAILABLE_ARPEGE_TERRITORY:
119122
raise ValueError(f"The parameter precision must be in {AVAILABLE_ARPEGE_TERRITORY}")

0 commit comments

Comments
 (0)