Skip to content

Commit

Permalink
Merge pull request #163 from ParkenDD/prepare-0.6.0-release
Browse files Browse the repository at this point in the history
prepare 0.6.0 release
  • Loading branch information
the-infinity authored Jun 14, 2024
2 parents e296ced + fa8a887 commit ed60d07
Show file tree
Hide file tree
Showing 19 changed files with 65 additions and 51 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ jobs:
# We could also use the official GitHub Actions integration.
# https://beta.ruff.rs/docs/usage/#github-action
# uses: chartboost/ruff-action@v1
run: ruff check --exclude webapp/converter --output-format github ./webapp
run: ruff check --output-format github ./webapp ./tests

- name: format using black
- name: format using ruff formatter
# We could also use the official GitHub Actions integration.
# https://black.readthedocs.io/en/stable/integrations/github_actions.html
# uses: uses: psf/black@stable
run: |
black --exclude webapp/converter -S --check --diff ./webapp
# https://beta.ruff.rs/docs/usage/#github-action
# uses: chartboost/ruff-action@v1
run: ruff check ./webapp ./tests
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## Version 0.6.0

Released 2024-06-14

### Features

* [Multiple new converters at ParkAPI Sources 0.5.0](https://github.com/ParkenDD/parkapi-sources-v3/blob/main/CHANGELOG.md#050)

### Fixes

* [Fixes calculating geo-distance at matching service](https://github.com/ParkenDD/park-api-v3/pull/162)
* [Multiple fixes at ParkAPI Sources 0.5.0](https://github.com/ParkenDD/parkapi-sources-v3/blob/main/CHANGELOG.md#050)

### Maintenance

* Replace black by ruff formatter
* Dependency updates


## Version 0.5.1

Released 2024-06-04
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,10 @@ open-coverage:

.PHONY: lint-fix
lint-fix:
$(FLASK_RUN) ruff --exclude webapp/converter --fix ./webapp
$(FLASK_RUN) black --exclude converter ./webapp
$(FLASK_RUN) ruff format ./webapp
$(FLASK_RUN) ruff check --fix ./webapp

.PHONY: lint-check
lint-check:
$(FLASK_RUN) ruff --exclude webapp/converter ./webapp
$(FLASK_RUN) black --exclude converter -S --check --diff webapp
$(FLASK_RUN) ruff format --check --diff webapp
$(FLASK_RUN) ruff check ./webapp
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ services:
command: ["flask", "source", "init-converters"]

postgresql:
image: postgis/postgis:16-3.4
image: postgis/postgis:15-3.4
volumes:
- postgresql:/var/lib/postgresql/data/
environment:
Expand Down
13 changes: 5 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@ lint.select = [
]

lint.ignore = [
"E501", # line too long, handled by black
"B008", # do not perform function calls in argument defaults
"C901", # too complex
"F401", # imported but unused
"S101", # use of assert detected
]

lint.fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]

exclude = [
".bzr",
".direnv",
Expand Down Expand Up @@ -48,12 +45,12 @@ line-length = 140

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]
"tests/*" = ["S101", "S105", "S106"]

[tool.ruff.lint.flake8-quotes]
inline-quotes = "single"
multiline-quotes = "single"
multiline-quotes = "double"
docstring-quotes = "double"

[tool.black]
line-length = 140
skip-string-normalization = true
[tool.ruff.format]
quote-style = "single"
5 changes: 2 additions & 3 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
pytest~=8.2.1
black~=24.4.2
ruff~=0.4.5
pytest~=8.2.2
ruff~=0.4.8
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SQLAlchemy-Utc~=0.14.0
pytz~=2024.1
psycopg2-binary~=2.9.9
pymysql~=1.1.1
requests~=2.32.2
requests~=2.32.3
alembic~=1.13.1
gunicorn~=22.0.0
pyyaml~=6.0.1
Expand All @@ -16,11 +16,11 @@ werkzeug~=3.0.3
validataclass~=0.10.0
python-dotenv~=1.0.1
click~=8.1.7
openpyxl~=3.1.2
openpyxl~=3.1.4
opening-hours-py~=0.6.18
kombu~=5.3.7
lxml~=5.2.2
parkapi-sources~=0.4.4
parkapi-sources~=0.5.0

# required for converters
beautifulsoup4~=4.12.3
Expand Down
15 changes: 9 additions & 6 deletions tests/unit/common/validation/integer_validators_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@

class IntegerValidatorsTest:
@staticmethod
@pytest.mark.parametrize('input_str, output_int', [
('3 Stunden', 60 * 60 * 3),
('10 Tage', 60 * 60 * 24 * 10),
('1 Woche', 60 * 60 * 24 * 7),
('10 Monate', 60 * 60 * 24 * 30 * 10),
])
@pytest.mark.parametrize(
'input_str, output_int',
[
('3 Stunden', 60 * 60 * 3),
('10 Tage', 60 * 60 * 24 * 10),
('1 Woche', 60 * 60 * 24 * 7),
('10 Monate', 60 * 60 * 24 * 30 * 10),
],
)
def test_german_duration_integer_validate_success(input_str: str, output_int: int):
validator = GermanDurationIntegerValidator()
result = validator.validate(input_str)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""

from flask import jsonify
from flask_openapi.decorator import EmptyResponse, ErrorResponse, Request, document
from flask_openapi.decorator import ErrorResponse, Request, document
from flask_openapi.schema import JsonSchema
from parkapi_sources.exceptions import ImportParkingSiteException
from parkapi_sources.models import RealtimeParkingSiteInput, StaticParkingSiteInput
Expand Down
2 changes: 1 addition & 1 deletion webapp/cli/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from webapp.dependencies import dependencies
from webapp.repositories import SourceRepository
from webapp.services.import_service import ParkingSiteGenericImportService, ParkingSiteXlsxImportService
from webapp.services.import_service import ParkingSiteXlsxImportService

source_cli = AppGroup('source', help='Source related commands')

Expand Down
1 change: 0 additions & 1 deletion webapp/common/config/base_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"""

import os
from datetime import timedelta


class BaseConfig:
Expand Down
13 changes: 9 additions & 4 deletions webapp/common/server_auth/server_auth_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ class ServerAuthUser:

def __post_init__(self):
# Type checks
assert isinstance(self.username, str)
assert isinstance(self.password_hash, str)
assert isinstance(self.roles, list) and all(isinstance(role, ServerAuthRole) for role in self.roles)
if (
not isinstance(self.username, str)
or not isinstance(self.password_hash, str)
or not isinstance(self.roles, list)
and all(isinstance(role, ServerAuthRole) for role in self.roles)
):
raise Exception('invalid server auth config')

@classmethod
def create_from_dict(cls, username: str, data: dict) -> 'ServerAuthUser':
Expand All @@ -62,7 +66,8 @@ class ServerAuthDatabase:
_users: Dict[str, ServerAuthUser]

def __init__(self, *, server_auth_users: Dict[str, ServerAuthUser]):
assert all(isinstance(user, ServerAuthUser) for user in server_auth_users.values())
if not all(isinstance(user, ServerAuthUser) for user in server_auth_users.values()):
raise Exception('invalid server auth config')
self._users = server_auth_users

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion webapp/entry_point_celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
from .app import launch

application = launch()
from .extensions import celery # noqa: E402
from .extensions import celery # noqa: E402, F401
4 changes: 0 additions & 4 deletions webapp/models/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@

from typing import TYPE_CHECKING

from parkapi_sources.models.enums import ExternalIdentifierType
from sqlalchemy import BigInteger, String
from sqlalchemy import (
Enum as SqlalchemyEnum,
)
from sqlalchemy.orm import Mapped, mapped_column, relationship

from webapp.extensions import db
Expand Down
3 changes: 0 additions & 3 deletions webapp/public_rest_api/park_api_v1/park_api_v1_rest_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
Use of this source code is governed by an MIT-style license that can be found in the LICENSE.txt.
"""

from datetime import datetime, timezone

from flask import jsonify
from flask_openapi.decorator import (
ErrorResponse,
Parameter,
Response,
ResponseData,
Expand Down
6 changes: 4 additions & 2 deletions webapp/public_rest_api/park_api_v1/park_api_v1_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
},
),
'forecast': BooleanField(
description='If the data source offers a forecast. Is not available at this service and documented just for compatibility reasons.'
description='If the data source offers a forecast. Is not available at this service and documented just for '
'compatibility reasons.'
),
'lot_type': AnyOfField(
allowed_values=['street', 'lot', 'underground', 'garage'],
Expand All @@ -71,7 +72,8 @@
'opening_hours': StringField(required=False, description='In OSM opening_hours format'),
'fee_hours': StringField(
required=False,
description='In OSM opening_hours format. Is not available at this service and documented just for compatibility reasons.',
description='In OSM opening_hours format. Is not available at this service and documented just for compatibility '
'reasons.',
),
'address': StringField(
required=False,
Expand Down
2 changes: 1 addition & 1 deletion webapp/repositories/base_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from abc import ABC, abstractmethod
from typing import Any, Generic, Optional, Type, TypeVar

from sqlalchemy.orm import Query, scoped_session
from sqlalchemy.orm import scoped_session
from validataclass_search_queries.repositories import SearchQueryRepositoryMixin

from webapp.models import BaseModel
Expand Down
1 change: 0 additions & 1 deletion webapp/services/matching_service/matching_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from parkapi_sources.models.enums import ParkAndRideType, ParkingSiteType
from pyproj import Geod

from webapp.common.logging.models import LogMessageType
from webapp.models import ParkingSite
from webapp.repositories import ParkingSiteRepository
from webapp.repositories.parking_site_repository import ParkingSiteLocation
Expand Down
1 change: 0 additions & 1 deletion webapp/services/tasks/generic_import_heartbeat_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from webapp.dependencies import dependencies
from webapp.extensions import celery
from webapp.services.import_service import ParkingSiteGenericImportService

from .base_task import BaseTask

Expand Down

0 comments on commit ed60d07

Please sign in to comment.