From 8e0c75374e1bcf8626f455f04022352cbf781c50 Mon Sep 17 00:00:00 2001 From: Rolf Laich Date: Tue, 25 Nov 2025 15:34:11 +0100 Subject: [PATCH 1/6] Delete unneeded files --- .gitlab-ci.yml | 73 -------------------------------------------------- MANIFEST.in | 1 - 2 files changed, 74 deletions(-) delete mode 100644 .gitlab-ci.yml delete mode 100644 MANIFEST.in diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 4ac7511..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,73 +0,0 @@ -include: https://gitlab/Sensirion/Python/ci-config-python/raw/master/gitlab-ci-template-v3.yml - -check_rst_syntax: - extends: .check_rst_syntax_v3 - image: registry.gitlab.sensirion.lokal/sensirion/docker/docker-python:3.11-22.04-2.13.0 - -check_flake8: - extends: .check_flake8_v3 - image: registry.gitlab.sensirion.lokal/sensirion/docker/docker-python:3.11-22.04-2.13.0 - -check_editorconfig: - extends: .check_editorconfig_v3 - image: registry.gitlab.sensirion.lokal/sensirion/docker/docker-python:3.11-22.04-2.13.0 - -py3p8_linux_build_v3: - extends: .py3p8_linux_build_v3 - before_script: - - pip install --upgrade setuptools[core] - -py3p8_linux_test: - extends: .py3p8_linux_test_v3 - script: - - pip install -e .[test] - - pytest -m 'not needs_hardware' --cov-report term --cov-report xml:tests/coverage.xml --junitxml=tests/report.xml - -py3p11_linux_test: - extends: .py3p11_linux_test_v3 - script: - - pip install -e .[test] - - pytest -m 'not needs_hardware' --cov-report term --cov-report xml:tests/coverage.xml --junitxml=tests/report.xml - -py3p8_windows_build_v3: - extends: .py3p8_windows_build_v3 - before_script: - - pip install --upgrade setuptools[core] - -py3p8_64bit_win_test: - extends: .py3p8_windows_test_v3 - script: - - pip install -e .[test] - - pytest -m 'not needs_hardware' --cov-report term --cov-report xml:tests/coverage.xml --junitxml=tests/report.xml - -py3p11_64bit_win_test: - extends: .py3p11_windows_test_v3 - script: - - pip install -e .[test] - - pytest -m 'not needs_hardware' --cov-report term --cov-report xml:tests/coverage.xml --junitxml=tests/report.xml - -build_docs: - extends: .build_docs_v3 - -deploy_staging: - extends: .deploy_staging_v3 - -deploy_stable: - extends: .deploy_stable_v3 - environment: - name: pypi.org - url: https://pypi.org/project/sensirion-i2c-adapters/ - before_script: - - pip install twine~=5.1.1 - script: - - PKG_VERSION=$(python setup.py --version --quiet | tail -n1) - - TAG_VERSION=$(git describe --tags) - - if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then echo "Tag Version ($TAG_VERSION) != Package Version ($PKG_VERSION)" && exit 1; fi - - twine upload dist/* - -# Deploy all files within the "public" directory of the artifacts from the jobs -# specified as dependencies. Job must be named pages, otherwise gitlab does -# not deploy to gitlab pages. -pages: - extends: .deploy_pages_v3 - dependencies: [build_docs] diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 18e0683..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include CHANGELOG.rst From 2279f15516be040c553909b0eab4be33dd499c56 Mon Sep 17 00:00:00 2001 From: Rolf Laich Date: Tue, 25 Nov 2025 15:36:48 +0100 Subject: [PATCH 2/6] Add github CI --- .github/workflows/build-and-publish.yml | 12 ++++++++++++ .github/workflows/build-docs.yml | 14 ++++++++++++++ .github/workflows/test.yml | 14 ++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 .github/workflows/build-and-publish.yml create mode 100644 .github/workflows/build-docs.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml new file mode 100644 index 0000000..266ea9d --- /dev/null +++ b/.github/workflows/build-and-publish.yml @@ -0,0 +1,12 @@ +on: + push: + branches: + - master + tags: + - "[0-9]+.[0-9]+.[0-9]+" + +jobs: + build_and_deploy: + uses: sensirion/.github/.github/workflows/python_package.pypi_publish.yml@main + secrets: inherit + diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml new file mode 100644 index 0000000..26a2c8b --- /dev/null +++ b/.github/workflows/build-docs.yml @@ -0,0 +1,14 @@ +name: Publish Documentation +on: + push: + branches: + - master + tags: + - "^[0-9]+.[0-9]+.[0-9]+" + +jobs: + documentation: + uses: sensirion/.github/.github/workflows/driver.python.documentation.yml@main + with: + run-environment: "ubuntu-20.04" + build-python-version: 3.6 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..86b6d56 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,14 @@ +name: Validate and Test Python Package +on: + pull_request: + branches: + - master + push: + branches: + - master + +jobs: + test: + uses: sensirion/.github/.github/workflows/driver.python.test.yml@main + with: + hw-test-flag: "needs_hardware" From 797ff14af0d17f493d29ca01a3a30fe076b4b278 Mon Sep 17 00:00:00 2001 From: Rolf Laich Date: Tue, 25 Nov 2025 15:37:16 +0100 Subject: [PATCH 3/6] Fix package name in documentation --- docs/index.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index ea4e645..98fae8f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,7 +1,7 @@ -Welcome to sensirion-i2c-adapter's documentation! +Welcome to sensirion-driver-adapters documentation! ==================================================== -This is the documentation for sensirion-i2c-adapter. +This is the documentation for the package sensirion-driver-adapters. Contents -------- From 81e79719d4b484f0bf6cab1a833c921ad9c9d1f0 Mon Sep 17 00:00:00 2001 From: Rolf Laich Date: Tue, 25 Nov 2025 15:37:34 +0100 Subject: [PATCH 4/6] Fix links --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f79378f..fcc71da 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ sensirion-driver-adapters. ## Usage -See package description in [README.rst](README.rst) and user manual at +See package description in [README.rst](https://github.com/Sensirion/python-driver-adapters/blob/master/README.rst) and user manual at https://sensirion.github.io/python-driver-adapters/. ## Development @@ -54,4 +54,4 @@ sphinx-versioning build docs docs/_build/html # Build documentation ## License -See [LICENSE](LICENSE). +See [LICENSE](https://github.com/Sensirion/python-driver-adapters/blob/master/LICENSE). From e378fdff2ea9e093159d53788ed029aa4a4f480f Mon Sep 17 00:00:00 2001 From: Rolf Laich Date: Tue, 25 Nov 2025 15:38:04 +0100 Subject: [PATCH 5/6] Update project structure --- pyproject.toml | 63 +++++++++++++++++++ sensirion_driver_adapters/version.py | 5 +- setup.py | 93 ++-------------------------- 3 files changed, 71 insertions(+), 90 deletions(-) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..227576b --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,63 @@ +[build-system] +requires = ["hatchling >= 1.26", "wheel >= 0.45.0"] +build-backend = "hatchling.build" + +[project] +name = "sensirion-driver-adapters" +description = "Adapter classes to use sensirion_i2c_driver package" +version = "2.4.0" + +readme = "README.md" + +requires-python = ">=3.8,<4.0" + +authors = [ + { name = "Sensirion", email = "info@sensirion.com" }, +] + +license = "BSD-3-Clause" +license-files = ["LICENSE"] + +keywords = ["sensirion", "driver", "driver-generator"] + +classifiers = [ + 'Intended Audience :: Developers', + 'License :: Other/Proprietary License', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.11', + 'Topic :: Software Development :: Libraries :: Python Modules' + ] + +dependencies = [ + "sensirion-i2c-driver~=1.0.2", + "sensirion-shdlc-driver~=1.0.1", + "sensirion-shdlc-sensorbridge~=1.0.0" +] + +[project.optional-dependencies] + +docs = [ + + "sphinx-rtd-theme==3.0.2", + "sphinx==8.2.3", + "lazy-object-proxy ~=1.7.1", + "docutils~=0.18.0", + "sphinx_rtd_theme~=1.3.0", + "sphinx-autoapi~=3.0.0" +] + +test = [ + "flake8>=7.1.0", + "mock~=5.2.0", + "pytest>=8.3.5", + "pytest-cov>=5.0.0", + "setuptools>=73.2.0" +] + +[project.urls] +Changelog = "https://github.com/Sensirion/python-driver-adapters/blob/master/CHANGELOG.rst" +Repository = "https://github.com/Sensirion/python-driver-adapters" +Documentation = "https://sensirion.github.io/python-driver-adapters" + diff --git a/sensirion_driver_adapters/version.py b/sensirion_driver_adapters/version.py index 5f48922..4efd473 100644 --- a/sensirion_driver_adapters/version.py +++ b/sensirion_driver_adapters/version.py @@ -3,4 +3,7 @@ from __future__ import absolute_import, division, print_function -version = "2.3.1" +import importlib.metadata as metadata +from typing import Final + +version: Final[str] = metadata.version("sensirion_driver_adapters") diff --git a/setup.py b/setup.py index b345f2c..f39d9a7 100644 --- a/setup.py +++ b/setup.py @@ -1,93 +1,8 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- +# (c) Copyright 2019 Sensirion AG, Switzerland -import os -import re +from __future__ import absolute_import, division, print_function -from setuptools import setup, find_packages +from setuptools import setup -################################ -# Required developer input start -################################ - -# 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', - 'sensirion-shdlc-driver', - 'sensirion-shdlc-sensorbridge' -] - -# Packages required for tests and docs -extras_require = { - 'test': [ - 'flake8~=6.0.0', - 'pytest~=8.1.1', - 'pytest-cov~=5.0.0', - ], - 'docs': [ - 'lazy-object-proxy ~=1.7.1', - 'sphinx~=7.1.0', - 'docutils~=0.18.0', - 'sphinx_rtd_theme~=1.3.0', - 'sphinx-autoapi~=3.0.0' - ] -} - -package_name = "sensirion-driver-adapters" -author = 'Rolf Laich' -author_email = 'rolf.laich@sensirion.com' -description = 'Adapter classes to use sensirion_i2c_driver package' -keywords = 'driver driver-generator' - -################################ -# Required developer input end -################################ - -assert (package_name != "") -assert (author != "") -assert (author_email != '@sensirion.com') -assert (description != '') -assert (keywords != '') - -# Note: Remove this check only for old packages which do not (yet) have the -# "sensirion-" prefix for compatibility reasons. -assert (package_name.startswith("sensirion-")) - -# It is important to NOT import anything, not even the version, from the package which is being built. -# Otherwise weird behavior is guaranteed. -version_line = open(os.path.join(package_name.replace("-", "_"), "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") - -long_description = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read().strip() + "\n\n" + \ - open(os.path.join(os.path.dirname(__file__), 'CHANGELOG.rst')).read().strip() + "\n" -setup( - name=package_name, - version=version_string, - author=author, - author_email=author_email, - description=description, - license='BSD 3-Clause License', - keywords=keywords, - url='http://developers.sensirion.com', - packages=find_packages(exclude=['tests', 'tests.*']), - long_description=long_description, - python_requires=python_requires, - install_requires=install_requires, - extras_require=extras_require, - classifiers=[ - 'Intended Audience :: Developers', - 'License :: Other/Proprietary License', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.11', - 'Topic :: Software Development :: Libraries :: Python Modules' - ] -) +setup() From fbd7be153f3ecd682c56aed82e0055f97ff4f4ce Mon Sep 17 00:00:00 2001 From: Rolf Laich Date: Tue, 25 Nov 2025 15:41:28 +0100 Subject: [PATCH 6/6] Update changelog --- CHANGELOG.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c9cf5a0..68c5210 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,10 @@ CHANGELOG Unreleased :::::::::: +2.4.0 +::::: +- Update project structure + 2.3.1 ::::: - Support ignore-errors for SHDLC commands; The interface remains the same.