Skip to content

Commit 5e7bd9a

Browse files
committed
Add pre-commit hook and vm_image_builder job
1 parent ff37d7f commit 5e7bd9a

File tree

24 files changed

+894
-601
lines changed

24 files changed

+894
-601
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ extend-ignore = W503,E203,E501,W505
1313
max-line-length = 88
1414
max-doc-length = 120
1515

16-
per-file-ignores = __init__.py:F401,E402
16+
per-file-ignores = __init__.py:F401,E402

.github/workflows/build.yml

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,40 @@ name: knx-stack
22

33
on:
44
push:
5-
branches: [ kickoff ]
5+
branches: [kickoff]
66
pull_request:
7-
branches: [ kickoff ]
7+
branches: [kickoff]
88

99
jobs:
1010
build:
11-
1211
runs-on: ubuntu-latest
1312

1413
steps:
15-
- uses: actions/checkout@v2
16-
- name: Set up Python 3.8
17-
uses: actions/setup-python@v2
18-
with:
19-
python-version: 3.8
20-
- name: Install dependencies
21-
run: |
22-
python -m pip install --upgrade pip
23-
pip install flake8 pytest coverage
24-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
25-
python setup.py install
26-
# - name: Lint with flake8
27-
# run: |
28-
# stop the build if there are Python syntax errors or undefined names
29-
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
30-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
31-
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
32-
- name: Test and Coverage
33-
run: |
34-
python -m coverage run
35-
python -m coverage report
36-
- name: Build egg
37-
run: |
38-
python setup.py bdist_egg
39-
- name: Upload a Build Artifact
40-
uses: actions/upload-artifact@v2.1.4
41-
with:
42-
path: dist/*
14+
- uses: actions/checkout@v2
15+
- name: Set up Python 3.8
16+
uses: actions/setup-python@v2
17+
with:
18+
python-version: 3.8
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install flake8 pytest coverage
23+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
24+
python setup.py install
25+
# - name: Lint with flake8
26+
# run: |
27+
# stop the build if there are Python syntax errors or undefined names
28+
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
29+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
30+
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
31+
- name: Test and Coverage
32+
run: |
33+
python -m coverage run
34+
python -m coverage report
35+
- name: Build egg
36+
run: |
37+
python setup.py bdist_egg
38+
- name: Upload a Build Artifact
39+
uses: actions/upload-artifact@v2.1.4
40+
with:
41+
path: dist/*

.packit.yaml

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
# See the documentation for more information:
22
# https://packit.dev/docs/configuration/
3-
packit_instances: ["stg", ]
3+
packit_instances: ["stg"]
44

55
specfile_path: python-knx-stack.spec
66

77
# add or remove files that should be synced
88
synced_files:
9-
- python-knx-stack.spec
10-
- .packit.yaml
9+
- python-knx-stack.spec
10+
- .packit.yaml
11+
12+
#release_suffix: ""
1113

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

2022
jobs:
21-
- job: copr_build
22-
trigger: pull_request
23-
metadata:
23+
- job: copr_build
24+
trigger: pull_request
2425
targets: fedora-stable
2526
owner: mmassari
2627
project: knx-stack
27-
- job: copr_build
28-
trigger: commit
29-
metadata:
28+
- job: copr_build
29+
trigger: commit
3030
targets: fedora-stable
3131
owner: mmassari
3232
project: knx-stack
33+
- job: vm_image_build
34+
trigger: pull_request
35+
copr_chroot: fedora-36-x86_64
36+
owner: mmassari
37+
project: knx-stack
38+
image_customizations:
39+
packages: [python-knx-stack]
40+
image_distribution: fedora-36
41+
image_request:
42+
architecture: x86_64
43+
image_type: aws
44+
upload_request:
45+
type: aws
46+
options:
47+
share_with_accounts: ["727920394381"]

.pre-commit-config.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# HOWTO: https://pre-commit.com/#usage
2+
# pip3 install pre-commit
3+
# pre-commit install -t pre-commit -t pre-push
4+
5+
repos:
6+
- repo: https://github.com/asottile/pyupgrade
7+
rev: v3.1.0
8+
hooks:
9+
- id: pyupgrade
10+
- repo: https://github.com/psf/black
11+
rev: 22.10.0
12+
hooks:
13+
- id: black
14+
- repo: https://github.com/pre-commit/mirrors-prettier
15+
rev: v3.0.0-alpha.3
16+
hooks:
17+
- id: prettier
18+
- repo: https://github.com/pre-commit/pre-commit-hooks
19+
rev: v4.3.0
20+
hooks:
21+
- id: check-added-large-files
22+
- id: check-ast
23+
#- id: check-builtin-literals
24+
- id: check-docstring-first
25+
- id: check-executables-have-shebangs
26+
- id: check-merge-conflict
27+
- id: check-symlinks
28+
- id: check-yaml
29+
- id: detect-private-key
30+
- id: end-of-file-fixer
31+
- id: mixed-line-ending
32+
- id: trailing-whitespace
33+
- repo: https://github.com/PyCQA/flake8
34+
rev: 5.0.4
35+
hooks:
36+
- id: flake8
37+
args:
38+
- --ignore=F821,BLK100
39+
# line break before binary operator - introduced by black (W503)
40+
# E203 whitespace before ':' - introduced by black (E203)
41+
# doctests are not well formatted, lines are too long and are not fixed by black, ignore them (W501)
42+
# W505 doc line too long - doctests results are too long end exceed doc line length, ignore them (W505)
43+
- --extend-ignore=W503,E203,E501,W505
44+
# black setting is 88
45+
- --max-line-length=88
46+
- --max-doc-length=120
47+
- --per-file-ignores=__init__.py:F401,E402
48+
# - repo: https://github.com/PyCQA/isort
49+
# rev: 5.10.1
50+
# hooks:
51+
# - id: isort
52+
# args: [--profile, black]
53+
#- repo: https://github.com/pre-commit/mirrors-mypy
54+
# rev: v0.982
55+
# hooks:
56+
# - id: mypy
57+
# args: [--show-error-codes, --ignore-missing-imports]
58+
# additional_dependencies:
59+
# [types-pkg_resources, types-requests, types-python-dateutil]

CHANGELOG.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ Change Log
22
----------
33

44
Version 0.9.2 Sun Feb 6 2022
5-
- first public release
5+
- first public release

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66

77
A Python 3 KNX stack, not complete but easily extensible.
88

9-
It is able to *encode/decode* knx messages for both **USB HID** and **KNXnet IP**.
9+
It is able to _encode/decode_ knx messages for both **USB HID** and **KNXnet IP**.
1010

1111
It can be used with an **asynchronous** or **synchronous** client.
1212

1313
## Examples
1414

15-
### Setup
15+
### Setup
16+
1617
```python
1718
>>> import knx_stack
1819
>>> individual_address = knx_stack.Address(0x0001)
@@ -137,7 +138,6 @@ It can be used with an **asynchronous** or **synchronous** client.
137138
('DPT_Switch', {'action': 'off'})
138139
```
139140

140-
141141
## Installation
142142

143143
```
@@ -155,4 +155,3 @@ Pull requests are welcome.
155155
## License
156156

157157
knx-stack is licensed under the MIT license.
158-

daemon/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ SOURCE=usbhid.c
33

44
all: $(TARGET)
55

6-
clean:
6+
clean:
77
rm -f knxstack-usbhid-daemon
88

99
$(TARGET) : $(SOURCE)

docs/source/addresses.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,3 @@ ThreeLevelStyle
2020
---------------
2121

2222
.. autoclass:: knx_stack.address.ThreeLevelStyle
23-

docs/source/conf.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,19 @@
1212

1313
import os
1414
import sys
15-
sys.path.insert(0, os.path.abspath('../../'))
16-
print(os.path.abspath('../../'))
15+
16+
sys.path.insert(0, os.path.abspath("../../"))
17+
print(os.path.abspath("../../"))
1718

1819

1920
# -- Project information -----------------------------------------------------
2021

21-
project = 'knx-stack'
22-
copyright = '2021, Maja Massarini'
23-
author = 'Maja Massarini'
22+
project = "knx-stack"
23+
copyright = "2021, Maja Massarini"
24+
author = "Maja Massarini"
2425

2526
# The full version, including alpha/beta/rc tags
26-
release = '0.9'
27+
release = "0.9"
2728

2829

2930
# -- General configuration ---------------------------------------------------
@@ -32,18 +33,18 @@
3233
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3334
# ones.
3435
extensions = [
35-
'sphinx.ext.doctest',
36-
'sphinx.ext.autodoc',
36+
"sphinx.ext.doctest",
37+
"sphinx.ext.autodoc",
3738
]
3839
autodoc_inherit_docstrings = True
3940
autodoc_default_options = {
40-
'member-order': 'bysource',
41-
'members': True,
42-
'undoc-members': True,
41+
"member-order": "bysource",
42+
"members": True,
43+
"undoc-members": True,
4344
}
4445

4546
# Add any paths that contain templates here, relative to this directory.
46-
templates_path = ['_templates']
47+
templates_path = ["_templates"]
4748

4849
# List of patterns, relative to source directory, that match files and
4950
# directories to ignore when looking for source files.
@@ -56,10 +57,10 @@
5657
# The theme to use for HTML and HTML Help pages. See the documentation for
5758
# a list of builtin themes.
5859
#
59-
html_theme = 'sphinx_rtd_theme'
60+
html_theme = "sphinx_rtd_theme"
6061
# html_theme = 'nature'
6162

6263
# Add any paths that contain custom static files (such as style sheets) here,
6364
# relative to this directory. They are copied after the builtin static files,
6465
# so a file named "default.css" will overwrite the builtin "default.css".
65-
html_static_path = ['_static']
66+
html_static_path = ["_static"]

docs/source/datapointtypes.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,3 @@ Description Factory
6262
^^^^^^^^^^^^^^^^^^^^^^
6363

6464
.. autoclass:: knx_stack.datapointtypes.DPT_Value_Power
65-

0 commit comments

Comments
 (0)