-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathpyproject.toml
More file actions
182 lines (163 loc) · 6.11 KB
/
pyproject.toml
File metadata and controls
182 lines (163 loc) · 6.11 KB
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
[project]
name = "uchroma"
version = "1.9.90"
description = "Userspace RGB control for Razer Chroma peripherals"
readme = "README.md"
license = "LGPL-3.0-only"
requires-python = ">=3.11"
authors = [{ name = "Stefanie Jane", email = "stef@hyperbliss.tech" }]
keywords = ["razer", "chroma", "rgb", "keyboard", "mouse", "linux"]
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: End Users/Desktop",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
"Topic :: System :: Hardware :: Hardware Drivers",
]
dependencies = [
"argcomplete",
"coloraide>=4.0",
"dbus-fast>=2.0",
"evdev",
"numpy",
"pyudev",
"ruamel.yaml",
"traitlets",
]
[project.optional-dependencies]
gtk = [
"pygobject>=3.50",
]
[project.scripts]
uchroma = "uchroma.client.main:cli_entry"
uchromad = "uchroma.server.server:run_server"
uchroma-gtk = "uchroma.gtk:main"
uchroma-keyconfig = "uchroma.tools.keyconfig:main"
[project.entry-points."uchroma.plugins"]
renderers = "uchroma.fxlib"
[build-system]
requires = ["maturin>=1.7,<2.0"]
build-backend = "maturin"
[tool.maturin]
features = ["pyo3/extension-module"]
python-source = "."
module-name = "uchroma._native"
include = [
"uchroma/**/*.py",
"uchroma/server/data/*.yaml",
"uchroma/gtk/resources/*.css",
]
exclude = [
"**/*.pyx",
"**/*.c",
]
[dependency-groups]
dev = [
"pytest>=8.0",
"pytest-cov>=6.0",
"ruff>=0.9",
"ty>=0.0.1a7",
"pygobject-stubs>=2.16.0",
"maturin>=1.7",
]
# ─────────────────────────────────────────────────────────────────────────────
# Ruff - Linting & Formatting
# ─────────────────────────────────────────────────────────────────────────────
[tool.ruff]
line-length = 100
target-version = "py311"
[tool.ruff.format]
docstring-code-format = true
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"F", # pyflakes
"I", # isort
"UP", # pyupgrade
"B", # flake8-bugbear
"SIM", # flake8-simplify
"RUF", # ruff-specific rules
"C4", # flake8-comprehensions
"PIE", # flake8-pie
"PT", # flake8-pytest-style
"PLC", # pylint conventions
"PLE", # pylint errors
]
ignore = [
"E501", # line too long (handled by formatter)
"E741", # ambiguous variable name
"UP007", # use X | Y for union types (not always desired)
"SIM108", # use ternary (not always clearer)
]
[tool.ruff.lint.isort]
known-first-party = ["uchroma"]
force-single-line = false
combine-as-imports = true
[tool.ruff.lint.per-file-ignores]
"tests/*" = ["PT", "PLC0415"] # pytest style not enforced, imports inside functions OK
# D-Bus files use D-Bus type signatures ('s', 'u', 'as', 'a{sv}') as annotations - not Python types
"**/dbus.py" = ["F821", "F722"]
"**/dbus_*.py" = ["F821", "F722"]
# ─────────────────────────────────────────────────────────────────────────────
# ty - Type Checking
# ─────────────────────────────────────────────────────────────────────────────
[tool.ty.environment]
python-version = "3.11"
[tool.ty.rules]
# Ignore missing stubs for external packages (pyudev, evdev, coloraide, dbus-fast)
unresolved-import = "ignore"
# Traitlets uses dynamic attributes extensively
unresolved-attribute = "ignore"
possibly-missing-attribute = "ignore"
# Gradual adoption - warn on these
possibly-unresolved-reference = "warn"
invalid-type-form = "warn"
# Errors we want to fix
invalid-assignment = "error"
invalid-argument-type = "warn"
invalid-return-type = "warn"
[tool.ty.src]
include = ["uchroma/**/*.py"]
exclude = ["**/build/**", "**/.venv/**"]
# Relax rules for D-Bus files that use D-Bus type signatures as annotations
[[tool.ty.overrides]]
include = ["**/dbus.py", "**/dbus_*.py"]
[tool.ty.overrides.rules]
unresolved-reference = "ignore"
invalid-return-type = "ignore"
invalid-syntax-in-forward-annotation = "ignore"
# ─────────────────────────────────────────────────────────────────────────────
# Pytest
# ─────────────────────────────────────────────────────────────────────────────
[tool.pytest.ini_options]
filterwarnings = [
# traitlets library uses deprecated APIs - not our code
"ignore::DeprecationWarning:traitlets.*",
# AsyncMock can produce unawaited coroutine warnings on GC - mock library quirk
"ignore:coroutine.*was never awaited:RuntimeWarning",
]
# ─────────────────────────────────────────────────────────────────────────────
# Coverage
# ─────────────────────────────────────────────────────────────────────────────
[tool.coverage.run]
source = ["uchroma"]
branch = true
omit = [
"uchroma/gtk/*", # GTK requires display, skip for now
"*/__main__.py",
"*/test_*.py",
]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
"if __name__ == .__main__.:",
"raise NotImplementedError",
"@abstractmethod",
]
show_missing = true
skip_covered = false
precision = 1
[tool.coverage.html]
directory = "htmlcov"