-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
128 lines (118 loc) · 3.61 KB
/
Copy pathpyproject.toml
File metadata and controls
128 lines (118 loc) · 3.61 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
[build-system]
requires = ["setuptools>=68", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "deflect"
version = "0.1.0"
description = "DEFLECT: activation-space parameter-efficient adaptation for transformers, mirroring PEFT's API."
authors = [{ name = "boschet" }]
license = "Apache-2.0"
requires-python = ">=3.12"
keywords = ["peft", "deflect", "spectral adaptation", "transformer", "parameter-efficient"]
classifiers = [
"Development Status :: 3 - Alpha",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.12",
]
dependencies = [
"torch",
]
[project.optional-dependencies]
# Used at save/load time for the safetensors weight format. ``deflect`` falls
# back to ``torch.save`` (.bin) when this is missing.
safetensors = [
"safetensors",
"numpy",
]
dev = [
"deflect[safetensors]",
"mypy",
"pre-commit",
"pyright",
"pytest",
"pytest-cov",
"pytest-xdist",
"ruff",
]
[tool.setuptools]
package-dir = { "" = "src" }
[tool.setuptools.packages.find]
where = ["src"]
include = ["deflect*"]
# Tooling — same conventions as mlcore
[tool.ruff]
line-length = 120
target-version = "py312"
[tool.ruff.lint]
select = [
"A", # flake8-builtins
"ARG", # flake8-unused-arguments
"B", # flake8-bugbear
"BLE", # flake8-blind-except
"C4", # flake8-comprehensions
"DTZ", # flake8-datetimez
"E", "W", # pycodestyle
"EM", # flake8-errmsg
"ERA", # eradicate (commented-out code)
"F", # Pyflakes
"FA", # flake8-future-annotations
"FLY", # flynt (f-string conversion)
"FURB", # refurb (modern idioms)
"I", # isort
"ICN", # flake8-import-conventions
"ISC", # flake8-implicit-str-concat
"LOG", # flake8-logging
"N", # pep8-naming
"NPY", # NumPy-specific
"PERF", # Perflint
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PL", # Pylint
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
"RET", # flake8-return
"RSE", # flake8-raise
"RUF", # Ruff-specific
"S", # flake8-bandit (security)
"SIM", # flake8-simplify
"SLOT", # flake8-slots
"T20", # flake8-print
"TC", # flake8-type-checking
"TD", # flake8-todos
"TID", # flake8-tidy-imports
"TRY", # tryceratops
"UP", # pyupgrade
]
ignore = [
"PLR2004", # magic values - common in ML
"PLR0912", # too many branches - complex ML logic
"PLR0915", # too many statements - complex ML logic
"PLW2901", # loop variable overwritten - intentional
"N806", # non-lowercase vars (B, C, H, W) - ML convention
"PLR0913", # too many arguments - ML models need many params
"PTH123", # builtin-open - not always worth changing
"RUF001", # ambiguous unicode (× etc.) in strings - UTF-8 used intentionally
"RUF002", # ambiguous unicode in docstrings - UTF-8 used intentionally
"RUF003", # ambiguous unicode - false positives in comments
"RET504", # unnecessary assignment before return - clearer code
"SIM108", # ternary operator - if/else often clearer with comments
]
[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = [
"S101", # assert allowed in tests
"ARG", # unused fixture arguments
"PLR2004", # magic values in tests
]
[tool.pytest.ini_options]
minversion = "7.0"
addopts = "-q --durations=10 -ra"
testpaths = ["tests"]
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"integration: marks tests as integration tests",
]
[tool.mypy]
python_version = "3.12"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true