diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 46d8ec9..c133c3b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,7 @@ jobs: contents: read id-token: write runs-on: ubuntu-latest - environment: production + environment: release steps: - name: Checkout source code uses: actions/checkout@v4 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 24ce9aa..3874426 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,6 +9,7 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.6.0 hooks: + - id: check-toml - id: check-yaml args: [--allow-multiple-documents] - id: end-of-file-fixer diff --git a/docs/how-to-guides.md b/docs/how-to-guides.md index 8662798..cd917ab 100644 --- a/docs/how-to-guides.md +++ b/docs/how-to-guides.md @@ -73,7 +73,7 @@ pre-commit install We use [Poetry](https://python-poetry.org/) as the project packaging and dependency management. Install development -dependency with the following command +dependency with the following command: ```console poetry install @@ -83,6 +83,7 @@ And done! You can make your changes and test thoroughly. Then push your branch to your fork and submit a pull request. !!! tip + If you have installed [poethepoet](https://poethepoet.natn.io/index.html) globally, then you can use the command below only with `poe lint`, `poe format`, etc instead of `poetry run poe lint`, @@ -132,7 +133,7 @@ poetry run poe format-check ### Testing We use [pytest](https://docs.pytest.org/en/stable/) for testing. -To run pytest you can use the following command +To run pytest you can use the following command: ```console poetry run poe test @@ -178,9 +179,10 @@ poetry run poe docs-build We use the GitHub workflow to automatically release to PyPI when we release to GitHub. The special environment for people who have access -to the workflow is in the GitHub environment with the name `production`. +to the workflow is in the GitHub environment with the name `release`. Each release tag must be the same as `version` in `pyproject.toml` in -the `tool.poetry` section. +the `tool.poetry` section with prefix `v`, for example `v1.0.0`. Also +we follow Semantic Versioning with version number MAJOR.MINOR.PATCH. ### Update Dependency diff --git a/pyproject.toml b/pyproject.toml index e0b0cb0..9ff2361 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -85,8 +85,8 @@ target-version = "py311" src = ["src", "tests"] [tool.ruff.lint] -select = ["E", "F", "W", "I"] -ignore = [] +select = ["F", "E", "W", "C90", "I", "B"] +ignore = ["E501", "C901"] [tool.ruff.format] docstring-code-format = true diff --git a/src/bmkg/parsers/parse_weather_forecast_data.py b/src/bmkg/parsers/parse_weather_forecast_data.py index 21cb440..d04e61d 100644 --- a/src/bmkg/parsers/parse_weather_forecast_data.py +++ b/src/bmkg/parsers/parse_weather_forecast_data.py @@ -121,6 +121,7 @@ def parse_weather_forecast_data(weather_forecast_data: str | bytes) -> WeatherFo ), parameters["wd"], parameters["ws"], + strict=False, ) ) diff --git a/tests/test_parsers/test_parse_datetime_element.py b/tests/test_parsers/test_parse_datetime_element.py index fb27c15..1ca5911 100644 --- a/tests/test_parsers/test_parse_datetime_element.py +++ b/tests/test_parsers/test_parse_datetime_element.py @@ -15,5 +15,5 @@ def test_parse_element_with_invalid_attribute(): with pytest.raises( WeatherForecastParseError, match="datetime attribute in timerange tag not found" ): - for dt in parse_datetime_element(element): + for _dt in parse_datetime_element(element): pass diff --git a/tests/test_parsers/test_parse_humidity_element.py b/tests/test_parsers/test_parse_humidity_element.py index b02fa2b..91108d4 100644 --- a/tests/test_parsers/test_parse_humidity_element.py +++ b/tests/test_parsers/test_parse_humidity_element.py @@ -15,7 +15,7 @@ def test_parse_element_with_invalid_attribute(): with pytest.raises( WeatherForecastParseError, match="value tag in timerange tag not found" ): - for humidity in parse_humidity_element(element): + for _humidity in parse_humidity_element(element): pass @@ -31,5 +31,5 @@ def test_parse_element_with_invalid_humidity_text(): with pytest.raises( WeatherForecastParseError, match="value tag in timerange tag has no text" ): - for humidity in parse_humidity_element(element): + for _humidity in parse_humidity_element(element): pass diff --git a/tests/test_parsers/test_parse_temperature_element.py b/tests/test_parsers/test_parse_temperature_element.py index fd770aa..b0efc99 100644 --- a/tests/test_parsers/test_parse_temperature_element.py +++ b/tests/test_parsers/test_parse_temperature_element.py @@ -19,7 +19,7 @@ def test_parse_element_with_invalid_attribute(): WeatherForecastParseError, match="one or more value tag in timerange tag not found", ): - for temperature in parse_temperature_element(element): + for _temperature in parse_temperature_element(element): pass @@ -49,5 +49,5 @@ def test_parse_element_with_invalid_value_elements_text(index, err_msg): WeatherForecastParseError, match=err_msg, ): - for temperature in parse_temperature_element(element): + for _temperature in parse_temperature_element(element): pass diff --git a/tests/test_parsers/test_parse_weather_element.py b/tests/test_parsers/test_parse_weather_element.py index 9dacd43..4bef1fb 100644 --- a/tests/test_parsers/test_parse_weather_element.py +++ b/tests/test_parsers/test_parse_weather_element.py @@ -15,7 +15,7 @@ def test_parse_element_with_invalid_attribute(): with pytest.raises( WeatherForecastParseError, match="value tag in timerange tag not found" ): - for weather in parse_weather_element(element): + for _weather in parse_weather_element(element): pass @@ -31,5 +31,5 @@ def test_parse_element_with_invalid_weather_text(): with pytest.raises( WeatherForecastParseError, match="value tag in timerange tag has no text" ): - for weather in parse_weather_element(element): + for _weather in parse_weather_element(element): pass diff --git a/tests/test_parsers/test_parse_wind_direction_element.py b/tests/test_parsers/test_parse_wind_direction_element.py index b451630..80dca62 100644 --- a/tests/test_parsers/test_parse_wind_direction_element.py +++ b/tests/test_parsers/test_parse_wind_direction_element.py @@ -19,7 +19,7 @@ def test_parse_element_with_invalid_attribute(): WeatherForecastParseError, match="one or more value tag in timerange tag not found", ): - for wind_direction in parse_wind_direction_element(element): + for _wind_direction in parse_wind_direction_element(element): pass @@ -50,5 +50,5 @@ def test_parse_element_with_invalid_value_elements_text(index, err_msg): WeatherForecastParseError, match=err_msg, ): - for wind_direction in parse_wind_direction_element(element): + for _wind_direction in parse_wind_direction_element(element): pass diff --git a/tests/test_parsers/test_parse_wind_speed_element.py b/tests/test_parsers/test_parse_wind_speed_element.py index 8c5ff3d..cff6580 100644 --- a/tests/test_parsers/test_parse_wind_speed_element.py +++ b/tests/test_parsers/test_parse_wind_speed_element.py @@ -19,7 +19,7 @@ def test_parse_element_with_invalid_attribute(): WeatherForecastParseError, match="one or more value tag in timerange tag not found", ): - for wind_speed in parse_wind_speed_element(element): + for _wind_speed in parse_wind_speed_element(element): pass @@ -51,5 +51,5 @@ def test_parse_element_with_invalid_value_elements_text(index, err_msg): WeatherForecastParseError, match=err_msg, ): - for wind_speed in parse_wind_speed_element(element): + for _wind_speed in parse_wind_speed_element(element): pass