-
Notifications
You must be signed in to change notification settings - Fork 16
/
pyproject.toml
229 lines (201 loc) · 6.21 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
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
[build-system]
requires = [
"setuptools >= 68.1.0, <= 72.1.0", # https://github.com/pypa/distutils/issues/283
"wheel >= 0.37.0",
"cython >= 3.0.0",
"versioningit >= 2.1.0"
]
build-backend = "setuptools.build_meta"
[project]
name = "srctools"
requires-python = ">=3.8"
dynamic = ["version"]
urls = {source="https://github.com/TeamSpen210/srctools"}
description = "Modules for working with Valve's Source Engine file formats."
readme = "README.md"
keywords = ["Valve", "Source Engine"]
authors = [
{name="TeamSpen210", email="[email protected]"}
]
license = {text = "MIT"}
classifiers = [
"Development Status :: 5 - Production/Stable",
"Framework :: Pytest",
"Framework :: tox",
"License :: OSI Approved :: MIT License",
"Programming Language :: Cython",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Games/Entertainment",
"Topic :: Multimedia :: Graphics :: 3D Modeling",
"Topic :: Scientific/Engineering :: Mathematics",
]
dependencies=[
"attrs >= 21.2.0",
"typing_extensions >= 4.12.0",
"importlib_resources >= 5.8.0",
"exceptiongroup >= 1.2.0",
"useful_types >= 0.1.0"
]
[optional-dependencies]
# VTF support.
wx = ["wxPython"]
test = [
"pytest",
"pytest-datadir",
"pytest-regressions",
]
[project.scripts]
src_dump_parms = "srctools.scripts.dump_parms:main"
src_diff = "srctools.scripts.diff:main"
src_find_deps = "srctools.scripts.find_deps:main"
src_build_scenes = "srctools.scripts.build_scenes_image:main"
src_mdl_mkdir = "srctools.scripts.make_model_folders:main"
src_collapse_manifest = "srctools.scripts.collapse_manifest:main"
[project.entry-points]
pyinstaller40 = {hook-dirs="srctools._pyinstaller:get_hook_dirs"}
[tool.setuptools.packages.find]
where = ["src"]
include = ["srctools*"]
[tool.versioningit.vcs]
default-tag = "v0.0.0"
[tool.versioningit.tag2version]
rmprefix = "postcompiler_" # For old tags
[tool.versioningit.format]
distance = "{base_version}.dev_{distance}+{rev}"
dirty = "{base_version}+dirty_{build_date:%Y.%m.%d}"
distance-dirty = "{base_version}.dev{distance}+{rev}.dirty.{build_date:%Y.%m.%d}"
[tool.versioningit.write]
method = "basic"
file = "src/srctools/_version.py"
[tool.cibuildwheel]
# Ensure both 32-bit and 64-bit are built
archs = "auto"
# Skip building:
skip = [
"{cp,pp}{36,37}-*", # < Python 3.8
"*linux_i686", # 32-bit linux (all)
"{cp,pp}{39,310,311,312,313,314,315,316}-win32", # 32-bit on 3.9+
]
# After building, run tests to check it works.
# Disable assertion rewriting since that sometimes has issues on PyPy.
before-test = "pip install -r test-requirements.txt"
test-command = 'pytest --assert=plain -m "not slow" {project}/tests'
[tool.pytest.ini_options]
markers = [
"slow: marks especially-slow tests, to skip when building wheels",
]
[tool.pyright]
include = [
"src/srctools/",
"type_tests/",
]
exclude = [
"**/__pycache__"
]
stubPath = "src/" # Use our module for stubs.
# We want to do conversions when setting.
reportPropertyTypeMismatch = false
pythonVersion = "3.8"
# We omit PIL in the tools CI, not necessary.
reportMissingModuleSource = false
[tool.mypy]
warn_unused_ignores = true
warn_redundant_casts = true
warn_return_any = true
warn_no_return = true
disallow_incomplete_defs = true
disallow_untyped_defs = true
disallow_untyped_decorators = true
disallow_untyped_calls = true
strict_optional = true
check_untyped_defs = true
show_error_codes = true
strict = true
enable_error_code = [
'mutable-override',
'narrowed-type-not-subtype',
'redundant-expr',
'redundant-self',
'truthy-bool',
'truthy-iterable',
'unimported-reveal',
'unreachable',
'unused-awaitable',
]
[tool.isort]
sections=["FUTURE", "TYPING", "FRAMEWORK", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
known_framework = []
extra_standard_library = ["importlib_resources"]
known_typing = ["typing", "typing_extensions"]
no_lines_before = ["TYPING", "FRAMEWORK", "STDLIB"]
multi_line_output = 5 # hanging grid grouped
# Wrap to 90 long, but only if it exceeds 100 chars.
line_length = 100
wrap_length = 90
lines_after_imports = 2
use_parentheses = true
order_by_type = true
include_trailing_comma = true
from_first = true
combine_as_imports = true
src_paths = ["src", "tests", "type_tests"]
[tool.ruff]
line-length = 127
[tool.ruff.lint]
select = [
"UP", "F", "C4", "ANN", "B", "PIE", "RUF",
"PLC", "PLE", "PLW", # Pylint.
"TC005", # Empty type-checking block.
]
allowed-confusables = [
"×", # Multiplication sign
]
extend-ignore = [
# Allow *-imports.
"F403",
# name may be undefined, or defined from star imports: module
"F405",
"F841", # Unused local var, detects tuple unpacks.
# Flake8-annotations.
# Allow typing.Any
"ANN401",
# PyLint:
"PLC0414", # import x as x is used for type checking.
"PLC0415", # We use non-toplevel imports to fetch our databases after initialising the classes.
"PLC1901", # Allow compare to empty string, can be more clear.
"PLE1205", # Too many arguments for logging, doesn't handle our format
"PLW0603", # Allow use of global statement.
"PLW2901", # Allow redefining loop var inside the loop.
# Ruff:
"RUF100", # Sometimes use # noqa for other linters
"RUF022", # All not sorted
"RUF023", # Slots not sorted
# Flake8-bugbear:
# Loop control var not used, triggers on unpackings.
"B007",
# Stacklevel parameter required for warnings.warn() - doesn't detect positional args.
"B028",
# Pycodestyle, when out of preview:
"E221", # Allow multiple spaces before operators if we want to align
"E226", # Allow no spaces like "1+1", sometimes useful to indicate precedence
# Pyupgrade:
# Keep using typing types even with __future__.annotations.
"UP006", "UP007",
# Flake8-pie:
# Prefer to use pass in empty functions, even if docstring is present
"PIE790",
# Allow aliases for enum values, used often.
"PIE796",
]
[tool.ruff.lint.flake8-bugbear]
extend-immutable-calls = [
"srctools.math.FrozenVec", "srctools.math.FrozenAngle", "srctools.math.FrozenMatrix",
"typing.cast", "srctools.logger.get_logger",
]