From 9b68c3f3e4fd0040f3941193c4f611e617ac45e2 Mon Sep 17 00:00:00 2001 From: Driver Generator 2 Date: Thu, 26 Mar 2026 10:47:11 +0000 Subject: [PATCH] Generate SEN62 driver from SEN62 model version 1.0.1 --- .github/workflows/build-docs.yml | 2 + LICENSE | 2 +- README.md | 2 +- docs/conf.py | 11 ++-- examples/example_usage_linux_sen62.py | 6 +- examples/example_usage_sensorbridge_sen62.py | 6 +- metadata.yml | 6 +- pyproject.toml | 66 +++++++++++++++++++ sensirion_i2c_sen62/commands.py | 13 ++-- sensirion_i2c_sen62/device.py | 6 +- sensirion_i2c_sen62/result_types.py | 6 +- sensirion_i2c_sen62/version.py | 4 +- setup.py | 69 +------------------- tests/test_sen62.py | 6 +- 14 files changed, 104 insertions(+), 101 deletions(-) create mode 100644 pyproject.toml diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 2a29a62..d2d0f78 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -8,3 +8,5 @@ on: jobs: documentation: uses: sensirion/.github/.github/workflows/driver.python.documentation.yml@main + with: + use-project-requirements: true diff --git a/LICENSE b/LICENSE index 2062766..8fe04ed 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ BSD 3-Clause License -Copyright (c) 2025, Sensirion AG +Copyright (c) 2026, Sensirion AG All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/README.md b/README.md index c145c35..dcea47b 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Click [here](https://sensirion.com/sen6x-air-quality-sensor-platform) to learn m -The default I²C address of [SEN62](https://www.sensirion.com/products/catalog/SEN62) is **0x6B**. +The default I²C address of [SEN62](https://www.sensirion.com/products/catalog/SEN62) is **0x6b**. diff --git a/docs/conf.py b/docs/conf.py index 54254db..2c2dad6 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -4,11 +4,12 @@ # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html + import os import sys from datetime import datetime -import pkg_resources +import importlib.metadata as metadata import sphinx.ext.autodoc import sensirion_i2c_sen62 @@ -17,16 +18,16 @@ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) # -- Project information ----------------------------------------------------- -distribution = pkg_resources.get_distribution('sensirion_i2c_sen62') +distribution = metadata.distribution("sensirion_i2c_sen62") -project = u'sensirion_i2c_sen62' +project = distribution.name copyright = u'{} Sensirion AG, Switzerland'.format(datetime.now().year) author = 'Sensirion AG' # The short X.Y version -version = sensirion_i2c_sen62.__version__ +version = distribution.version # The full version, including alpha/beta/rc tags -release = sensirion_i2c_sen62.__version__ +release = distribution.version # -- General configuration --------------------------------------------------- diff --git a/examples/example_usage_linux_sen62.py b/examples/example_usage_linux_sen62.py index 276ca5d..9a75803 100644 --- a/examples/example_usage_linux_sen62.py +++ b/examples/example_usage_linux_sen62.py @@ -1,13 +1,13 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# (c) Copyright 2025 Sensirion AG, Switzerland +# (c) Copyright 2026 Sensirion AG, Switzerland # # THIS FILE IS AUTOMATICALLY GENERATED! # -# Generator: sensirion-driver-generator 1.3.4 +# Generator: sensirion-driver-generator 1.5.3 # Product: sen62 -# Model-Version: 1.0.0 +# Model-Version: 1.0.1 # import argparse diff --git a/examples/example_usage_sensorbridge_sen62.py b/examples/example_usage_sensorbridge_sen62.py index 26266a0..34259c7 100644 --- a/examples/example_usage_sensorbridge_sen62.py +++ b/examples/example_usage_sensorbridge_sen62.py @@ -1,13 +1,13 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# (c) Copyright 2025 Sensirion AG, Switzerland +# (c) Copyright 2026 Sensirion AG, Switzerland # # THIS FILE IS AUTOMATICALLY GENERATED! # -# Generator: sensirion-driver-generator 1.3.4 +# Generator: sensirion-driver-generator 1.5.3 # Product: sen62 -# Model-Version: 1.0.0 +# Model-Version: 1.0.1 # import argparse diff --git a/metadata.yml b/metadata.yml index 7da87bb..c7f15b5 100644 --- a/metadata.yml +++ b/metadata.yml @@ -1,7 +1,7 @@ # driver generation metadata -generator_version: 1.3.4 -model_version: 1.0.0 +generator_version: 1.5.3 +model_version: 1.0.1 dg_status: released is_manually_modified: false first_generated: '2025-11-03 14:47' -last_generated: '2025-11-03 14:47' +last_generated: '2026-03-26 10:47' diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..1cb668c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,66 @@ +[build-system] +requires = ["hatchling >= 1.26", "wheel >= 0.45.0"] +build-backend = "hatchling.build" + +[project] +name = "sensirion_i2c_sen62" +description = "I2C driver for the Sensirion SEN62 sensor family" + +readme = "README.md" +version = "0.1.0" +requires-python = ">=3.8,<4.0" + +authors = [ + { name = "Sensirion", email = "info@sensirion.com" }, +] + +license = "BSD-3-Clause" +license-files = ["LICENSE"] + +keywords = [ + "Sensirion SEN62", + "I2C", + "SEN62", + ] + +classifiers = [ + "Intended Audience :: Developers", + "Topic :: System :: Hardware :: Hardware Drivers", + "Topic :: Software Development :: Libraries :: Python Modules", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", +] + +dependencies = [ + "sensirion-driver-adapters>=2.3.0,<3.0", + "sensirion-driver-support-types>=1.2.0,<2.0", + "sensirion-i2c-driver>=1.0,<2.0", + "sensirion-shdlc-sensorbridge>=0.1.0,<2.0" + ] + +[project.optional-dependencies] + +docs=[ + "jinja2~=3.1.6", + "sphinx-rtd-theme==3.0.2", + "sphinx==8.2.3", + "lazy-object-proxy ~=1.7.1", + "sphinx-autoapi~=3.0.0", +] + +test= [ + "flake8>=7.1.0", + "mock~=5.2.0", + "pytest>=8.3.5", + "pytest-cov>=5.0.0", + "mypy~=1.13.0", + "setuptools>=73.2.0" +] + +[project.urls] +Changelog = "https://github.com/Sensirion/python-i2c-sen62/blob/master/CHANGELOG.md" +Repository = "https://github.com/Sensirion/python-i2c-sen62" +Documentation = "https://sensirion.github.io/python-i2c-sen62" + diff --git a/sensirion_i2c_sen62/commands.py b/sensirion_i2c_sen62/commands.py index 36f6a69..47efa64 100644 --- a/sensirion_i2c_sen62/commands.py +++ b/sensirion_i2c_sen62/commands.py @@ -1,13 +1,13 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# (c) Copyright 2025 Sensirion AG, Switzerland +# (c) Copyright 2026 Sensirion AG, Switzerland # # THIS FILE IS AUTOMATICALLY GENERATED! # -# Generator: sensirion-driver-generator 1.3.4 +# Generator: sensirion-driver-generator 1.5.3 # Product: sen62 -# Model-Version: 1.0.0 +# Model-Version: 1.0.1 # """ The transfer classes specify the data that is transferred between host and sensor. The generated transfer classes @@ -25,12 +25,9 @@ class DeviceStatus(BitfieldContainer): reserved2 = BitField(offset=5, width=1) rht_error = BitField(offset=6, width=1) gas_error = BitField(offset=7, width=1) - reserved3 = BitField(offset=8, width=1) - reserved4 = BitField(offset=9, width=1) - reserved5 = BitField(offset=10, width=1) + reserved3 = BitField(offset=8, width=3) pm_error = BitField(offset=11, width=1) - reserved6 = BitField(offset=12, width=1) - reserved7 = BitField(offset=13, width=8) + reserved6 = BitField(offset=12, width=9) fan_speed_warning = BitField(offset=21, width=1) diff --git a/sensirion_i2c_sen62/device.py b/sensirion_i2c_sen62/device.py index bc08030..c9a2a9d 100644 --- a/sensirion_i2c_sen62/device.py +++ b/sensirion_i2c_sen62/device.py @@ -1,13 +1,13 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# (c) Copyright 2025 Sensirion AG, Switzerland +# (c) Copyright 2026 Sensirion AG, Switzerland # # THIS FILE IS AUTOMATICALLY GENERATED! # -# Generator: sensirion-driver-generator 1.3.4 +# Generator: sensirion-driver-generator 1.5.3 # Product: sen62 -# Model-Version: 1.0.0 +# Model-Version: 1.0.1 # """ The class Sen62DeviceBase implements the low level interface of the sensor. diff --git a/sensirion_i2c_sen62/result_types.py b/sensirion_i2c_sen62/result_types.py index f9212ce..5f0f035 100644 --- a/sensirion_i2c_sen62/result_types.py +++ b/sensirion_i2c_sen62/result_types.py @@ -1,13 +1,13 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# (c) Copyright 2025 Sensirion AG, Switzerland +# (c) Copyright 2026 Sensirion AG, Switzerland # # THIS FILE IS AUTOMATICALLY GENERATED! # -# Generator: sensirion-driver-generator 1.3.4 +# Generator: sensirion-driver-generator 1.5.3 # Product: sen62 -# Model-Version: 1.0.0 +# Model-Version: 1.0.1 # """ The signal classes specify transformations of the raw sensor signals into a meaningful units. diff --git a/sensirion_i2c_sen62/version.py b/sensirion_i2c_sen62/version.py index 338edf5..7cc55e2 100644 --- a/sensirion_i2c_sen62/version.py +++ b/sensirion_i2c_sen62/version.py @@ -1,5 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function +import importlib.metadata as metadata +from typing import Final -version = "0.1.0" +version: Final[str] = metadata.version("sensirion_i2c_sen62") diff --git a/setup.py b/setup.py index d5276e6..bfae448 100644 --- a/setup.py +++ b/setup.py @@ -1,70 +1,5 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +from setuptools import setup -import os -import re - -from setuptools import setup, find_packages - -# Python versions this package is compatible with -python_requires = '>=3.6, <4' - -# Packages that this package imports. List everything apart from standard lib packages. -install_requires = [ - 'sensirion-i2c-driver>=1.0.0,<2.0', - 'sensirion-driver-adapters>=2.3.0,<3.0', - 'sensirion-driver-support-types>=1.2.0,<2.0', - 'sensirion-shdlc-sensorbridge>=0.1.0,<0.3.0' -] - -# Packages required for tests and docs -extras_require = { - 'test': [ - 'flake8~=3.7.8', - 'pytest~=6.2.5', - 'pytest-cov~=3.0.0', - ] -} - -# Read version number from version.py -version_line = open("sensirion_i2c_sen62/version.py", "rt").read() -result = re.search(r"^version = ['\"]([^'\"]*)['\"]", version_line, re.M) -if result: - version_string = result.group(1) -else: - raise RuntimeError("Unable to find version string") - -# Use README.rst and CHANGELOG.md as package description -root_path = os.path.dirname(__file__) -long_description = open(os.path.join(root_path, 'README.md')).read() - -setup( - name='sensirion_i2c_sen62', - version=version_string, - author='Sensirion', - author_email='info@sensirion.com', - description='I2C driver for the Sensirion SEN62 sensor family', - license='BSD', - keywords="""Sensirion SEN62 - I2C - SEN62""", - project_urls={ - "Documentation": "https://sensirion.github.io/python-i2c-sen62", - "Repository": "https://github.com/Sensirion/python-i2c-sen62", - "Changelog": "https://github.com/Sensirion/python-i2c-sen62/blob/master/CHANGELOG.md", - }, - packages=find_packages(exclude=['tests', 'tests.*']), - long_description=long_description, - long_description_content_type='text/markdown', - python_requires=python_requires, - install_requires=install_requires, - extras_require=extras_require, - classifiers=[ - 'Intended Audience :: Developers', - 'License :: OSI Approved :: BSD License', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.11', - 'Topic :: Software Development :: Libraries :: Python Modules' - ] -) +setup() \ No newline at end of file diff --git a/tests/test_sen62.py b/tests/test_sen62.py index 61aec1f..c39a8b5 100644 --- a/tests/test_sen62.py +++ b/tests/test_sen62.py @@ -1,13 +1,13 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# (c) Copyright 2025 Sensirion AG, Switzerland +# (c) Copyright 2026 Sensirion AG, Switzerland # # THIS FILE IS AUTOMATICALLY GENERATED! # -# Generator: sensirion-driver-generator 1.3.4 +# Generator: sensirion-driver-generator 1.5.3 # Product: sen62 -# Model-Version: 1.0.0 +# Model-Version: 1.0.1 # import pytest