Skip to content

Commit

Permalink
Add pre-commit hook and vm_image_builder job
Browse files Browse the repository at this point in the history
  • Loading branch information
majamassarini committed Apr 18, 2023
1 parent ff37d7f commit 5e7bd9a
Show file tree
Hide file tree
Showing 24 changed files with 894 additions and 601 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -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
per-file-ignores = __init__.py:F401,E402
61 changes: 30 additions & 31 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
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/[email protected]
with:
path: dist/*
33 changes: 24 additions & 9 deletions .packit.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# See the documentation for more information:
# https://packit.dev/docs/configuration/
packit_instances: ["stg", ]
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
- python-knx-stack.spec
- .packit.yaml

#release_suffix: ""

# name in upstream package repository or registry (e.g. in PyPI)
upstream_package_name: knx-stack
Expand All @@ -18,15 +20,28 @@ upstream_project_url: https://github.com/majamassarini/knx-stack
issue_repository: https://github.com/majamassarini/knx-stack

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:
- job: copr_build
trigger: commit
targets: fedora-stable
owner: mmassari
project: knx-stack
- job: vm_image_build
trigger: pull_request
copr_chroot: fedora-36-x86_64
owner: mmassari
project: knx-stack
image_customizations:
packages: [python-knx-stack]
image_distribution: fedora-36
image_request:
architecture: x86_64
image_type: aws
upload_request:
type: aws
options:
share_with_accounts: ["727920394381"]
59 changes: 59 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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]
2 changes: 1 addition & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ Change Log
----------

Version 0.9.2 Sun Feb 6 2022
- first public release
- first public release
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -137,7 +138,6 @@ It can be used with an **asynchronous** or **synchronous** client.
('DPT_Switch', {'action': 'off'})
```


## Installation

```
Expand All @@ -155,4 +155,3 @@ Pull requests are welcome.
## License

knx-stack is licensed under the MIT license.

2 changes: 1 addition & 1 deletion daemon/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SOURCE=usbhid.c

all: $(TARGET)

clean:
clean:
rm -f knxstack-usbhid-daemon

$(TARGET) : $(SOURCE)
Expand Down
1 change: 0 additions & 1 deletion docs/source/addresses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ ThreeLevelStyle
---------------

.. autoclass:: knx_stack.address.ThreeLevelStyle

29 changes: 15 additions & 14 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ---------------------------------------------------
Expand All @@ -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.
Expand All @@ -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']
html_static_path = ["_static"]
1 change: 0 additions & 1 deletion docs/source/datapointtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,3 @@ Description Factory
^^^^^^^^^^^^^^^^^^^^^^

.. autoclass:: knx_stack.datapointtypes.DPT_Value_Power

Loading

0 comments on commit 5e7bd9a

Please sign in to comment.