Skip to content

Commit 65bd66a

Browse files
authored
Merge pull request #55 from bmwcarit/XXXXX-fix-package-version
fix: refine package config
2 parents b4128ac + 356ce31 commit 65bd66a

8 files changed

Lines changed: 65 additions & 58 deletions

File tree

.github/workflows/python-dlt-ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
with:
2525
image: python-dlt/python-dlt-unittest:${{ matrix.LIBDLT_VERSION }}
2626
options: -v ${{ github.workspace }}:/pydlt -w /pydlt
27-
run: tox -e lint
27+
run: tox -e black,ruff
2828
- name: Run unit test
2929
uses: addnab/docker-run-action@v3
3030
with:

dlt/dlt.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def __del__(self):
9595
raise RuntimeError("Could not cleanup DLTFilter")
9696

9797
def __repr__(self):
98-
"""return the 'official' string representation of an object"""
98+
"""Return the 'official' string representation of an object"""
9999
apids = [ctypes.string_at(entry[:DLT_ID_SIZE]) for entry in self.apid]
100100
ctids = [ctypes.string_at(entry[:DLT_ID_SIZE]) for entry in self.ctid]
101101

@@ -287,7 +287,6 @@ def __setstate__(self, state):
287287
@staticmethod
288288
def from_bytes(data):
289289
"""Create a class instance from a byte string in DLT storage format"""
290-
291290
msg = DLTMessage()
292291
storageheader, remainder = msg.extract_storageheader(data)
293292

@@ -863,7 +862,8 @@ def __len__(self):
863862

864863
class DLTClient(cDltClient):
865864
"""DLTClient class takes care about correct initialization and
866-
cleanup"""
865+
cleanup
866+
"""
867867

868868
verbose = 0
869869

@@ -1076,7 +1076,8 @@ def py_dlt_file_main_loop(dlt_reader, limit=None, callback=None):
10761076
# pylint: disable=too-many-arguments,too-many-return-statements,too-many-branches
10771077
def py_dlt_client_main_loop(client, limit=None, verbose=0, dumpfile=None, callback=None):
10781078
"""Reimplementation of dlt_client.c:dlt_client_main_loop() in order to handle callback
1079-
function return value"""
1079+
function return value
1080+
"""
10801081
bad_messages = 0
10811082
while True:
10821083
if bad_messages > 100:

dlt/dlt_broker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Copyright (C) 2015. BMW Car IT GmbH. All rights reserved.
22
"""DLT Broker is running in a loop in a separate thread until stop_flag is set and adding received messages
3-
to all registered queues"""
3+
to all registered queues
4+
"""
45
from contextlib import contextmanager
56
import ipaddress as ip
67
import logging
@@ -64,7 +65,6 @@ def __init__(
6465
:param bool ignore_filter_set_ack_timeout: Ignore the timeout when the value is True
6566
:param **kwargs: All other args passed to DLTMessageHandler
6667
"""
67-
6868
# - dlt-time share memory init
6969
self._dlt_time_value = DLTTimeValue() if enable_dlt_time else None
7070

dlt/dlt_broker_handlers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ def break_blocking_main_loop(self):
304304
If it could constantly dispatch messages, then the main loop will not get into blocking state.
305305
Only when no more message could not be dispatched, the main loop would get into blocking state.
306306
307-
Not all message dispatchers need to implement this method"""
307+
Not all message dispatchers need to implement this method
308+
"""
308309
pass
309310

310311

pyproject.toml

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,13 @@ include = ["dlt*"]
3838
exclude = ["playbook*", "zuul.d*", "extracted_files*", "tests"]
3939

4040
[build-system]
41-
requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"]
41+
requires = ["setuptools>=45", "setuptools-git-versioning"]
4242
build-backend = "setuptools.build_meta"
4343

44+
[tool.setuptools-git-versioning]
45+
enabled = true
46+
dev_template = "{tag}.dev{ccount}+{sha}"
47+
4448
[tool.black]
4549
line-length = 119
4650
target_version = ['py37']
@@ -64,3 +68,42 @@ exclude = '''
6468
| _version.py
6569
)
6670
'''
71+
72+
[tool.ruff]
73+
line-length = 119
74+
select = ["E", "F", "Q", "D"]
75+
# the following is equivalent to --docstring-convention=pep8
76+
extend-ignore = [
77+
"D100",
78+
"D107",
79+
"D105",
80+
"D401",
81+
"D101",
82+
"D102",
83+
"D103",
84+
"D104",
85+
"D200",
86+
"D400",
87+
"D203",
88+
"D205",
89+
"D212",
90+
"D213",
91+
"D214",
92+
"D215",
93+
"D404",
94+
"D405",
95+
"D406",
96+
"D407",
97+
"D408",
98+
"D409",
99+
"D410",
100+
"D411",
101+
"D413",
102+
"D415",
103+
"D416",
104+
"D417",
105+
]
106+
107+
# D104: Missing docstring in public package
108+
# This D104 error will be ignored only in __init__ files
109+
per-file-ignores = {"__init__.py" = ["D104"]}

setup.cfg

Lines changed: 0 additions & 43 deletions
This file was deleted.

tests/dlt_broker_time_test.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ def fake_py_dlt_client_main_loop(client, callback, *args, **kwargs):
2020
@contextmanager
2121
def dlt_broker(pydlt_main_func=fake_py_dlt_client_main_loop, enable_dlt_time=True, enable_filter_set_ack=False):
2222
"""Initialize a fake DLTBroker"""
23-
2423
with patch("dlt.dlt_broker_handlers.DLTMessageHandler._client_connect"), patch(
2524
"dlt.dlt_broker_handlers.py_dlt_client_main_loop", side_effect=pydlt_main_func
2625
):
@@ -224,7 +223,6 @@ def test_add_context_with_ack_warning():
224223

225224
def test_start_stop_dlt_filter_ack_msg_handler():
226225
"""Test to start/stop DLTFilterAckMessageHandler normally"""
227-
228226
with dlt_filter_ack_msg_handler() as (handler, _):
229227
pass
230228

tox.ini

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py3,lint
2+
envlist = py3,black,ruff
33
output_dir={env:SPHINX_OUTPUT_DIR:{toxworkdir}/_build}
44
isolated_build = True
55

@@ -19,14 +19,21 @@ commands =
1919
filterwarnings =
2020
error
2121

22-
[testenv:lint]
22+
[testenv:ruff]
23+
basepython = python3
24+
skip_install = true
25+
deps =
26+
ruff
27+
mypy
28+
commands =
29+
ruff .
30+
31+
[testenv:black]
2332
skip_install = True
2433
skipsdist = True
2534
deps =
26-
flake8
2735
black
2836
commands =
29-
flake8
3037
black -l 119 --check .
3138

3239
[testenv:docs]

0 commit comments

Comments
 (0)