Skip to content
GitLab
Explore
Sign in
Commits on Source (5)
Use pytest and update coverage configs
· 15bd7781
Dom Sekotill
authored
Aug 13, 2024
15bd7781
Tidy CI config and use templates for some jobs
· 03db6314
Dom Sekotill
authored
Aug 13, 2024
03db6314
Switch from setuptools to flit
· ecc9370f
Dom Sekotill
authored
Aug 14, 2024
ecc9370f
Bump dependencies
· 6d927d33
Dom Sekotill
authored
Aug 14, 2024
6d927d33
Make some quality checking improvements
· fca7e7f2
Dom Sekotill
authored
Aug 14, 2024
fca7e7f2
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
fca7e7f2
...
...
@@ -12,7 +12,5 @@ build/
dist/
# unit-testing, coverage, etc.
/*.xml
/*.json
.coverage*
.noseids
/*_cache/
/results/
.gitlab-ci.yml
View file @
fca7e7f2
stages
:
-
test
-
acceptance
-
build
-
publish
include
:
-
project
:
dom/project-templates
file
:
/pipeline-templates/pre-commit.yml
-
project
:
dom/project-templates
ref
:
tmp
file
:
/pipeline-templates/python-package.yml
image
:
python:3.8
variables
:
PIP_CACHE_DIR
:
$CI_PROJECT_DIR/.cache/pip
cache
:
key
:
all
paths
:
-
.cache/
-
.eggs/
.python
:
image
:
python:3.12
variables
:
PIP_CACHE_DIR
:
$CI_PROJECT_DIR/cache/pkg
PIP_NO_COMPILE
:
"
true"
PIP_NO_CLEAN
:
"
true"
cache
:
key
:
$CI_JOB_IMAGE
paths
:
[
cache
]
# Unit Tests
.unittest
:
stage
:
test
image
:
python:$PY_VERSION
before_script
:
-
pip install -e .[test] nose2
-
pip install -e .[test] coverage pytest
-
mkdir results
script
:
-
nose2 -v -c setup.cfg
-
coverage run -m pytest -v --junit-xml=results/junit.xml tests/unit
after_script
:
-
mv .coverage .coverage.$PY_VERSION
-
mv .unittest.xml .unittest.$PY_VERSION.xml
coverage
:
'
/^TOTAL.*
([0-9.]+\%)$/'
-
mv results results.$PY_VERSION
artifacts
:
when
:
always
paths
:
-
.noseids
-
.coverage.*
-
.unittest.$PY_VERSION.xml
-
results.$PY_VERSION
reports
:
junit
:
.unittest
.$PY_VERSION.xml
junit
:
results
.$PY_VERSION
/junit
.xml
u
nit
t
est
:3.8
:
extends
:
.unittest
U
nit
T
est
s (Py 3.10)
:
extends
:
[
.python
,
.unittest
]
variables
:
PY_VERSION
:
'
3.
8
'
PY_VERSION
:
'
3.
10
'
u
nit
t
est
:3.9
:
extends
:
.unittest
U
nit
T
est
s (Py 3.11)
:
extends
:
[
.python
,
.unittest
]
variables
:
PY_VERSION
:
'
3.
9
'
PY_VERSION
:
'
3.
11
'
u
nit
t
est
:
3.1
0
:
extends
:
.unittest
U
nit
T
est
s (Py
3.1
2)
:
extends
:
[
.python
,
.unittest
]
variables
:
PY_VERSION
:
'
3.10-rc'
PY_VERSION
:
'
3.12'
publish:unittests
:
stage
:
publish
Publish Unit Tests
:
stage
:
deploy
extends
:
[
.python
]
when
:
always
dependencies
:
&unittests
-
u
nit
t
est
:3.8
-
u
nit
t
est
:3.9
-
u
nit
t
est
:
3.1
0
-
U
nit
T
est
s (Py 3.10)
-
U
nit
T
est
s (Py 3.11)
-
U
nit
T
est
s (Py
3.1
2)
needs
:
*unittests
script
:
-
pip install --upgrade junit2html
-
mkdir -p unittest
-
python util/junit_merge.py
.unittest.*
.xml >
.
unit
test
.xml
-
junit2html
.
unit
test
.xml unittest/index.html
-
pip install --upgrade junit2html
-
mkdir -p unittest
-
python util/junit_merge.py
results.*/junit
.xml >
j
unit.xml
-
junit2html
j
unit.xml unittest/index.html
artifacts
:
when
:
always
paths
:
-
.unittest.xml
-
unittest
-
junit.xml
-
unittest
reports
:
junit
:
junit.xml
# Aggregate Coverage
coverage
:
stage
:
acceptance
Aggregate Coverage
:
stage
:
test
extends
:
[
.python
]
when
:
always
dependencies
:
*unittests
needs
:
*unittests
script
:
-
pip install --upgrade coverage
-
coverage combine
-
coverage report
-
pip install --upgrade coverage
-
coverage combine
results.*
-
coverage report
coverage
:
'
/^TOTAL.*
([0-9.]+\%)$/'
artifacts
:
when
:
always
paths
:
-
.coverage
-
results
publish:coverage
:
stage
:
publish
Publish Coverage
:
stage
:
deploy
extends
:
[
.python
]
when
:
always
dependencies
:
[
c
overage
]
needs
:
[
c
overage
]
dependencies
:
[
Aggregate C
overage
]
needs
:
[
Aggregate C
overage
]
script
:
-
pip install --upgrade coverage
-
coverage html --fail-under=0 -d coverage
-
coverage xml --fail-under=0 -o
coverage
/coverage.xml
-
coverage html --fail-under=0 -d
results/
coverage
.html
-
coverage xml --fail-under=0 -o
results
/coverage.xml
artifacts
:
when
:
always
paths
:
-
coverage
# Quality Assurance
Code Analysis
:
stage
:
test
variables
:
FROM_REF
:
$CI_DEFAULT_BRANCH
rules
:
-
if
:
$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
variables
:
FROM_REF
:
$CI_COMMIT_BEFORE_SHA
-
when
:
always
before_script
:
-
pip install pre-commit
script
:
-
git fetch $CI_REPOSITORY_URL $FROM_REF:FROM_REF -f
-
pre-commit run
--hook-stage=commit
--from-ref=FROM_REF
--to-ref=${CI_COMMIT_SHA}
Commit Graph Analysis
:
stage
:
test
variables
:
FROM_REF
:
$CI_DEFAULT_BRANCH
rules
:
-
if
:
$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
variables
:
FROM_REF
:
$CI_COMMIT_BEFORE_SHA
-
if
:
$CI_PIPELINE_TRIGGERED == "merge_request_event"
before_script
:
-
pip install pre-commit
script
:
-
pre-commit run
--hook-stage=push
--from-ref=FROM_REF
--to-ref=${CI_COMMIT_SHA}
# Package publishing
Check Tag
:
stage
:
test
rules
:
-
if
:
$CI_COMMIT_TAG =~ /^v[0-9]/
script
:
-
test `./setup.py --version` == ${CI_COMMIT_TAG#v}
Build Packages
:
stage
:
build
script
:
-
./setup.py bdist_wheel sdist
artifacts
:
paths
:
-
dist
Upload Packages
:
stage
:
publish
rules
:
-
if
:
$CI_COMMIT_TAG =~ /^v[0-9]/
dependencies
:
-
Build Packages
script
:
-
pip install twine
-
TWINE_PASSWORD=$CI_JOB_TOKEN
TWINE_USERNAME=gitlab-ci-token
twine upload
--verbose
--non-interactive
--repository-url $CI_API_V4_URL/projects/$CI_PROJECT_ID/packages/pypi
dist/*
-
results
.pre-commit-config.yaml
View file @
fca7e7f2
...
...
@@ -4,6 +4,7 @@ repos:
-
repo
:
meta
hooks
:
-
id
:
check-hooks-apply
-
id
:
check-useless-excludes
-
repo
:
https://github.com/pre-commit/pre-commit-hooks
rev
:
v4.6.0
...
...
@@ -17,15 +18,16 @@ repos:
-
id
:
debug-statements
-
id
:
destroyed-symlinks
-
id
:
end-of-file-fixer
stages
:
[
commit
]
stages
:
[
commit
,
manual
]
-
id
:
fix-byte-order-marker
-
id
:
fix-encoding-pragma
args
:
[
--remove
]
-
id
:
mixed-line-ending
args
:
[
--fix=lf
]
stages
:
[
commit
,
manual
]
-
id
:
trailing-whitespace
exclude_types
:
[
markdown
,
plain-text
]
stages
:
[
commit
]
stages
:
[
commit
,
manual
]
-
repo
:
https://github.com/jorisroovers/gitlint
rev
:
v0.19.1
...
...
@@ -39,7 +41,7 @@ repos:
-
id
:
check-for-squash
-
id
:
copyright-notice
args
:
[
--min-size=1
]
exclude
:
setup\.py
stages
:
[
commit
,
manual
]
-
id
:
protect-first-parent
-
repo
:
https://github.com/pre-commit/pygrep-hooks
...
...
pyproject.toml
View file @
fca7e7f2
[build-system]
requires
=
["setuptools>
=
40.8
.
0
", "
wheel
"]
build-backend
=
"setuptools.build_meta:__legacy__"
requires
=
[
"flit_core ~=3.8"
]
build-backend
=
"flit_core.buildapi"
[project]
name
=
"wpa-supplicant-client"
version
=
"0.3.0"
description
=
"A client package for connecting to, configuring and controlling wpa_supplicant daemons"
license
=
{
file
=
"LICENCE.txt"
}
authors
=
[
{name
=
"Dom Sekotill"
,
email
=
"dom.sekotill@kodo.org.uk"
}
,
]
classifiers
=
[
"Intended Audience :: Developers"
,
"Operating System :: POSIX"
,
]
requires-python
=
"~
=
3.10
"
dependencies
=
[
"anyio ~=4.1"
,
]
[project.optional-dependencies]
test
=
[
"trio"
,
]
[project.urls]
Repository
=
"https://code.kodo.org.uk/dom/wpa-supplicant-client"
Issues
=
"https://code.kodo.org.uk/dom/wpa-supplicant-client/-/issues"
[tool.flit.module]
name
=
"wpa_supplicant"
[tool.isort]
force_single_line
=
true
line_length
=
92
[tool.unimport]
ignore-init
=
true
...
...
@@ -16,3 +53,37 @@ implicit_reexport = true
strict
=
true
warn_unreachable
=
true
warn_unused_configs
=
true
[tool.coverage.run]
data_file
=
"results/coverage.db"
branch
=
true
source
=
[
"wpa_supplicant"
]
[tool.coverage.report]
precision
=
2
skip_empty
=
true
exclude_lines
=
[
"pragma: no-cover"
,
"if .*
\\
b__name__
\\
b"
,
"if .*
\\
bTYPE_CHECKING
\\
b"
,
"class .*(.*
\\
bProtocol
\\
b.*):"
,
"def __repr__"
,
"@overload"
,
"@(abc
\\
.)abstractmethod"
,
]
partial_branches
=
[
"pragma: no-branch"
,
"if .*
\\
b__debug__
\\
b"
,
]
[tool.coverage.json]
output
=
"results/coverage.json"
show_contexts
=
true
[tool.coverage.xml]
output
=
"results/coverage.xml"
[tool.coverage.html]
directory
=
"results/coverage"
show_contexts
=
true
setup.cfg
deleted
100644 → 0
View file @
1854cf97
[metadata]
name
=
wpa-supplicant-client
version
=
attr: wpa_supplicant.__version__
author
=
Dom Sekotill
author_email
=
dom.sekotill@kodo.org.uk
description
=
A client package for connecting to, configuring and controlling wpa_supplicant daemons
long_description
=
file: README.md
long_description_content_type
=
text/markdown
url
=
'https://code.kodo.org.uk/dom/wpa-supplicant-client.git'
license
=
Apache-2.0
license_files
=
LICENCE.txt
classifiers
=
Development
Status
::
2
-
Pre-Alpha
Intended
Audience
::
Developers
License
::
OSI
Approved
License
::
OSI
Approved
::
Apache
Software
License
Natural
Language
::
English
Operating
System
::
POSIX
Programming
Language
::
Python
Programming
Language
::
Python
::
3.8
Programming
Language
::
Python
::
3.9
Programming
Language
::
Python
::
3.10
Typing::Typed
[options]
python_requires
=
>= 3.8
packages
=
find:
setup_requires
=
setuptools
>=
40.6
install_requires
=
anyio
~=3.0
[options.packages.find]
include
=
wpa_supplicant
wpa_supplicant.*
[options.package_data]
wpa_supplicant
=
py.typed
[options.extras_require]
test
=
nose2
[coverage_plugin]
trio
[unittest]
start-dir
=
tests/unit
verbose
=
True
plugins
=
nose2.plugins.junitxml
nose2.plugins.testid
[coverage]
always-on
=
True
coverage
=
wpa_supplicant
coverage-report
=
term
[coverage:run]
branch
=
True
[coverage:report]
fail_under
=
80
precision
=
2
show_missing
=
True
omit
=
**/__main__.py
exclude_lines
=
pragma:
no
cover
if
__name__
=
= .__main__.:
def
__repr__
__version__
=
@(.*\.)?abstract((static|class)?method|property)
except
ImportError:\s*(...|pass)
[coverage:xml]
output
=
.coverage.xml
[coverage:html]
directory
=
.coverage.html.d
[junit-xml]
always-on
=
True
path
=
.unittest.xml
[testid]
always-on
=
True
[log-capture]
always-on
=
True
[isort]
force_single_line
=
true
[mypy]
strict
=
true
warn_unused_configs
=
True
warn_unreachable
=
true
implicit_reexport
=
true
[flake8]
max-line-length
=
92
max-doc-length
=
92
use-flake8-tabs
=
true
blank-lines-indent
=
never
indent-tabs-def
=
1
format
=
pylint
select
=
C,D,E,ET,F,SFS,T,W,WT
extend-exclude
=
setup.py
per-file-ignores
=
setup.py:
D100,
E702
tests/*.py:
D100,
C801
**/__init__.py:
D104,
F401,
F403
**/__main__.py:
D100,
E702
**/_*.py:
D
ignore
=
;[ Missing docstring in public method ]
; Handled by pylint, which does it better
D102
;[ Missing docstring in magic method ]
; Magic/dunder methods are well-known
D105
;[ Misisng docstring in __init__ ]
; Document basic construction in the class docstring
D107
;[ One-line docstring should fit on one line with quotes ]
; Prefer top-and-bottom style always
D200
;[ Docstring should be indented with spaces, not tabs ]
; Tabs, absolutely always
D206
;[ Use u""" for Unicode docstrings ]
; This must be for Python 2?
D302
;[ First line should end with a period ]
; First line should *NEVER* end with a period
D400
;[ First line should be in the imperative mood ]
; I like this for functions and methods, not for properties. This stands until
; pydocstyle splits a new code for properties or flake8 adds some way of
; filtering codes with line regexes like golangci-lint.
D401
;[ Line too long ]
; Prefer B950 implementation
E501
;[ multiple statements on one line (%s) ]
E701
E704
;[ unexpected number of spaces at start of statement line ]
;[ unexpected number of tabs and spaces at start of statement line ]
; Don't want spaces...
ET122
ET128
;[ Line break before binary operator ]
; Not considered current
W503
;[ Format-method string formatting ]
; Allow this style
SFS201
;[ f-string string formatting ]
; Allow this style
SFS301
include
=
;[ First word of the docstring should not be This ]
D404
; flake8-bugbear plugin
; B950 is a replacement for E501
B0
B903
B950
; vim: sw=2 sts=2 expandtab
setup.py
deleted
100755 → 0
View file @
1854cf97
#!/usr/bin/env python3
"""
Setuptools entrypoint
"""
from
setuptools
import
setup
setup
()
wpa_supplicant/__init__.py
View file @
fca7e7f2
"""
Async control of WPA-Supplicant from a Python process
# Copyright 2019-2021 Dom Sekotill <dom.sekotill@kodo.org.uk>
# Copyright 2019-2021
, 2024
Dom Sekotill <dom.sekotill@kodo.org.uk>
#
# Licensed under the Apache License, Version 2.0 (the
"
License
"
);
# you may not use this file except in compliance with the License.
...
...
@@ -15,5 +15,3 @@ Async control of WPA-Supplicant from a Python process
# See the License for the specific language governing permissions and
# limitations under the License.
"""
__version__
=
"
0.3.0
"