diff --git a/.github/workflows/build-wheel.yml b/.github/workflows/build-wheel.yml new file mode 100644 index 0000000..b9dc918 --- /dev/null +++ b/.github/workflows/build-wheel.yml @@ -0,0 +1,35 @@ +name: Build Python Wheel + +on: + push: + branches: [ main ] + pull_request: + workflow_dispatch: + +jobs: + build-wheel: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install build tools + run: | + python -m pip install --upgrade pip + python -m pip install build wheel setuptools + + - name: Build wheel + run: | + python -m build + + - name: Upload wheel artifact + uses: actions/upload-artifact@v4 + with: + name: wheel + path: dist/*.whl diff --git a/meterbus/telegram_variable_data_record.py b/meterbus/telegram_variable_data_record.py index 13dee8e..7c77498 100644 --- a/meterbus/telegram_variable_data_record.py +++ b/meterbus/telegram_variable_data_record.py @@ -189,7 +189,8 @@ def interpreted(self): 'unit': unit, 'type': str(typ), 'storage_number': storage_number, - 'function': str(self.dib.function_type) + 'function': str(self.dib.function_type), + 'raw_vib': self.vib.parts } if unit_enh is not None: diff --git a/pyproject.toml b/pyproject.toml index 5e20f19..2828e1c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ description = "Python implementation of the Meter-Bus protocol" authors = [ { name = "Mikael Ganehag Brorsson", email = "mikael.brorsson@gmail.com" } ] -license = { text = "BSD-3-Clause" } +license = "BSD-3-Clause" readme = "README.md" requires-python = ">=3.6" dependencies = [ @@ -22,7 +22,6 @@ dependencies = [ classifiers = [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", - "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", @@ -47,3 +46,6 @@ exclude = ["tests", "examples"] [tool.setuptools.dynamic] version = { attr = "meterbus.__version__" } + +[project.optional-dependencies] +test = ["pytest", "pytest-cov"] \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 0ab0b7e..d073d6a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,7 @@ pycryptodome==3.19.1 # via -r requirements.in pyserial==3.5 # via -r requirements.in -pyyaml==6.0 +pyyaml>=6.0.1 # via -r requirements.in simplejson==3.17.6 # via -r requirements.in diff --git a/setup.cfg b/setup.cfg index a41b226..9ff5a8f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,4 +1,4 @@ # Inside of setup.cfg [metadata] -description-file = README.md +description_file = README.md license_file = LICENSE diff --git a/tests/test_variable_data_record.py b/tests/test_variable_data_record.py index f90839f..6431a5d 100644 --- a/tests/test_variable_data_record.py +++ b/tests/test_variable_data_record.py @@ -105,6 +105,7 @@ def test_verify_ustr_value(self): def test_json_record0(self): dict_record = { + "raw_vib": [253, 27], "value": 0, "unit": "MeasureUnit.NONE", "type": "VIFUnitExt.DIGITAL_INPUT", @@ -116,6 +117,7 @@ def test_json_record0(self): def test_json_record1(self): dict_record = { + "raw_vib": [252, 116], "value": 45.64, "unit": "%RH", "type": "VIFUnit.VARIABLE_VIF", @@ -127,6 +129,7 @@ def test_json_record1(self): def test_json_record2(self): dict_record = { + "raw_vib": [252, 116], "value": 45.52, "unit": "%RH", "type": "VIFUnit.VARIABLE_VIF", @@ -141,6 +144,7 @@ def test_json_record2(self): def test_json_record4(self): dict_record = { + "raw_vib": [101], "value": 22.56, "unit": "MeasureUnit.C", "type": "VIFUnit.EXTERNAL_TEMPERATURE", @@ -152,6 +156,7 @@ def test_json_record4(self): def test_json_record5(self): dict_record = { + "raw_vib": [101], "value": 21.60, "unit": "MeasureUnit.C", "type": "VIFUnit.EXTERNAL_TEMPERATURE", @@ -163,6 +168,7 @@ def test_json_record5(self): def test_json_record6(self): dict_record = { + "raw_vib": [101], "value": 23.39, "unit": "MeasureUnit.C", "type": "VIFUnit.EXTERNAL_TEMPERATURE", @@ -174,6 +180,7 @@ def test_json_record6(self): def test_json_record7(self): dict_record = { + "raw_vib": [114], "value": 86400, "unit": "MeasureUnit.SECONDS", "type": "VIFUnit.AVG_DURATION", @@ -185,6 +192,7 @@ def test_json_record7(self): def test_json_record8(self): dict_record = { + "raw_vib": [101], "value": 22.76, "unit": "MeasureUnit.C", "type": "VIFUnit.EXTERNAL_TEMPERATURE", @@ -196,6 +204,7 @@ def test_json_record8(self): def test_json_record9(self): dict_record = { + "raw_vib": [101], "value": 22.69, "unit": "MeasureUnit.C", "type": "VIFUnit.EXTERNAL_TEMPERATURE", @@ -209,6 +218,7 @@ def test_json_record9(self): def test_json_record10(self): dict_record = { + "raw_vib": [120], "value": 54000834, "unit": "MeasureUnit.NONE", "type": "VIFUnit.FABRICATION_NO", @@ -220,6 +230,7 @@ def test_json_record10(self): def test_json_record11(self): dict_record = { + "raw_vib": [253, 15], "value": 262144, "unit": "MeasureUnit.NONE", "type": "VIFUnitExt.SOFTWARE_VERSION", @@ -231,6 +242,7 @@ def test_json_record11(self): def test_json_record12(self): dict_record = { + "raw_vib": [131, 59], "value": 1234567, "unit": "MeasureUnit.WH", "type": "VIFUnit.ENERGY_WH", @@ -243,6 +255,7 @@ def test_json_record12(self): def test_json_record13(self): dict_record = { + "raw_vib": [131, 60], "value": 1234567, "unit": "MeasureUnit.WH", "type": "VIFUnit.ENERGY_WH",