diff --git a/.flake8 b/.flake8 index 3c92c12..f6c9cdd 100644 --- a/.flake8 +++ b/.flake8 @@ -13,4 +13,4 @@ extend-ignore = W503,E203,E501,W505 max-line-length = 88 max-doc-length = 120 -per-file-ignores = __init__.py:F401,E402 \ No newline at end of file +per-file-ignores = __init__.py:F401,E402 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6ef65ce..ed05b36 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,41 +2,40 @@ name: knx-stack on: push: - branches: [ kickoff ] + branches: [kickoff] pull_request: - branches: [ kickoff ] + branches: [kickoff] jobs: build: - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.8 - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install flake8 pytest coverage - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - python setup.py install - # - name: Lint with flake8 - # run: | - # stop the build if there are Python syntax errors or undefined names - # flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - # flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test and Coverage - run: | - python -m coverage run - python -m coverage report - - name: Build egg - run: | - python setup.py bdist_egg - - name: Upload a Build Artifact - uses: actions/upload-artifact@v2.1.4 - with: - path: dist/* + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest coverage + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + python setup.py install + # - name: Lint with flake8 + # run: | + # stop the build if there are Python syntax errors or undefined names + # flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + # flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test and Coverage + run: | + python -m coverage run + python -m coverage report + - name: Build egg + run: | + python setup.py bdist_egg + - name: Upload a Build Artifact + uses: actions/upload-artifact@v2.1.4 + with: + path: dist/* diff --git a/.packit.yaml b/.packit.yaml index 9c61825..4e7eb19 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -1,32 +1,26 @@ -# See the documentation for more information: -# https://packit.dev/docs/configuration/ -packit_instances: ["stg", ] - -specfile_path: python-knx-stack.spec - -# add or remove files that should be synced -synced_files: - - python-knx-stack.spec - - .packit.yaml - -# name in upstream package repository or registry (e.g. in PyPI) -upstream_package_name: knx-stack -# downstream (Fedora) RPM package name -downstream_package_name: knx-stack +packit_instances: ["stg"] upstream_project_url: https://github.com/majamassarini/knx-stack -issue_repository: https://github.com/majamassarini/knx-stack +specfile_path: python-knx-stack.spec jobs: -- job: copr_build - trigger: pull_request - metadata: + - job: copr_build + trigger: pull_request targets: fedora-stable owner: mmassari project: knx-stack -- job: copr_build - trigger: commit - metadata: - targets: fedora-stable + - job: vm_image_build + trigger: pull_request + copr_chroot: fedora-39-x86_64 owner: mmassari project: knx-stack + image_customizations: + packages: [python-knx-stack] + image_distribution: fedora-39 + image_request: + architecture: x86_64 + image_type: aws + upload_request: + type: aws + options: + share_with_accounts: ["727920394381"] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..d8ee747 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,59 @@ +# HOWTO: https://pre-commit.com/#usage +# pip3 install pre-commit +# pre-commit install -t pre-commit -t pre-push + +repos: + - repo: https://github.com/asottile/pyupgrade + rev: v3.1.0 + hooks: + - id: pyupgrade + - repo: https://github.com/psf/black + rev: 22.10.0 + hooks: + - id: black + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v3.0.0-alpha.3 + hooks: + - id: prettier + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.3.0 + hooks: + - id: check-added-large-files + - id: check-ast + #- id: check-builtin-literals + - id: check-docstring-first + - id: check-executables-have-shebangs + - id: check-merge-conflict + - id: check-symlinks + - id: check-yaml + - id: detect-private-key + - id: end-of-file-fixer + - id: mixed-line-ending + - id: trailing-whitespace + - repo: https://github.com/PyCQA/flake8 + rev: 5.0.4 + hooks: + - id: flake8 + args: + - --ignore=F821,BLK100 + # line break before binary operator - introduced by black (W503) + # E203 whitespace before ':' - introduced by black (E203) + # doctests are not well formatted, lines are too long and are not fixed by black, ignore them (W501) + # W505 doc line too long - doctests results are too long end exceed doc line length, ignore them (W505) + - --extend-ignore=W503,E203,E501,W505 + # black setting is 88 + - --max-line-length=88 + - --max-doc-length=120 + - --per-file-ignores=__init__.py:F401,E402 + # - repo: https://github.com/PyCQA/isort + # rev: 5.10.1 + # hooks: + # - id: isort + # args: [--profile, black] + #- repo: https://github.com/pre-commit/mirrors-mypy + # rev: v0.982 + # hooks: + # - id: mypy + # args: [--show-error-codes, --ignore-missing-imports] + # additional_dependencies: + # [types-pkg_resources, types-requests, types-python-dateutil] diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 7af843b..4409efd 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -2,4 +2,4 @@ Change Log ---------- Version 0.9.2 Sun Feb 6 2022 - - first public release \ No newline at end of file + - first public release diff --git a/README.md b/README.md index bcd31a0..2b349df 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,14 @@ A Python 3 KNX stack, not complete but easily extensible. -It is able to *encode/decode* knx messages for both **USB HID** and **KNXnet IP**. +It is able to _encode/decode_ knx messages for both **USB HID** and **KNXnet IP**. It can be used with an **asynchronous** or **synchronous** client. ## Examples -### Setup +### Setup + ```python >>> import knx_stack >>> individual_address = knx_stack.Address(0x0001) @@ -137,7 +138,6 @@ It can be used with an **asynchronous** or **synchronous** client. ('DPT_Switch', {'action': 'off'}) ``` - ## Installation ``` @@ -155,4 +155,3 @@ Pull requests are welcome. ## License knx-stack is licensed under the MIT license. - diff --git a/daemon/Makefile b/daemon/Makefile index bd963f3..db12375 100644 --- a/daemon/Makefile +++ b/daemon/Makefile @@ -3,7 +3,7 @@ SOURCE=usbhid.c all: $(TARGET) -clean: +clean: rm -f knxstack-usbhid-daemon $(TARGET) : $(SOURCE) diff --git a/docs/source/addresses.rst b/docs/source/addresses.rst index a3c3051..75167f4 100644 --- a/docs/source/addresses.rst +++ b/docs/source/addresses.rst @@ -20,4 +20,3 @@ ThreeLevelStyle --------------- .. autoclass:: knx_stack.address.ThreeLevelStyle - diff --git a/docs/source/conf.py b/docs/source/conf.py index 2c7591d..9f6f084 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -12,18 +12,19 @@ import os import sys -sys.path.insert(0, os.path.abspath('../../')) -print(os.path.abspath('../../')) + +sys.path.insert(0, os.path.abspath("../../")) +print(os.path.abspath("../../")) # -- Project information ----------------------------------------------------- -project = 'knx-stack' -copyright = '2021, Maja Massarini' -author = 'Maja Massarini' +project = "knx-stack" +copyright = "2021, Maja Massarini" +author = "Maja Massarini" # The full version, including alpha/beta/rc tags -release = '0.9' +release = "0.9" # -- General configuration --------------------------------------------------- @@ -32,18 +33,18 @@ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ - 'sphinx.ext.doctest', - 'sphinx.ext.autodoc', + "sphinx.ext.doctest", + "sphinx.ext.autodoc", ] autodoc_inherit_docstrings = True autodoc_default_options = { - 'member-order': 'bysource', - 'members': True, - 'undoc-members': True, + "member-order": "bysource", + "members": True, + "undoc-members": True, } # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. @@ -56,10 +57,10 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'sphinx_rtd_theme' +html_theme = "sphinx_rtd_theme" # html_theme = 'nature' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] \ No newline at end of file +html_static_path = ["_static"] diff --git a/docs/source/datapointtypes.rst b/docs/source/datapointtypes.rst index 15e84d6..584d13f 100644 --- a/docs/source/datapointtypes.rst +++ b/docs/source/datapointtypes.rst @@ -62,4 +62,3 @@ Description Factory ^^^^^^^^^^^^^^^^^^^^^^ .. autoclass:: knx_stack.datapointtypes.DPT_Value_Power - diff --git a/docs/source/index.html b/docs/source/index.html index f6e0063..6344622 100644 --- a/docs/source/index.html +++ b/docs/source/index.html @@ -1,13 +1,15 @@ -
- - -+ :ref:`genindex` +
+ ++ :ref:`modindex` +
+ ++ :ref:`search` +
+ +