diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index bfe532f..ec290fc 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -3,11 +3,11 @@ on: branches: - master tags: - - "^[0-9]+.[0-9]+.[0-9]+" + - "[0-9]+.[0-9]+.[0-9]+" jobs: build_and_deploy: - uses: sensirion/.github/.github/workflows/driver.python.pypi_publish.yml@main + uses: sensirion/.github/.github/workflows/python_package.pypi_publish.yml@main secrets: PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 98ac7ea..1f3745c 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,10 @@ CHANGELOG --------- +0.1.6 +::::: +- Update project structure + 0.1.5 ::::: - Move parts of ``ShdlcDevice`` into new base class ``ShdlcDeviceBase`` 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 diff --git a/README.md b/README.md index cec9b4d..dcf3bd6 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ This repository contains the base driver for Sensirion SHDLC devices as a Python package. For details, please read the package description in -[README.rst](README.rst). +[README.rst](https://github.com/Sensirion/python-shdlc-driver/blob/master/README.rst). ## Usage -See package description in [README.rst](README.rst) and user manual at +See package description in [README.rst](https://github.com/Sensirion/python-shdlc-driver/blob/master/README.rst) and user manual at https://sensirion.github.io/python-shdlc-driver/. ## Development @@ -70,4 +70,4 @@ sphinx-versioning build docs docs/_build/html # Build documentation ## License -See [LICENSE](LICENSE). +See [LICENSE](https://github.com/Sensirion/python-shdlc-driver/blob/master/LICENSE). diff --git a/conftest.py b/conftest.py index 0b1fb97..055e71f 100644 --- a/conftest.py +++ b/conftest.py @@ -9,13 +9,13 @@ def pytest_addoption(parser): """ Register command line options """ - parser.addoption("--serial-port", action="store", type="string") - parser.addoption("--serial-bitrate", action="store", type="int", + parser.addoption("--serial-port", action="store", type=str) + parser.addoption("--serial-bitrate", action="store", type=int, default=115200) - parser.addoption("--serial-address", action="store", type="int", default=0) - parser.addoption("--tcp-ip", action="store", type="string") - parser.addoption("--tcp-port", action="store", type="int") - parser.addoption("--tcp-address", action="store", type="int", default=0) + parser.addoption("--serial-address", action="store", type=int, default=0) + parser.addoption("--tcp-ip", action="store", type=str) + parser.addoption("--tcp-port", action="store", type=int) + parser.addoption("--tcp-address", action="store", type=int, default=0) def _get_serial_port(config, validate=False): diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..035beb3 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,54 @@ +[build-system] +requires = ["hatchling >= 1.26", "wheel >= 0.45.0"] +build-backend = "hatchling.build" + +[project] +name = "sensirion-shdlc-driver" +description = "Base Driver for Communicating With SHDLC Devices" + +readme = "README.md" +version = "1.0.1" +requires-python = ">=3.8,<4.0" + +authors = [ + { name = "Sensirion", email = "info@sensirion.com" }, +] + +license = "BSD-3-Clause" +license-files = ["LICENSE"] + +keywords = ["sensirion", "shldc", "driver"] + +classifiers = [ + "Intended Audience :: Developers", + "Topic :: System :: Hardware :: Hardware Drivers", + "Topic :: Software Development :: Build Tools", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", +] + +dependencies = ['pyserial~=3.0', 'intelhex>=2.3.0'] + +[project.optional-dependencies] + +docs = [ + + "sphinx-rtd-theme==3.0.2", + "sphinx==8.2.3" +] + +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-shdlc-driver/blob/master/CHANGELOG.rst" +Repository = "https://github.com/sensirion/python-shdlc-driver" +Documentation = "https://sensirion.github.io/python-shdlc-driver" + diff --git a/sensirion_shdlc_driver/version.py b/sensirion_shdlc_driver/version.py index 2bcd0f8..c71e102 100644 --- a/sensirion_shdlc_driver/version.py +++ b/sensirion_shdlc_driver/version.py @@ -2,4 +2,8 @@ # (c) Copyright 2019 Sensirion AG, Switzerland from __future__ import absolute_import, division, print_function -version = "0.1.6" + +import importlib.metadata as metadata +from typing import Final + +version: Final[str] = metadata.version("sensirion_shdlc_driver") diff --git a/setup.py b/setup.py index 56a36bd..f39d9a7 100644 --- a/setup.py +++ b/setup.py @@ -2,67 +2,7 @@ # (c) Copyright 2019 Sensirion AG, Switzerland from __future__ import absolute_import, division, print_function -from setuptools import setup, find_packages -import os -import re +from setuptools import setup -# Read version number from version.py -version_line = open("sensirion_shdlc_driver/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.rst as package description -root_path = os.path.dirname(__file__) -readme = open(os.path.join(root_path, 'README.rst')).read() -changelog = open(os.path.join(root_path, 'CHANGELOG.rst')).read() -long_description = readme.strip() + "\n\n" + changelog.strip() + "\n" - - -setup( - name='sensirion-shdlc-driver', - version=version_string, - author='Sensirion', - author_email='info@sensirion.com', - description='Base Driver for Communicating With Sensirion SHDLC Devices', - license='BSD', - keywords='shdlc sensirion sensor driver', - url='https://github.com/sensirion/python-shdlc-driver', - packages=find_packages(exclude=['tests', 'tests.*']), - long_description=long_description, - python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4', - install_requires=[ - 'pyserial~=3.0', - ], - extras_require={ - # Dependencies for the firmware update (optional since not all devices - # support firmware updates) - 'fwupdate': [ - 'intelhex~=2.0', - ], - # Dependencies for tests - 'test': [ - 'flake8~=3.7.8', - 'intelhex~=2.0', # from the "fwupdate" extra - 'mock~=3.0.0', - 'pytest~=6.2.5', - 'pytest-cov~=3.0.0', - ] - }, - classifiers=[ - 'Intended Audience :: Developers', - 'License :: OSI Approved :: BSD License', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Topic :: System :: Hardware :: Hardware Drivers' - ] -) +setup()