1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
|
[build-system]
requires = ["setuptools>=65.0.0"]
build-backend = "setuptools.build_meta"
[project]
name = "omemo-dr"
requires-python = ">=3.10"
description = "OMEMO Double Ratchet"
readme = "README.md"
license = {file = "LICENSE"}
authors = [
{email = "philipp@hoerist.com"},
{name = "Philipp Hörist"}
]
classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Programming Language :: Python :: 3",
"Topic :: Security :: Cryptography",
"Topic :: Software Development :: Libraries :: Python Modules"
]
dependencies = [
"cryptography",
"protobuf>=4.21.0",
]
dynamic = ["version"]
[project.optional-dependencies]
dev = [
"ruff>=0.5.4",
"codespell[toml]>=2.2.4",
"black>=23.1.0"
]
[tool.setuptools.dynamic]
version = {attr = "omemo_dr.__version__"}
[tool.setuptools.packages.find]
where = ["src"]
[tool.setuptools.package-data]
"omemo_dr" = ["py.typed"]
[tool.codespell]
skip = "*__pycache__*,build,dist,test,.venv,*.egg-info,.git,*.po,*.nsi,*.spec"
ignore-words-list = "claus,pres,ser,trough"
[tool.pyright]
pythonVersion = "3.10"
pythonPlatform = "All"
typeCheckingMode = "strict"
reportUnnecessaryTypeIgnoreComment = "error"
reportPropertyTypeMismatch = "error"
reportMissingModuleSource = "none"
exclude = [
"**/__pycache__",
".git",
"build",
".venv",
"node_modules",
"src/omemo_dr/protocol/omemo_pb2.py",
"src/omemo_dr/protocol/whisper_pb2.py",
"src/omemo_dr/state/storage_pb2.py",
]
[tool.ruff]
line-length = 88
target-version = "py310"
[tool.ruff.lint]
select = [
"A", # flake8-builtins
# "ANN", # flake8-annotations
# "ARG", # flake8-unused-arguments
"B", # flake8-bugbear
"BLE", # flake8-blind-except
"C", # flake8-comprehensions
"C901", # mccabe
# "D", # pydocstyle
"E", # pycodestyle
# "EM", # flake8-errmsg
# "ERA", # eradicate
"F", # pyflakes
# "FBT", # flake8-boolean-trap
# "I", # flake8-tidy-imports, isort
"ICN", # flake8-import-conventions
"N", # pep8-naming
# "PDV", # pandas-vet
"PGH", # pygrep-hooks
"PLC", # pylint
"PLE", # pylint
"PLR", # pylint
"PLW", # pylint
"Q", # flake8-quotes
"RUF", # Ruff-specific rules
# "RET", # flake8-return
"S", # flake8-bandit
"SIM", # flake8-simplify
# "T", # flake8-debugger, flake8-print
# "TID", # flake8-tidy-imports
"UP", # pyupgrade
"W", # pycodestyle
"YTT", # flake8-2020
]
ignore = [
"A002", # Argument `max` is shadowing a python builtin
"A003", # Class attribute `x` is shadowing a python builtin
"B007", # Loop control variable `x` not used within loop body
"B904", # Within an `except` clause, raise exceptions with `raise ... from err`
"BLE001", # Do not catch blind exception: `Exception`
"C416", # Unnecessary `list` comprehension (rewrite using `list()`)
"E501", # Line too long (x > y characters)
"N802", # Function name `loadSignedPreKeys` should be lowercase
"N803", # Argument name `signedPreKeyId` should be lowercase
"N806", # Variable `x` in function should be lowercase
"N815", # Variable `messageKeys` in class scope should not be mixedCase
"N818", # Exception name should be named with an Error suffix
"PGH003", # Use specific rule codes when ignoring type issues
"PLR0913", # Too many arguments to function call (x/y)
"PLR0915", # Too many statements (57/50)
"PLR2004", # Magic value used in comparison, consider replacing x with a constant variable
"RUF001", # AmbiguousUnicodeCharacterString
"S101", # Use of `assert` detected
"S110", # `try`-`except`-`pass` detected, consider logging the exception
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
"S603", # check for execution of untrusted input
"S608", # Possible SQL injection vector through string-based query construction
"SIM108", # Use ternary operator
"SIM110", # Use any()` instead of `for` loop
"SIM118", # Don’t use .keys()
"UP004", # Class inherits from `object`
"UP007", # Use X | Y for type annotations
"UP008", # Use `super()` instead of `super(__class__, self)`
"UP031", # Use format specifiers instead of percent format
"UP038", # Use `X | Y` in `isinstance` call instead of `(X, Y)`
]
exclude = [
".eggs",
".git",
".ruff_cache",
".venv",
"build",
"dist",
"venv",
"*.pyi",
"*pb2.py",
]
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[tool.ruff.lint.mccabe]
max-complexity = 15
[tool.ruff.lint.flake8-quotes]
inline-quotes = "double"
docstring-quotes = "double"
multiline-quotes = "double"
[tool.isort]
force_alphabetical_sort_within_sections = true
force_single_line = true
group_by_package = true
known_typing = ["typing"]
sections = [
"FUTURE",
"TYPING",
"STDLIB",
"THIRDPARTY",
"FIRSTPARTY",
"LOCALFOLDER"
]
skip_gitignore = true
skip_glob = ["**/*pb2.py"]
[tool.black]
line-length = 88
target-version = ['py310']
force-exclude = ".*pb2.py"
|