forked from huggingface/transformers
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
114 lines (105 loc) · 5.26 KB
/
pyproject.toml
File metadata and controls
114 lines (105 loc) · 5.26 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
[tool.coverage.run]
source = ["transformers"]
omit = [
"*/convert_*",
"*/__main__.py"
]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"raise",
"except",
"register_parameter"
]
[tool.ruff]
target-version = "py310"
line-length = 119
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"F", # Pyflakes
"I", # isort
"W", # pycodestyle warnings
"UP", # pyupgrade
"FURB", # refurb
"SIM", # flake8-simplify
"S110", # bandit's try-except-pass rule
"C4", # flake8-comprehensions
"RUF013", # Checks for the use of implicit Optional in type annotations when the default parameter value is None.
"PERF102", # Checks for uses of dict.items() that discard either the key or the value when iterating over the dictionary.
"PLC1802", # Checks for len calls on sequences in a boolean test context.
"PLC0208", # Checks for iteration over a set literal where each element in the set is itself a literal value.
"PIE794", # Checks for duplicate field definitions in classes.
]
ignore = [
"E501", # Checks for lines that exceed the specified maximum character length.
"E741", # Checks for the use of the characters 'l', 'O', or 'I' as variable names.
"SIM1", # All SIM1XX rules
"SIM905", # Checks for static str.split calls that can be replaced with list literals.
"UP015", # Checks for redundant open mode arguments.
"UP031", # Checks for printf-style string formatting, and offers to replace it with str.format calls.
]
extend-safe-fixes = [
"UP006", # Checks for the use of generics that can be replaced with standard library variants based on PEP 585.
]
# Ignore import violations in all `__init__.py` files.
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["E402", "F401", "F403", "F811"]
"src/transformers/file_utils.py" = ["F401"]
"src/transformers/utils/dummy_*.py" = ["F401"]
[tool.ruff.lint.isort]
lines-after-imports = 2
known-first-party = ["transformers"]
[tool.ruff.format]
# Like Black, use double quotes for strings.
quote-style = "double"
# Like Black, indent with spaces, rather than tabs.
indent-style = "space"
# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false
# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"
[tool.pytest.ini_options]
addopts = "--doctest-glob='**/*.md'"
doctest_optionflags="NUMBER NORMALIZE_WHITESPACE ELLIPSIS"
markers = [
"flash_attn_3_test: marks tests related to flash attention 3 (deselect with '-m \"not flash_attn_3_test\"')",
"flash_attn_test: marks tests related to flash attention (deselect with '-m \"not flash_attn_test\"')",
"bitsandbytes: select (or deselect with `not`) bitsandbytes integration tests",
"generate: marks tests that use the GenerationTesterMixin",
"is_training_test: marks tests that use the TrainingTesterMixin (deselect with '-m \"not is_training_test\"')",
]
log_cli = 1
log_cli_level = "WARNING"
asyncio_default_fixture_loop_scope = "function"
filterwarnings = [
# The above pytest-asyncio rule emits unnessecary warnings when it's not installed, so skip it here
"ignore:Unknown config option.*asyncio_default_fixture_loop_scope",
# Latest sentencepiece (v0.2.1) triggers those warnings when installed due to its build with afflicted version of swig - skip them
"ignore:builtin type SwigPyPacked has no __module__ attribute:DeprecationWarning",
"ignore:builtin type SwigPyObject has no __module__ attribute:DeprecationWarning",
"ignore:builtin type swigvarlink has no __module__ attribute:DeprecationWarning",
]
env = [
# Avoid any ReadTimeout when making requests to the Hub (default is 10)
# Note: 'D:' means default value from laptop or CI won't be overwritten
"D:HF_HUB_DOWNLOAD_TIMEOUT=60",
]
[tool.ty]
# ty type checker configuration
# Using default settings for comprehensive type checking
[tool.ty.rules]
# Disable specific rules that produce false positives or are too strict for this codebase
invalid-method-override = "ignore" # Parameter name differences are acceptable (e.g., x vs input, new_embeddings vs value)
not-subscriptable = "ignore" # False positives on tensor slicing (e.g., self.position_ids[:, :seq_length])
no-matching-overload = "ignore" # False positives on torch.zeros and similar functions accepting Size/tuple
unsupported-operator = "ignore" # False positives on tuple concatenation with += when properly initialized
unresolved-import = "ignore" # Optional dependencies (mlx, torch_npu, habana_frameworks, etc.) checked at runtime
call-non-callable = "ignore" # Mixin pattern issues where classes are used as both types and callables
unresolved-reference = "ignore" # Forward references with noqa: F821 that ty doesn't respect
invalid-argument-type = "ignore" # Complex type narrowing and union type issues
not-iterable = "ignore" # Complex async/Future type patterns
invalid-return-type = "ignore" # Return type mismatches that would require refactoring
deprecated = "ignore" # Deprecation warnings from dependencies
invalid-assignment = "ignore" # Low-level assignments that are runtime-safe
unused-ignore-comment = "ignore" # Ignore comments that became unnecessary after adding broader per-file-ignores