Skip to content

Commit

Permalink
Merge pull request #61 from ParkenDD/version-0.5.0-preparations
Browse files Browse the repository at this point in the history
0.5.0 release, replace black by ruff format, maintenance
  • Loading branch information
the-infinity committed Jun 14, 2024
2 parents 3e64888 + 28e0fed commit 7734b5f
Show file tree
Hide file tree
Showing 15 changed files with 69 additions and 56 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ jobs:
# uses: chartboost/ruff-action@v1
run: ruff check --output-format github ./src ./tests

- name: format using black
- name: format check using ruff
# We could also use the official GitHub Actions integration.
# https://black.readthedocs.io/en/stable/integrations/github_actions.html
# uses: uses: psf/black@stable
# https://beta.ruff.rs/docs/usage/#github-action
# uses: chartboost/ruff-action@v1
run: |
black -S --check --diff ./src ./tests
ruff format --check ./src ./tests
test:
runs-on: ubuntu-latest
Expand Down
29 changes: 28 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# Changelog

## 0.5.0

Release 2024-06-14

### Features

* [Own repository for static data](https://github.com/ParkenDD/parkapi-sources-v3/pull/53)
* [A81 P&M Converter](https://github.com/ParkenDD/parkapi-sources-v3/pull/55)
* [Bietigheim-Bissingen Converter](https://github.com/ParkenDD/parkapi-sources-v3/pull/57)
* [Heidelberg Converter](https://github.com/ParkenDD/parkapi-sources-v3/pull/58)


### Fixes

* [Fix Freiburg timezone](https://github.com/ParkenDD/parkapi-sources-v3/pull/54)
* [https://github.com/ParkenDD/parkapi-sources-v3/pull/56](https://github.com/ParkenDD/parkapi-sources-v3/pull/56)
* [Better Freiburg Converter](https://github.com/ParkenDD/parkapi-sources-v3/pull/59)


### Maintenance

* Replace black by ruff formatter
* Dependency updates


## 0.4.4

Released 2024-06-04
Expand Down Expand Up @@ -61,9 +86,11 @@ Released 2024-05-16

Released 2024-05-03

Fixes:
### Fixes:

* Register neckarsulm_bike and reutlingen_bike properly


## 0.3.0

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


.PHONY: lint
lint: black ruff
lint: ruff-format ruff


.PHONY: black
black:
black ./src ./tests
.PHONY: ruff-format
ruff-format:
ruff format ./src ./tests


.PHONY: ruff
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,22 +237,22 @@ Please keep in mind that you will have to add tests for the migrated scraper.

### Linting

As we try to keep a consistent code style, please lint your code before creating the merge request. We use `black` and `ruff` for linting.
There is Makefile target to do both: `make lint`. It runs the following commands:
As we try to keep a consistent code style, please lint your code before creating the merge request. We use `ruff` for linting and
formatting. There is Makefile target to do both: `make lint`. It runs the following commands:

```bash
black ./src ./tests
ruff format ./src ./tests
ruff check --fix ./src ./tests
```

If you don't have `black` and `ruff` installed globally, you can create a virtual environment for these tools:
If you don't have `ruff` installed globally, you can create a virtual environment for these tools:

```bash
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt -r requirements-dev.txt

black ./src ./tests
ruff format ./src ./tests
ruff check --fix ./src ./tests
```

Expand Down
24 changes: 9 additions & 15 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,17 @@ classifiers = [
dependencies = [
"validataclass~=0.10.0",
"pyproj~=3.6.1",
"lxml~=5.2.1",
"openpyxl~=3.1.2",
"requests~=2.32.2",
"lxml~=5.22",
"openpyxl~=3.1.4",
"requests~=2.32.3",
"beautifulsoup4~=4.12.3",
"urllib3~=2.2.1",
]

[project.optional-dependencies]
testing = [
"black~=24.4.2",
"ruff~=0.4.1",
"pytest~=8.2.0",
"ruff~=0.4.8",
"pytest~=8.2.2",
"pytest-cov~=5.0.0",
"requests-mock~=1.12.1",
]
Expand Down Expand Up @@ -92,14 +91,10 @@ lint.select = [
]

lint.ignore = [
"E501", # line too long, handled by black
"B008", # do not perform function calls in argument defaults
"C901", # too complex
"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 @@ -128,13 +123,12 @@ line-length = 140

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]
"tests/*" = ["S105"]
"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"
7 changes: 3 additions & 4 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
black~=24.4.2
ruff~=0.4.1
pytest~=8.2.0
ruff~=0.4.8
pytest~=8.2.2
pytest-cov~=5.0.0
requests-mock~=1.12.1
tox~=4.15.0
tox~=4.15.1
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
validataclass~=0.10.0
pyproj~=3.6.1
lxml~=5.2.1
openpyxl~=3.1.2
requests~=2.32.2
lxml~=5.2.2
openpyxl~=3.1.4
requests~=2.32.3
beautifulsoup4~=4.12.3
urllib3~=2.2.1
1 change: 0 additions & 1 deletion src/parkapi_sources/converters/bfrk_bw/base_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@


class BfrkBasePushConverter(CsvConverter, ABC):

@property
@abstractmethod
def header_mapping(self) -> dict[str, str]:
Expand Down
1 change: 0 additions & 1 deletion src/parkapi_sources/converters/ellwangen/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@


class EllwangenPushConverter(NormalizedXlsxConverter):

source_info = SourceInfo(
uid='ellwangen',
name='Ellwangen Parkdaten',
Expand Down
2 changes: 0 additions & 2 deletions src/parkapi_sources/converters/heidelberg/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@


class RemoveValueDict(Validator):

wrapped_validator: Validator

def __init__(self, validator: Validator):

# Check parameter validity
if not isinstance(validator, Validator):
raise TypeError('RemoveValueDict requires a Validator instance.')
Expand Down
1 change: 0 additions & 1 deletion tests/converters/bietigheim_bissingen_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def bietigheim_bissingen_pull_converter(bietigheim_bissingen_config_helper: Mock
class BietigheimBissingenPullConverterTest:
@staticmethod
def test_get_static_parking_sites(bietigheim_bissingen_pull_converter: BietigheimBissingenPullConverter):

static_parking_site_inputs, import_parking_site_exceptions = bietigheim_bissingen_pull_converter.get_static_parking_sites()

assert len(static_parking_site_inputs) > len(
Expand Down
1 change: 0 additions & 1 deletion tests/converters/karlsruhe_bike_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def karlsruhe_bike_pull_converter(mocked_config_helper: Mock) -> KarlsruheBikePu
class KarlsruheBikePullConverterTest:
@staticmethod
def test_get_static_parking_sites(karlsruhe_bike_pull_converter: KarlsruheBikePullConverter, requests_mock_karlsruhe_bike: Mocker):

static_parking_site_inputs, import_parking_site_exceptions = karlsruhe_bike_pull_converter.get_static_parking_sites()

assert len(static_parking_site_inputs) == 154
Expand Down
1 change: 0 additions & 1 deletion tests/converters/karlsruhe_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def karlsruhe_pull_converter(mocked_config_helper: Mock) -> KarlsruhePullConvert
class KarlsruhePullConverterTest:
@staticmethod
def test_get_static_parking_sites(karlsruhe_pull_converter: KarlsruhePullConverter, requests_mock_karlsruhe: Mocker):

static_parking_site_inputs, import_parking_site_exceptions = karlsruhe_pull_converter.get_static_parking_sites()

assert len(static_parking_site_inputs) > len(
Expand Down
20 changes: 10 additions & 10 deletions tests/util/data_xml_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from lxml import etree

xml_string_example_1: str = '''
xml_string_example_1: str = """
<Envelope>
<Header>
<Security>
Expand All @@ -26,7 +26,7 @@
</Content>
</Body>
</Envelope>
'''
"""

xml_etree_example_1: etree.Element = etree.fromstring(xml_string_example_1) # noqa: S320

Expand Down Expand Up @@ -90,11 +90,11 @@
}


xml_string_example_2: str = '''
xml_string_example_2: str = """
<status>
<ChargePointStatusType>Operative</ChargePointStatusType>
</status>
'''
"""

xml_etree_example_2: etree.Element = etree.fromstring(xml_string_example_2) # noqa: S320

Expand All @@ -112,11 +112,11 @@
'status': 'Operative',
}

xml_string_example_3: str = '''
xml_string_example_3: str = """
<resultCode>
<resultCode>ok</resultCode>
</resultCode>
'''
"""

xml_etree_example_3: etree.Element = etree.fromstring(xml_string_example_3) # noqa: S320

Expand All @@ -132,9 +132,9 @@
'resultCode': 'ok',
}

xml_string_example_4: str = '''
xml_string_example_4: str = """
<resultDescription xsi:nil="true" xmlns:xsi="http:https://www.w3.org/2001/XMLSchema-instance"/>
'''
"""

xml_etree_example_4: etree.Element = etree.fromstring(xml_string_example_4) # noqa: S320

Expand All @@ -144,13 +144,13 @@
'resultDescription': None,
}

xml_string_example_5: str = '''
xml_string_example_5: str = """
<topLevelTag class="testClass">
testText
<secondLevelTag>ok</secondLevelTag>
<class>anotherTestClass</class>
</topLevelTag>
'''
"""

xml_etree_example_5: etree.Element = etree.fromstring(xml_string_example_5) # noqa: S320

Expand Down
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ skip_install = true
deps = ruff
commands = ruff check src/ tests/

[testenv:black]
[testenv:ruff-format]
skip_install = true
deps = black
commands = black --check src/ tests/
deps = ruff
commands = ruff format --check src/ tests/

[testenv:clean]
skip_install = true
Expand Down

0 comments on commit 7734b5f

Please sign in to comment.