Skip to content

Commit bfb1842

Browse files
committed
Housekeeping
1 parent 91283f6 commit bfb1842

22 files changed

+543
-464
lines changed

.flake8

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ doctests = True
55
ignore = E201,E202,W503
66
per-file-ignores =
77
omemo/project.py:E203
8+
omemo/__init__.py:F401

.github/workflows/test-and-publish.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy-3.9"]
14+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "pypy-3.10"]
1515

1616
steps:
1717
- uses: actions/checkout@v4
@@ -21,13 +21,13 @@ jobs:
2121
with:
2222
python-version: ${{ matrix.python-version }}
2323

24-
- name: Install/update package management dependencies
25-
run: python -m pip install --upgrade pip setuptools wheel
24+
- name: Update pip
25+
run: python -m pip install --upgrade pip
2626
- name: Build and install python-omemo
2727
run: pip install .
2828
- name: Install test dependencies
2929
run: |
30-
pip install --upgrade pytest pytest-asyncio pytest-cov mypy pylint flake8
30+
pip install --upgrade pytest pytest-asyncio pytest-cov mypy pylint flake8 setuptools
3131
pip install --upgrade twisted twomemo[xml] oldmemo[xml]
3232
3333
- name: Type-check using mypy
@@ -59,6 +59,8 @@ jobs:
5959
publish:
6060
needs: [test, build]
6161
runs-on: ubuntu-latest
62+
permissions:
63+
id-token: write
6264
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
6365

6466
steps:
@@ -67,7 +69,5 @@ jobs:
6769
path: dist
6870
merge-multiple: true
6971

70-
- uses: pypa/[email protected]
71-
with:
72-
user: __token__
73-
password: ${{ secrets.pypi_token }}
72+
- name: Publish package distributions to PyPI
73+
uses: pypa/gh-action-pypi-publish@release/v1

examples/btbv_session_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import omemo
88

99

10-
__all__ = [ # pylint: disable=unused-variable
10+
__all__ = [
1111
"BTBVSessionManager",
1212
"BTBVTrustLevel"
1313
]

omemo/__init__.py

Lines changed: 57 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,61 @@
1-
from .version import __version__
2-
from .project import project
3-
4-
from .backend import Backend, BackendException, DecryptionFailed, KeyExchangeFailed, TooManySkippedMessageKeys
5-
from .bundle import Bundle
6-
from .message import Content, EncryptedKeyMaterial, KeyExchange, Message
1+
from .version import __version__ as __version__
2+
from .project import project as project
3+
4+
from .backend import (
5+
Backend as Backend,
6+
BackendException as BackendException,
7+
DecryptionFailed as DecryptionFailed,
8+
KeyExchangeFailed as KeyExchangeFailed,
9+
TooManySkippedMessageKeys as TooManySkippedMessageKeys
10+
)
11+
from .bundle import Bundle as Bundle
12+
from .message import (
13+
Content as Content,
14+
EncryptedKeyMaterial as EncryptedKeyMaterial,
15+
KeyExchange as KeyExchange,
16+
Message as Message
17+
)
718

819
from .session_manager import (
9-
SessionManagerException,
10-
11-
TrustDecisionFailed,
12-
StillUndecided,
13-
NoEligibleDevices,
14-
15-
MessageNotForUs,
16-
SenderNotFound,
17-
SenderDistrusted,
18-
NoSession,
19-
PublicDataInconsistency,
20-
21-
UnknownTrustLevel,
22-
UnknownNamespace,
23-
24-
XMPPInteractionFailed,
25-
BundleUploadFailed,
26-
BundleDownloadFailed,
27-
BundleNotFound,
28-
BundleDeletionFailed,
29-
DeviceListUploadFailed,
30-
DeviceListDownloadFailed,
31-
MessageSendingFailed,
32-
33-
SessionManager
20+
SessionManagerException as SessionManagerException,
21+
22+
TrustDecisionFailed as TrustDecisionFailed,
23+
StillUndecided as StillUndecided,
24+
NoEligibleDevices as NoEligibleDevices,
25+
26+
MessageNotForUs as MessageNotForUs,
27+
SenderNotFound as SenderNotFound,
28+
SenderDistrusted as SenderDistrusted,
29+
NoSession as NoSession,
30+
PublicDataInconsistency as PublicDataInconsistency,
31+
32+
UnknownTrustLevel as UnknownTrustLevel,
33+
UnknownNamespace as UnknownNamespace,
34+
35+
XMPPInteractionFailed as XMPPInteractionFailed,
36+
BundleUploadFailed as BundleUploadFailed,
37+
BundleDownloadFailed as BundleDownloadFailed,
38+
BundleNotFound as BundleNotFound,
39+
BundleDeletionFailed as BundleDeletionFailed,
40+
DeviceListUploadFailed as DeviceListUploadFailed,
41+
DeviceListDownloadFailed as DeviceListDownloadFailed,
42+
MessageSendingFailed as MessageSendingFailed,
43+
44+
SessionManager as SessionManager
3445
)
3546

36-
from .storage import Just, Maybe, Nothing, NothingException, Storage, StorageException
37-
from .types import AsyncFramework, DeviceInformation, JSONType, OMEMOException, TrustLevel
38-
39-
# Fun:
40-
# https://github.com/PyCQA/pylint/issues/6006
41-
# https://github.com/python/mypy/issues/10198
42-
__all__ = [ # pylint: disable=unused-variable
43-
# .version
44-
"__version__",
45-
46-
# .project
47-
"project",
48-
49-
# .backend
50-
"Backend",
51-
"BackendException",
52-
"DecryptionFailed",
53-
"KeyExchangeFailed",
54-
"TooManySkippedMessageKeys",
55-
56-
# .bundle
57-
"Bundle",
58-
59-
# .message
60-
"Content",
61-
"EncryptedKeyMaterial",
62-
"KeyExchange",
63-
"Message",
64-
65-
# .session_manager
66-
"SessionManagerException",
67-
68-
"TrustDecisionFailed",
69-
"StillUndecided",
70-
"NoEligibleDevices",
71-
72-
"MessageNotForUs",
73-
"SenderNotFound",
74-
"SenderDistrusted",
75-
"NoSession",
76-
"PublicDataInconsistency",
77-
78-
"UnknownTrustLevel",
79-
"UnknownNamespace",
80-
81-
"XMPPInteractionFailed",
82-
"BundleUploadFailed",
83-
"BundleDownloadFailed",
84-
"BundleNotFound",
85-
"BundleDeletionFailed",
86-
"DeviceListUploadFailed",
87-
"DeviceListDownloadFailed",
88-
"MessageSendingFailed",
89-
90-
"SessionManager",
91-
92-
# .storage
93-
"Just",
94-
"Maybe",
95-
"Nothing",
96-
"NothingException",
97-
"Storage",
98-
"StorageException",
99-
100-
# .types
101-
"AsyncFramework",
102-
"DeviceInformation",
103-
"JSONType",
104-
"OMEMOException",
105-
"TrustLevel"
106-
]
47+
from .storage import (
48+
Just as Just,
49+
Maybe as Maybe,
50+
Nothing as Nothing,
51+
NothingException as NothingException,
52+
Storage as Storage,
53+
StorageException as StorageException
54+
)
55+
from .types import (
56+
AsyncFramework as AsyncFramework,
57+
DeviceInformation as DeviceInformation,
58+
JSONType as JSONType,
59+
OMEMOException as OMEMOException,
60+
TrustLevel as TrustLevel
61+
)

omemo/backend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from .types import OMEMOException
88

99

10-
__all__ = [ # pylint: disable=unused-variable
10+
__all__ = [
1111
"Backend",
1212
"BackendException",
1313
"DecryptionFailed",

omemo/bundle.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from abc import ABC, abstractmethod
22

33

4-
__all__ = [ # pylint: disable=unused-variable
4+
__all__ = [
55
"Bundle"
66
]
77

@@ -18,25 +18,21 @@ class Bundle(ABC):
1818
@property
1919
@abstractmethod
2020
def namespace(self) -> str:
21-
# pylint: disable=missing-function-docstring
2221
pass
2322

2423
@property
2524
@abstractmethod
2625
def bare_jid(self) -> str:
27-
# pylint: disable=missing-function-docstring
2826
pass
2927

3028
@property
3129
@abstractmethod
3230
def device_id(self) -> int:
33-
# pylint: disable=missing-function-docstring
3431
pass
3532

3633
@property
3734
@abstractmethod
3835
def identity_key(self) -> bytes:
39-
# pylint: disable=missing-function-docstring
4036
pass
4137

4238
@abstractmethod

omemo/identity_key_pair.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This import from future (theoretically) enables sphinx_autodoc_typehints to handle type aliases better
2-
from __future__ import annotations # pylint: disable=unused-variable
2+
from __future__ import annotations
33

44
from abc import ABC, abstractmethod
55
import logging
@@ -11,7 +11,7 @@
1111
from .storage import NothingException, Storage
1212

1313

14-
__all__ = [ # pylint: disable=unused-variable
14+
__all__ = [
1515
"IdentityKeyPair",
1616
"IdentityKeyPairPriv",
1717
"IdentityKeyPairSeed"

omemo/message.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from typing import FrozenSet, NamedTuple, Optional, Tuple
33

44

5-
__all__ = [ # pylint: disable=unused-variable
5+
__all__ = [
66
"Content",
77
"EncryptedKeyMaterial",
88
"KeyExchange",
@@ -43,13 +43,11 @@ class EncryptedKeyMaterial(ABC):
4343
@property
4444
@abstractmethod
4545
def bare_jid(self) -> str:
46-
# pylint: disable=missing-function-docstring
4746
pass
4847

4948
@property
5049
@abstractmethod
5150
def device_id(self) -> int:
52-
# pylint: disable=missing-function-docstring
5351
pass
5452

5553

@@ -62,7 +60,6 @@ class KeyExchange(ABC):
6260
@property
6361
@abstractmethod
6462
def identity_key(self) -> bytes:
65-
# pylint: disable=missing-function-docstring
6663
pass
6764

6865
@abstractmethod

omemo/project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__all__ = [ "project" ] # pylint: disable=unused-variable
1+
__all__ = [ "project" ]
22

33
project = {
44
"name" : "OMEMO",

omemo/session.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from .message import KeyExchange
66

77

8-
__all__ = [ # pylint: disable=unused-variable
8+
__all__ = [
99
"Initiation",
1010
"Session"
1111
]
@@ -48,19 +48,16 @@ class Session(ABC):
4848
@property
4949
@abstractmethod
5050
def namespace(self) -> str:
51-
# pylint: disable=missing-function-docstring
5251
pass
5352

5453
@property
5554
@abstractmethod
5655
def bare_jid(self) -> str:
57-
# pylint: disable=missing-function-docstring
5856
pass
5957

6058
@property
6159
@abstractmethod
6260
def device_id(self) -> int:
63-
# pylint: disable=missing-function-docstring
6461
pass
6562

6663
@property

0 commit comments

Comments
 (0)