forked from TeamSpen210/srctools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
211 lines (185 loc) · 5.65 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
[build-system]
requires = [
"setuptools >= 68.1.0",
"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.6.2",
"importlib_resources >= 5.8.0",
"useful_types >= 0.1.0",
]
[optional-dependencies]
# VTF support.
wx = ["wxPython"]
test = [
"pytest",
"pytest-datadir",
"pytest-regressions",
]
[project.scripts]
srctools_dump_parms = "srctools.scripts.dump_parms:main"
srctools_diff = "srctools.scripts.diff:main"
srctools_find_deps = "srctools.scripts.find_deps: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
"*-{many,musl}linux_i686", # 32-bit linux (all)
"pp*_x86_64", # Pypy 32-bit
"{cp,pp}{39,310,311,312,313,314,315,316}-win32", # 32-bit on 3.9+
]
# After building, run tests to check it works.
before-test = "pip install -r test-requirements.txt"
test-command = 'pytest -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/"
]
exclude = [
"**/__pycache__"
]
stubPath = "src/" # Use our module for stubs.
# We want to do conversions when setting.
reportPropertyTypeMismatch = false
pythonVersion = "3.8"
strictParameterNoneValue = 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
[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
select = [
"E", "UP", "F", "C4", "ANN", "B", "PIE", "RUF",
"PLC", "PLE", "PLW", # Pylint.
"TCH005", # Empty type-checking block.
]
allowed-confusables = [
"×", # Multiplication sign
]
extend-ignore = [
# Allow module level import later in the file.
"E402",
# Allow *-imports.
"F403",
# name may be undefined, or defined from star imports: module
"F405",
# Flake8-annotations.
# Type annotations for self & cls are not important.
"ANN101",
"ANN102",
# 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
# 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.flake8-bugbear]
extend-immutable-calls = [
"srctools.math.FrozenVec", "srctools.math.FrozenAngle", "srctools.math.FrozenMatrix",
"typing.cast", "srctools.logger.get_logger",
]