Skip to content

Commit

Permalink
Housekeeping
Browse files Browse the repository at this point in the history
  • Loading branch information
Syndace committed Oct 15, 2024
1 parent 9686234 commit ef0b90c
Show file tree
Hide file tree
Showing 33 changed files with 533 additions and 429 deletions.
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ doctests = True
ignore = E201,E202,W503
per-file-ignores =
doubleratchet/project.py:E203
doubleratchet/__init__.py:F401
doubleratchet/recommended/__init__.py:F401
16 changes: 8 additions & 8 deletions .github/workflows/test-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy-3.9"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "pypy-3.10"]

steps:
- uses: actions/checkout@v4
Expand All @@ -21,12 +21,12 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install/update package management dependencies
run: python -m pip install --upgrade pip setuptools wheel
- name: Update pip
run: python -m pip install --upgrade pip
- name: Build and install python-doubleratchet
run: pip install .
- name: Install test dependencies
run: pip install --upgrade pytest pytest-asyncio pytest-cov mypy pylint flake8
run: pip install --upgrade pytest pytest-asyncio pytest-cov mypy pylint flake8 setuptools

- name: Type-check using mypy
run: mypy --strict doubleratchet/ setup.py examples/ tests/
Expand Down Expand Up @@ -57,6 +57,8 @@ jobs:
publish:
needs: [test, build]
runs-on: ubuntu-latest
permissions:
id-token: write
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')

steps:
Expand All @@ -65,7 +67,5 @@ jobs:
path: dist
merge-multiple: true

- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.pypi_token }}
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

### Changed
- Drop support for Python3.8, add support for Python3.13, bump PyPy test version to 3.10
- Internal housekeeping, mostly related to pylint

## [1.0.4] - 9th of July 2024

### Changed
Expand Down
97 changes: 34 additions & 63 deletions doubleratchet/__init__.py
Original file line number Diff line number Diff line change
@@ -1,63 +1,34 @@
from .version import __version__
from .project import project

from .aead import AEAD, AuthenticationFailedException, DecryptionFailedException
from .diffie_hellman_ratchet import DiffieHellmanRatchet, DoSProtectionException, DuplicateMessageException
from .double_ratchet import DoubleRatchet
from .kdf import KDF
from .kdf_chain import KDFChain
from .migrations import InconsistentSerializationException
from .models import DiffieHellmanRatchetModel, DoubleRatchetModel, KDFChainModel, SymmetricKeyRatchetModel
from .symmetric_key_ratchet import Chain, ChainNotAvailableException, SymmetricKeyRatchet
from .types import EncryptedMessage, Header, JSONObject, SkippedMessageKeys


# Fun:
# https://github.com/PyCQA/pylint/issues/6006
# https://github.com/python/mypy/issues/10198
__all__ = [ # pylint: disable=unused-variable
# .version
"__version__",

# .project
"project",

# .aead
"AEAD",
"AuthenticationFailedException",
"DecryptionFailedException",

# .diffie_hellman_ratchet
"DiffieHellmanRatchet",
"DoSProtectionException",
"DuplicateMessageException",

# .double_ratchet
"DoubleRatchet",

# .kdf
"KDF",

# .kdf_chain
"KDFChain",

# .migrations
"InconsistentSerializationException",

# .models
"DiffieHellmanRatchetModel",
"DoubleRatchetModel",
"KDFChainModel",
"SymmetricKeyRatchetModel",

# .symmetric_key_ratchet
"Chain",
"ChainNotAvailableException",
"SymmetricKeyRatchet",

# .types
"EncryptedMessage",
"Header",
"JSONObject",
"SkippedMessageKeys"
]
from .version import __version__ as __version__
from .project import project as project

from .aead import (
AEAD as AEAD,
AuthenticationFailedException as AuthenticationFailedException,
DecryptionFailedException as DecryptionFailedException
)
from .diffie_hellman_ratchet import (
DiffieHellmanRatchet as DiffieHellmanRatchet,
DoSProtectionException as DoSProtectionException,
DuplicateMessageException as DuplicateMessageException
)
from .double_ratchet import DoubleRatchet as DoubleRatchet
from .kdf import KDF as KDF
from .kdf_chain import KDFChain as KDFChain
from .migrations import InconsistentSerializationException as InconsistentSerializationException
from .models import (
DiffieHellmanRatchetModel as DiffieHellmanRatchetModel,
DoubleRatchetModel as DoubleRatchetModel,
KDFChainModel as KDFChainModel,
SymmetricKeyRatchetModel as SymmetricKeyRatchetModel
)
from .symmetric_key_ratchet import (
Chain as Chain,
ChainNotAvailableException as ChainNotAvailableException,
SymmetricKeyRatchet as SymmetricKeyRatchet
)
from .types import (
EncryptedMessage as EncryptedMessage,
Header as Header,
JSONObject as JSONObject,
SkippedMessageKeys as SkippedMessageKeys
)
2 changes: 1 addition & 1 deletion doubleratchet/aead.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from abc import ABC, abstractmethod


__all__ = [ # pylint: disable=unused-variable
__all__ = [
"AEAD",
"AuthenticationFailedException",
"DecryptionFailedException"
Expand Down
4 changes: 2 additions & 2 deletions doubleratchet/diffie_hellman_ratchet.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This import from future (theoretically) enables sphinx_autodoc_typehints to handle type aliases better
from __future__ import annotations # pylint: disable=unused-variable
from __future__ import annotations

from abc import ABC, abstractmethod
from collections import OrderedDict
Expand All @@ -15,7 +15,7 @@
from .types import Header, JSONObject, SkippedMessageKeys


__all__ = [ # pylint: disable=unused-variable
__all__ = [
"DiffieHellmanRatchet",
"DoSProtectionException",
"DuplicateMessageException"
Expand Down
4 changes: 2 additions & 2 deletions doubleratchet/double_ratchet.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This import from future (theoretically) enables sphinx_autodoc_typehints to handle type aliases better
from __future__ import annotations # pylint: disable=unused-variable
from __future__ import annotations

from abc import ABC, abstractmethod
from collections import OrderedDict
Expand All @@ -16,7 +16,7 @@
from .types import EncryptedMessage, Header, JSONObject, SkippedMessageKeys


__all__ = [ # pylint: disable=unused-variable
__all__ = [
"DoubleRatchet"
]

Expand Down
2 changes: 1 addition & 1 deletion doubleratchet/kdf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from abc import ABC, abstractmethod


__all__ = [ # pylint: disable=unused-variable
__all__ = [
"KDF"
]

Expand Down
4 changes: 2 additions & 2 deletions doubleratchet/kdf_chain.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This import from future (theoretically) enables sphinx_autodoc_typehints to handle type aliases better
from __future__ import annotations # pylint: disable=unused-variable
from __future__ import annotations

import json
from typing import Type, TypeVar, cast
Expand All @@ -10,7 +10,7 @@
from .types import JSONObject


__all__ = [ # pylint: disable=unused-variable
__all__ = [
"KDFChain"
]

Expand Down
4 changes: 2 additions & 2 deletions doubleratchet/migrations.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This import from future (theoretically) enables sphinx_autodoc_typehints to handle type aliases better
from __future__ import annotations # pylint: disable=unused-variable
from __future__ import annotations

import base64
from typing import Dict, List, Optional, cast
Expand All @@ -16,7 +16,7 @@
from .types import JSONObject


__all__ = [ # pylint: disable=unused-variable
__all__ = [
"InconsistentSerializationException",
"parse_diffie_hellman_ratchet_model",
"parse_double_ratchet_model",
Expand Down
2 changes: 1 addition & 1 deletion doubleratchet/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typing_extensions import Annotated


__all__ = [ # pylint: disable=unused-variable
__all__ = [
"DiffieHellmanRatchetModel",
"DoubleRatchetModel",
"KDFChainModel",
Expand Down
2 changes: 1 addition & 1 deletion doubleratchet/project.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__all__ = [ "project" ] # pylint: disable=unused-variable
__all__ = [ "project" ]

project = {
"name" : "DoubleRatchet",
Expand Down
11 changes: 1 addition & 10 deletions doubleratchet/recommended/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
from .crypto_provider import HashFunction


# Fun:
# https://github.com/PyCQA/pylint/issues/6006
# https://github.com/python/mypy/issues/10198
__all__ = [ # pylint: disable=unused-variable
# .crypto_provider
"HashFunction"
]
from .crypto_provider import HashFunction as HashFunction
2 changes: 1 addition & 1 deletion doubleratchet/recommended/aead_aes_hmac.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from .. import aead


__all__ = [ # pylint: disable=unused-variable
__all__ = [
"AEAD"
]

Expand Down
2 changes: 1 addition & 1 deletion doubleratchet/recommended/crypto_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing_extensions import assert_never


__all__ = [ # pylint: disable=unused-variable
__all__ = [
"CryptoProvider",
"HashFunction"
]
Expand Down
2 changes: 1 addition & 1 deletion doubleratchet/recommended/crypto_provider_cryptography.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from .. import aead


__all__ = [ # pylint: disable=unused-variable
__all__ = [
"CryptoProviderImpl"
]

Expand Down
2 changes: 1 addition & 1 deletion doubleratchet/recommended/crypto_provider_impl.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .crypto_provider_cryptography import CryptoProviderImpl


__all__ = [ # pylint: disable=unused-variable
__all__ = [
"CryptoProviderImpl"
]
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from .. import diffie_hellman_ratchet


__all__ = [ # pylint: disable=unused-variable
__all__ = [
"DiffieHellmanRatchet"
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from .. import diffie_hellman_ratchet


__all__ = [ # pylint: disable=unused-variable
__all__ = [
"DiffieHellmanRatchet"
]

Expand Down
2 changes: 1 addition & 1 deletion doubleratchet/recommended/kdf_hkdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from .. import kdf


__all__ = [ # pylint: disable=unused-variable
__all__ = [
"KDF"
]

Expand Down
2 changes: 1 addition & 1 deletion doubleratchet/recommended/kdf_separate_hmacs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from .. import kdf


__all__ = [ # pylint: disable=unused-variable
__all__ = [
"KDF"
]

Expand Down
4 changes: 2 additions & 2 deletions doubleratchet/symmetric_key_ratchet.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This import from future (theoretically) enables sphinx_autodoc_typehints to handle type aliases better
from __future__ import annotations # pylint: disable=unused-variable
from __future__ import annotations

import enum
import json
Expand All @@ -13,7 +13,7 @@
from .types import JSONObject


__all__ = [ # pylint: disable=unused-variable
__all__ = [
"Chain",
"ChainNotAvailableException",
"SymmetricKeyRatchet"
Expand Down
4 changes: 2 additions & 2 deletions doubleratchet/types.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# This import from future (theoretically) enables sphinx_autodoc_typehints to handle type aliases better
from __future__ import annotations # pylint: disable=unused-variable
from __future__ import annotations

from typing import List, Mapping, NamedTuple, OrderedDict, Tuple, Union


__all__ = [ # pylint: disable=unused-variable
__all__ = [
"EncryptedMessage",
"Header",
"JSONObject",
Expand Down
2 changes: 1 addition & 1 deletion doubleratchet/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__all__ = [ "__version__" ] # pylint: disable=unused-variable
__all__ = [ "__version__" ]

__version__ = {}
__version__["short"] = "1.0.4"
Expand Down
Loading

0 comments on commit ef0b90c

Please sign in to comment.