-
-
Notifications
You must be signed in to change notification settings - Fork 317
/
pyproject.toml
156 lines (139 loc) · 3.49 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# --- Project ----------------------------------------------------------------------------
[project]
name = "scripts"
version = "0.0.0"
description = "Scripts for managing the ReactPy repository"
# --- Hatch ----------------------------------------------------------------------------
[tool.hatch.envs.default]
detached = true
dependencies = [
"invoke",
# lint
"black==24.1.1", # Pin lint tools we don't control to avoid breaking changes
"ruff==0.0.278", # Pin lint tools we don't control to avoid breaking changes
"toml",
"flake8==7.0.0", # Pin lint tools we don't control to avoid breaking changes
"flake8-pyproject",
# types
"mypy",
"types-toml",
# publish
"semver >=2, <3",
"twine",
"pre-commit",
]
[tool.hatch.envs.default.scripts]
publish = "invoke publish {args}"
docs = "invoke docs {args}"
check = ["lint-py", "lint-js", "test-py", "test-js", "test-docs"]
lint = ["lint-py", "lint-js"]
lint-py = "invoke lint-py {args}"
lint-js = "invoke lint-js {args}"
test = ["test-py", "test-js", "test-docs"]
test-py = "invoke test-py {args}"
test-js = "invoke test-js"
test-docs = "invoke test-docs"
# --- Black ----------------------------------------------------------------------------
[tool.black]
target-version = ["py39"]
line-length = 88
# --- MyPy -----------------------------------------------------------------------------
[tool.mypy]
ignore_missing_imports = true
warn_unused_configs = true
warn_redundant_casts = true
warn_unused_ignores = true
# --- Flake8 ---------------------------------------------------------------------------
[tool.flake8]
select = ["RPY"] # only need to check with reactpy-flake8
exclude = ["**/node_modules/*", ".eggs/*", ".tox/*", "**/venv/*"]
# --- Ruff -----------------------------------------------------------------------------
[tool.ruff]
target-version = "py39"
line-length = 88
select = [
"A",
"ARG",
"B",
"C",
"DTZ",
"E",
# error message linting is overkill
# "EM",
"F",
# TODO: turn this on later
# "FBT",
"I",
"ICN",
"ISC",
"N",
"PLC",
"PLE",
"PLR",
"PLW",
"Q",
"RUF",
"S",
"T",
"TID",
"UP",
"W",
"YTT",
]
ignore = [
# TODO: turn this on later
"N802",
"N806", # allow TitleCase functions/variables
# We're not any cryptography
"S311",
# For loop variable re-assignment seems like an uncommon mistake
"PLW2901",
# Let Black deal with line-length
"E501",
# Allow args/attrs to shadow built-ins
"A002",
"A003",
# Allow unused args (useful for documenting what the parameter is for later)
"ARG001",
"ARG002",
"ARG005",
# Allow non-abstract empty methods in abstract base classes
"B027",
# Allow boolean positional values in function calls, like `dict.get(... True)`
"FBT003",
# If we're making an explicit comparison to a falsy value it was probably intentional
"PLC1901",
# Ignore checks for possible passwords
"S105",
"S106",
"S107",
# Ignore complexity
"C901",
"PLR0911",
"PLR0912",
"PLR0913",
"PLR0915",
]
unfixable = [
# Don't touch unused imports
"F401",
]
[tool.ruff.isort]
known-first-party = ["reactpy"]
[tool.ruff.flake8-tidy-imports]
ban-relative-imports = "all"
[tool.ruff.per-file-ignores]
# Tests can use magic values, assertions, and relative imports
"**/tests/**/*" = ["PLR2004", "S101", "TID252"]
"docs/**/*.py" = [
# Examples require some extra setup before import
"E402",
# Allow exec
"S102",
# Allow print
"T201",
]
"scripts/**/*.py" = [
# Allow print
"T201",
]