Skip to content

Commit df3dde7

Browse files
chore: Extend linting (#13)
1 parent 9854447 commit df3dde7

32 files changed

+1838
-465
lines changed

.github/workflows/docs.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ jobs:
1111
deploy:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v4
15-
- uses: astral-sh/setup-uv@v7
14+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
15+
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
1616
with:
1717
python-version: "3.12"
1818
- run: uv sync --group docs

.github/workflows/lint.yaml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,36 @@ on:
55
push:
66
branches: [master]
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
lint:
1013
name: Lint & type-check
1114
runs-on: ubuntu-latest
1215
steps:
13-
- uses: actions/checkout@v4
14-
- uses: astral-sh/setup-uv@v7
16+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
17+
with:
18+
persist-credentials: false
19+
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
1520
with:
1621
python-version: "3.13"
1722
- run: uv sync --group dev
1823
- run: uv run ruff check src tests
1924
- run: uv run ruff format --check src tests
2025
- run: uv run mypy
26+
27+
security:
28+
name: Security checks
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
32+
with:
33+
persist-credentials: false
34+
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
35+
with:
36+
python-version: "3.13"
37+
- run: uv sync --group dev
38+
- run: uv run bandit -c pyproject.toml -r src
39+
- run: uv run semgrep scan --config auto --error src
40+
- run: uv run zizmor --min-severity high .

.github/workflows/release.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,31 @@ jobs:
1111
name: Release & Publish
1212
runs-on: ubuntu-latest
1313
concurrency: release
14+
environment: release
1415

1516
steps:
16-
- uses: actions/checkout@v4
17+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
1718
with:
1819
fetch-depth: 0
1920

2021
- name: Python Semantic Release
2122
id: release
22-
uses: python-semantic-release/python-semantic-release@v9
23+
uses: python-semantic-release/python-semantic-release@0dc72ac9058a62054a45f6344c83a423d7f906a8 # v9
2324
with:
2425
github_token: ${{ secrets.GITHUB_TOKEN }}
2526

26-
- uses: astral-sh/setup-uv@v7
27+
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
2728
if: steps.release.outputs.released == 'true'
2829
with:
2930
python-version: "3.11"
31+
enable-cache: false
3032

3133
- name: Build
3234
if: steps.release.outputs.released == 'true'
3335
run: uv build
3436

3537
- name: Publish to PyPI
3638
if: steps.release.outputs.released == 'true'
37-
uses: pypa/gh-action-pypi-publish@release/v1
39+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # release/v1
3840
with:
3941
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/tests.yaml

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
push:
66
branches: [master]
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
tests:
1013
name: Python ${{ matrix.python-version }}
@@ -32,21 +35,23 @@ jobs:
3235
--security-opt no-new-privileges:true
3336
3437
hivemq:
35-
image: hivemq/hivemq-ce:latest
38+
image: hivemq/hivemq-ce@sha256:7ae39e84654a41ced6e946dd84f131d508bc2b862ec96265b7f23d241db214da # latest
3639
ports:
3740
- 1886:1883
3841
options: >-
3942
--security-opt no-new-privileges:true
4043
4144
nanomq:
42-
image: emqx/nanomq:latest
45+
image: emqx/nanomq@sha256:cf010e7b78981b051cdb833921207991daaf46dccce1ab12dd8d7ec433147161 # latest
4346
ports:
4447
- 1887:1883
4548
options: >-
4649
--security-opt no-new-privileges:true
4750
4851
steps:
49-
- uses: actions/checkout@v4
52+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
53+
with:
54+
persist-credentials: false
5055

5156
- name: Setup mosquitto config
5257
run: |
@@ -73,13 +78,15 @@ jobs:
7378
nc -zv localhost $port || echo "Port $port not responding"
7479
done
7580
76-
- uses: actions/checkout@v4
77-
- uses: astral-sh/setup-uv@v7
81+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
82+
with:
83+
persist-credentials: false
84+
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
7885
with:
7986
python-version: ${{ matrix.python-version }}
8087
- run: uv sync --group dev
8188
- run: uv run pytest -vv --cov=src/zmqtt --cov-report=xml
82-
- uses: codecov/codecov-action@v5
89+
- uses: codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad # v5
8390
with:
8491
files: coverage.xml
8592

@@ -92,7 +99,9 @@ jobs:
9299
python-version: ["3.10", "3.14"]
93100

94101
steps:
95-
- uses: actions/checkout@v4
102+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
103+
with:
104+
persist-credentials: false
96105

97106
- name: Install and start mosquitto
98107
run: |
@@ -101,12 +110,12 @@ jobs:
101110
$(brew --prefix)/sbin/mosquitto -c /tmp/mosquitto.conf -d
102111
sleep 2
103112
104-
- uses: astral-sh/setup-uv@v7
113+
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
105114
with:
106115
python-version: ${{ matrix.python-version }}
107116
- run: uv sync --group dev
108117
- run: uv run pytest -vv --cov=src/zmqtt --cov-report=xml --ignore=tests/test_brokers/test_artemis.py --ignore=tests/test_brokers/test_hivemq.py --ignore=tests/test_brokers/test_nanomq.py
109-
- uses: codecov/codecov-action@v5
118+
- uses: codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad # v5
110119
with:
111120
files: coverage.xml
112121

@@ -119,7 +128,9 @@ jobs:
119128
python-version: ["3.10", "3.14"]
120129

121130
steps:
122-
- uses: actions/checkout@v4
131+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
132+
with:
133+
persist-credentials: false
123134

124135
- name: Install and start mosquitto
125136
shell: pwsh
@@ -129,12 +140,12 @@ jobs:
129140
Start-Process -FilePath "C:\Program Files\mosquitto\mosquitto.exe" -ArgumentList "-c $env:TEMP\mosquitto.conf" -WindowStyle Hidden
130141
Start-Sleep -Seconds 3
131142
132-
- uses: astral-sh/setup-uv@v7
143+
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
133144
with:
134145
python-version: ${{ matrix.python-version }}
135146
- run: uv sync --group dev
136147
- run: uv run pytest -vv --cov=src/zmqtt --cov-report=xml --ignore=tests/test_brokers/test_artemis.py --ignore=tests/test_brokers/test_hivemq.py --ignore=tests/test_brokers/test_nanomq.py
137-
- uses: codecov/codecov-action@v5
148+
- uses: codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad # v5
138149
with:
139150
files: coverage.xml
140151

@@ -144,6 +155,6 @@ jobs:
144155
needs: [tests, tests-macos, tests-windows]
145156
runs-on: ubuntu-latest
146157
steps:
147-
- uses: re-actors/alls-green@release/v1
158+
- uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # release/v1
148159
with:
149160
jobs: ${{ toJSON(needs) }}

CHANGELOG.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,11 @@
55

66
### Chores
77

8-
- Add 3.10 python compat
9-
([`6a08554`](https://github.com/faststream-community/zMQTT/commit/6a08554fdef91e3a8a1edb3d43cf0aa1c6d1fb51))
10-
118
- Add python 3.10 support ([#10](https://github.com/faststream-community/zMQTT/pull/10),
129
[`5bfb461`](https://github.com/faststream-community/zMQTT/commit/5bfb461b67bdd4791a3744003062e3f924d7390a))
1310

1411
### Documentation
1512

16-
- Clarify subscribe routing and fix MQTT5 auth wording
17-
([`343280a`](https://github.com/faststream-community/zMQTT/commit/343280a40a75c588b002e9c4931df1d59b2684bb))
18-
1913
- Clarify subscribe routing and fix MQTT5 auth wording
2014
([#9](https://github.com/faststream-community/zMQTT/pull/9),
2115
[`34adbef`](https://github.com/faststream-community/zMQTT/commit/34adbef398dd35bbe3133b111435d42949e943fd))
@@ -25,9 +19,6 @@
2519

2620
### Features
2721

28-
- Rename to zmqtt
29-
([`4098df6`](https://github.com/faststream-community/zMQTT/commit/4098df6a175f00f1c5deb3b903c10c9ec7373f8b))
30-
3122
- Rename to zmqtt ([#8](https://github.com/faststream-community/zMQTT/pull/8),
3223
[`301b037`](https://github.com/faststream-community/zMQTT/commit/301b0378710de925c284767fdb8e53fa91c9cbc5))
3324

@@ -39,10 +30,5 @@
3930
- Add release pipeline
4031
([`071b85d`](https://github.com/faststream-community/zMQTT/commit/071b85d167c6b26a8dd0c85bc08f4ea65f86958c))
4132

42-
chore: Add release pipeline
43-
44-
- Add release pipeline
45-
([`77ae34f`](https://github.com/faststream-community/zMQTT/commit/77ae34f6da88f108d8547b61892a1af064cd09bb))
46-
4733
- Tests infra
4834
([`8f3b14c`](https://github.com/faststream-community/zMQTT/commit/8f3b14cdc9eb2bd4d8c4f74404bc26232d6dc525))

pyproject.toml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,49 @@ name = "zmqtt"
33
version = "0.0.1-alpha.3"
44
description = "Pure asyncio MQTT 3.1.1/5.0 client library"
55
readme = "README.md"
6+
license = "MIT"
7+
license-files = ["LICENSE"]
68
authors = [
79
{ name = "borisalekseev", email = "i.borisalekseev@gmail.com" }
810
]
911
requires-python = ">=3.10"
1012
dependencies = []
13+
keywords = ["mqtt", "mqtt5", "iot", "python-mqtt", "zmqtt"]
14+
classifiers = [
15+
"Development Status :: 3 - Alpha",
16+
"Intended Audience :: Developers",
17+
"License :: OSI Approved :: MIT License",
18+
"Programming Language :: Python :: 3",
19+
"Programming Language :: Python :: 3.10",
20+
"Programming Language :: Python :: 3.11",
21+
"Programming Language :: Python :: 3.12",
22+
"Programming Language :: Python :: 3.13",
23+
"Programming Language :: Python :: 3.14",
24+
"Topic :: Software Development :: Libraries :: Python Modules",
25+
"Framework :: AsyncIO",
26+
"Typing :: Typed",
27+
]
28+
29+
[project.urls]
30+
Homepage = "https://github.com/faststream-community/zMQTT"
31+
Repository = "https://github.com/faststream-community/zMQTT"
32+
Documentation = "https://faststream-community.github.io/zMQTT/"
33+
Issues = "https://github.com/faststream-community/zMQTT/issues"
1134

1235
[build-system]
13-
requires = ["uv_build>=0.9.7,<0.10.0"]
36+
requires = ["uv_build>=0.9.7,<0.11.0"]
1437
build-backend = "uv_build"
1538

1639
[dependency-groups]
1740
dev = [
41+
"bandit>=1.9.4",
1842
"mypy>=1.19.1",
1943
"pytest>=9.0.2",
2044
"pytest-asyncio>=1.3.0",
2145
"pytest-cov>=7.0.0",
2246
"ruff>=0.15.5",
47+
"semgrep>=1.156.0",
48+
"zizmor>=1.23.1",
2349
{include-group = "docs"},
2450
]
2551
docs = [
@@ -37,6 +63,17 @@ python_version = "3.10"
3763
src = ["src"]
3864
include = ["src/**.py", "tests/**.py"]
3965
target-version = "py310"
66+
line-length = 120
67+
68+
[tool.ruff.lint]
69+
select = ["ALL"]
70+
ignore = ["D", "COM812"]
71+
72+
[tool.ruff.lint.per-file-ignores]
73+
"tests/**" = ["S101", "D", "PLR2004", "SLF001", "FBT001"]
74+
"src/zmqtt/protocol.py" = ["SLF001"]
75+
"src/zmqtt/packets/codec.py" = ["PLR", "C901"]
76+
"src/zmqtt/client.py" = ["PLR0913", "SLF001", "FBT"]
4077

4178
[tool.pytest.ini_options]
4279
asyncio_mode = "auto"

src/zmqtt/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from zmqtt.client import (
22
MQTTClient,
3-
MQTTClientV311,
43
MQTTClientV5,
4+
MQTTClientV311,
55
ReconnectConfig,
66
Subscription,
77
create_client,
@@ -10,12 +10,12 @@
1010

1111
__all__ = [
1212
"MQTTClient",
13-
"MQTTClientV311",
1413
"MQTTClientV5",
15-
"ReconnectConfig",
16-
"Subscription",
17-
"create_client",
14+
"MQTTClientV311",
1815
"Message",
1916
"QoS",
17+
"ReconnectConfig",
2018
"RetainHandling",
19+
"Subscription",
20+
"create_client",
2121
]

src/zmqtt/_compat.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import sys
66
from collections.abc import AsyncGenerator
77

8-
98
if sys.version_info >= (3, 11):
109

1110
@contextlib.asynccontextmanager

0 commit comments

Comments
 (0)