Skip to content

Commit

Permalink
chore: repo suggestions and formatting
Browse files Browse the repository at this point in the history
Signed-off-by: develop-cs <[email protected]>
  • Loading branch information
develop-cs committed Dec 17, 2024
1 parent e802bca commit f3b293b
Show file tree
Hide file tree
Showing 25 changed files with 1,461 additions and 1,359 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
blank_issues_enabled: false
blank_issues_enabled: false
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Explain with one or more sentences what this change is doing.

- [ ] Code tests
- [ ] Update documentation
- [ ] Update [changelog](https://github.com/MAIF/arta/blob/main/CHANGELOG.md)
- [ ] Update [changelog](https://github.com/MAIF/meteole/blob/main/CHANGELOG.md)

### Details to be checked: (optional)

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci-cd-mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
branches:
- main
tags:
- '*' # Later: \b[0-9]\.[0-9]+\.[0-9]+[ab]?[0-9]?\b
- '*' # Later: \b[0-9]+\.[0-9]+\.[0-9]+[ab]?[0-9]+?\b
pull_request:
types:
- opened
- synchronize
branches:
- main

jobs:
build:
if: ${{ github.actor != 'dependabot[bot]' }}
Expand Down Expand Up @@ -49,4 +49,4 @@
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@v4
20 changes: 14 additions & 6 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
branches:
- main
tags:
- '*' # Later: \b[0-9]\.[0-9]+\.[0-9]+[ab]?[0-9]?\b
- '*' # Later: \b[0-9]+\.[0-9]+\.[0-9]+[ab]?[0-9]+?\b
pull_request:
types:
- opened
- synchronize
branches:
- main

jobs:
pre-commit:
name: Apply pre-commit hooks
Expand All @@ -30,13 +30,21 @@
pip install .[dev,test]
- name: Cache pre-commit hooks
uses: actions/cache@v4
with:
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-precommit-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run pre-commit hooks
run: pre-commit run --all-files
publish:
tests:
needs: pre-commit
if: success()
name: Launch tests
runs-on: ubuntu-latest
steps:
- name: Unit Tests (pytest)
run: python -m pytest
publish:
needs: tests
if: success() && startsWith(github.ref, 'refs/tags')
name: Publish release to PyPI
runs-on: ubuntu-latest
Expand All @@ -47,12 +55,12 @@
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python version
uses: actions/setup-python@v5
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Build package
run: |
python -m pip install --upgrade build
python -m build
- name: Upload package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
uses: pypa/gh-action-pypi-publish@release/v1
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,11 @@ data/

# Environments
.env
.venv

# Development tools
.vscode
.coverage

# mkdocs documentation
*/site
*/site
57 changes: 45 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,55 @@
---
default_language_version:
python: python3
python: python3
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.0
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: ruff
args: [ --fix ]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
- id: check-ast
- id: check-byte-order-marker
- id: check-case-conflict
- id: check-docstring-first
- id: check-json
- id: check-yaml
exclude: ^(docs/)
- id: debug-statements
- id: end-of-file-fixer
exclude: ^(docs/)
- id: pretty-format-json
args: [--autofix]
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
exclude: ^(docs/)
- id: mixed-line-ending
args: [--fix=lf]
exclude: ^(docs/)
- id: check-added-large-files
args: [--maxkb=500]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.3
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.13.0
hooks:
- id: mypy
- id: mypy
args: [--config-file=pyproject.toml]
files: src
additional_dependencies: [types-pytz,types-requests,types-python-dateutil]
- repo: https://github.com/compilerla/conventional-pre-commit
additional_dependencies: [pydantic~=2.0,types-pytz,types-requests,types-python-dateutil]
- repo: https://github.com/gitleaks/gitleaks
rev: v8.21.2
hooks:
- id: gitleaks
- repo: https://github.com/pypa/pip-audit
rev: v2.7.3
hooks:
- id: pip-audit
args: [--skip-editable]
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.6.0
hooks:
- id: conventional-pre-commit
- id: conventional-pre-commit
stages: [commit-msg]
args: []
args: [feat, fix, ci, chore, test, docs]
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</p>
<p align="center">
<img src="https://github.com/MAIF/meteole/actions/workflows/ci-cd.yml/badge.svg?branch=main" alt="CI">
<img src="https://img.shields.io/badge/coverage-90%25-dark_green" alt="Coverage">
<img src="https://img.shields.io/badge/coverage-86%25-dark_green" alt="Coverage">
<img src="https://img.shields.io/pypi/v/meteole" alt="Versions">
<img src="https://img.shields.io/pypi/pyversions/meteole" alt="Python">
<img src="https://img.shields.io/pypi/dm/meteole" alt="Downloads">
Expand Down Expand Up @@ -47,9 +47,9 @@ The flagship weather forecasting models of Météo-France are accessible via the
| Forecast Range | Up to 51 hours | Up to 114 hours |

```python
from meteole import arome
from meteole import AromeForecast

arome_client = arome.AromeForecast(application_id=APPLICATION_ID) # APPLICATION_ID found on portail.meteo-france.Fr
arome_client = AromeForecast(application_id=APPLICATION_ID) # APPLICATION_ID found on portail.meteo-france.Fr

# let's look at the latest wind gusts
indicator = 'V_COMPONENT_OF_WIND_GUST__SPECIFIC_HEIGHT_LEVEL_ABOVE_GROUND'
Expand Down Expand Up @@ -83,7 +83,7 @@ textes_vigilance = client.get_textes_vigilance() # pour accéder aux bulletins d
client.get_vignette() # pour afficher les vignettes
```

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

To have more documentation from MeteoFrance in Vigilance Bulletin :
- [Meteo France Documentation](https://donneespubliques.meteofrance.fr/?fond=produit&id_produit=305&id_rubrique=50)
Binary file removed assets/vignette_exemple.png
Binary file not shown.
File renamed without changes
164 changes: 98 additions & 66 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,66 +1,98 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "meteole"
version = "0.2.0"
description = "Wrapper around Méteo-France Public API"
readme = "README.md"
authors = [
{name = "Squad Geodatahub / Tribu IODA"},
]

classifiers = [ #
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Topic :: Software Development :: Libraries :: Python Modules",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
# "Programming Language :: Python :: 3.12", no wheels 3.12 for dependency ecmwflibs
]

dependencies = [
"pandas>=2.0.0",
"ecmwflibs>=0.6.3",
"cfgrib>=0.0.11.0",
"requests>=2.31.0",
"xarray>=2024.5.0",
"xmltodict>=0.13.0",
"matplotlib>=3.8.4",
]

[project.optional-dependencies]
test = ["pytest", "coverage"]
doc = ["mkdocs-material", "mkdocstrings[python]", "jinja2==3.0.3"]
mypy = ["mypy"]
ruff = ["ruff"]
dev = ["mypy", "pre-commit", "ruff"]
all = ["meteole[test,dev,doc,mypy,ruff]"]

[tool.setuptools]
package-dir = { "" = "src" }

[tool.pytest.ini_options]
pythonpath = ["src"]
testpaths = ["tests"]

[tool.mypy]
exclude = ["tests"]
ignore_missing_imports = true

[tool.ruff]
line-length = 120
exclude = ["tests"]
extend-include = ["*.ipynb"]

[tool.ruff.lint]
ignore = ["E501", "D2", "D3", "D4", "D104", "D100", "D106", "S311"]
extend-select = [
"UP", # pyupgrade"
"S", # flake8-bandit,
"B", # flake8-bugbear
"I", # isort
"D", # pydocstyle
"NPY", # NumPy-specific rules
]
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "meteole"
version = "0.2.0"
requires-python = ">3.9.0"
description = "A Python client library for Méteo-France public API."
readme = "README.md"
license = {text = "Apache-2.0"}
authors = [
{name = "?", email = "?@?.?"},
{name = "?", email = "?@?.?"},
]

classifiers = [
"Development Status :: 4 - Beta",
"Operating System :: OS Independent",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Topic :: Software Development :: Libraries :: Python Modules",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
# "Programming Language :: Python :: 3.12", no wheels 3.12 for dependency ecmwflibs
"License :: OSI Approved :: Apache Software License",
]

dependencies = [
"pandas>=2.0.0",
"ecmwflibs>=0.6.3",
"cfgrib>=0.0.11.0",
"requests>=2.31.0",
"xarray>=2024.5.0",
"xmltodict>=0.13.0",
"matplotlib>=3.8.4",
]

[project.urls]
Homepage = "https://pages.github.com/MAIF/meteole/home"
Documentation = "https://pages.github.com/MAIF/meteole/home"
Repository = "https://github.com/MAIF/meteole"

[project.optional-dependencies]
test = ["pytest", "coverage"]
doc = ["mkdocs-material", "mkdocstrings[python]", "jinja2==3.0.3"]
dev = ["mypy", "pre-commit", "ruff"]
all = ["meteole[test,doc,dev]"]

[tool.setuptools]
package-dir = { "" = "src" }

[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools.package-data]
"meteole" = ["py.typed"]

[tool.pytest.ini_options]
pythonpath = ["src"]
testpaths = ["tests"]

[tool.mypy]
exclude = ["tests"]
ignore_missing_imports = true
plugins = ["pydantic.mypy"]

[tool.ruff]
line-length = 120
extend-include = ["*.ipynb"]

[tool.ruff.lint]
ignore = ["E501", "D2", "D3", "D4", "D104", "D100", "D106", "S311", "UP007"]
extend-select = [
"E", # pycodestyle errors
"F", # pyflakes
"W", # pycodestyle warnings
"A", # flake8-builtins
"PLC", # pylint conventions
"PLE", # pylint errors
"PLW", # pylint warnings
"UP", # pyupgrade
"S", # flake8-bandit,
"B", # flake8-bugbear
"I", # isort
"D", # pydocstyle
"NPY", # NumPy-specific rules
]
exclude = ["tests/*"]

[tool.ruff.format]
docstring-code-format = true

[tool.ruff.lint.pydocstyle]
convention = "google"
13 changes: 7 additions & 6 deletions src/meteole/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from meteole.arome import AromeForecast # noqa
from meteole.arpege import ArpegeForecast # noqa
from meteole.vigilance import Vigilance # noqa

import logging
from importlib.metadata import version

__version__ = version("meteole")
from meteole._arome import AromeForecast
from meteole._arpege import ArpegeForecast
from meteole._client import MeteoFranceClient
from meteole._vigilance import Vigilance

__all__ = ["AromeForecast", "ArpegeForecast", "MeteoFranceClient", "Vigilance"]

import logging
__version__ = version("meteole")


def setup_logger():
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit f3b293b

Please sign in to comment.