-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
137 lines (119 loc) · 3.72 KB
/
pyproject.toml
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
[project]
name = "unblob-native"
authors = [
{name = "ONEKEY", email = "[email protected]"},
]
description = "Performance-critical functionality for Unblob"
license = {file = "LICENSE"}
readme = "README.md"
requires-python = ">=3.8"
dynamic = ["version"] # Calculated from the rust module version
dependencies = []
[project.urls]
homepage = "https://unblob.org"
repository = "https://github.com/onekey-sec/unblob-native"
[build-system]
requires = ["maturin>=1.0,<2.0"]
build-backend = "maturin"
[tool.maturin]
module-name = "unblob_native._native"
python-source = "python"
features = [
"pyo3/extension-module", # This is an extension module
"pyo3/abi3-py38" # https://docs.python.org/3/c-api/stable.html
]
[tool.ruff]
target-version = "py38"
[tool.ruff.lint]
select = [
"A", # flake8-builtins
"ARG", # flake8-unused-arguments
"B", # flake8-bugbear
"C90", # mccabe
"C4", # flake8-comprehensions
"COM818", # flake8-commas; trailing-comma-on-bare-tuple
"D", # pydocstyle
"E", # pycodestyle (errors)
"F", # pyflakes
"FBT", # flake8-boolean-trap
"G", # flake8-logging-format
"I", # isort
"N", # pep8-naming
"PIE", # flake8-pie
"PYI", # flake8-pyi
"PL", # pylint
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
"RET", # flake8-return
"RUF", # ruff's own lints
"RSE", # flake8-raise
"S", # flake8-bandit
"SIM", # flake8-simplify
"SLF", # flake8-self
"T10", # flake8-debugger
"T20", # flake8-print
"TCH", # flake8-type-checking
"TRY", # tryceratops
"UP", # pyupgrade
"W", # pycodestyle (warnings)
]
ignore = [
"D1", # undocumented-*: Native extension docstrings are not picked up
"D203", # one-blank-line-before-class: D211 (no-blank-line-before-class) is used instead
"D213", # multi-line-summary-second-line: D212 (multi-line-summary-first-line) is used instead
"E501", # line-too-long: Let black handle line length violations
"TRY003", # raise-vanilla-args: We are adding contextual information in exception messages
"UP007", # non-pep604-annotation: Python 3.8 support needs legacy annotations
]
[tool.ruff.lint.per-file-ignores]
"python/unblob_native/__init__.py" = [
"F403",
"A001",
"F405",
"PLE0605",
]
"tests/*" = [
"S101", # assert: Enable usage of asserts
]
[tool.ruff.lint.isort]
known-first-party = ["unblob_native"]
[tool.ruff.lint.flake8-pytest-style]
fixture-parentheses = false
mark-parentheses = false
parametrize-names-type = "csv"
[tool.pyright]
include = ["unblob_native", "tests"]
stubPath = "."
pythonVersion = "3.8"
# Strict mode enables additional checks:
# https://github.com/microsoft/pyright/blob/main/docs/configuration.md#diagnostic-rule-defaults
typeCheckingMode = "strict"
# The following are not enabled even in strict mode
reportImportCycles = "warning"
reportMissingSuperCall = "warning"
reportPropertyTypeMismatch = "warning"
reportShadowedImports = "warning"
reportUninitializedInstanceVariable = "warning"
reportUnnecessaryTypeIgnoreComment = "warning"
reportUnusedCallResult = "warning"
reportUnknownArgumentType = "none"
reportUnknownVariableType = "none"
reportUnknownMemberType = "none"
[tool.pdm.scripts]
venv = "pdm sync -d"
pre-commit = "pre-commit run --all"
pyright = "pyright"
pytest = "python -m pytest tests"
clippy = "cargo clippy --all-targets -- --deny warnings"
test = "cargo test"
all = { composite = ["clippy", "test", "venv", "pre-commit", "pyright", "pytest"] }
[tool.pdm.dev-dependencies]
dev = [
"black>=24.8.0",
"pre-commit>=3.5.0",
"pyright>=1.1.384",
"ruff>=0.6.9",
]
test = [
"pytest>=8.3.3",
]