-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
388 lines (346 loc) · 9.14 KB
/
pyproject.toml
File metadata and controls
388 lines (346 loc) · 9.14 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
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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
[build-system]
requires = ["poetry-core>=1.0.0", "setuptools", "tomli", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
build-backend = "poetry_dynamic_versioning.backend"
[tool.poetry]
name = "python-newtype"
version = "0.1.6"
homepage = "https://github.com/jymchng/python-newtype-dev"
repository = "https://github.com/jymchng/python-newtype-dev"
license = "MIT"
documentation = "https://py-nt.asyncmove.com"
description = "A Python library for creating and managing new types with enhanced type safety and flexibility."
authors = ["Jim Chng <jimchng@outlook.com>"]
readme = "README.md"
# tuple index out of range error occurs if include = "."
packages = [{ include = "newtype" }]
include = [
{ path = "newtype/*.so" },
{ path = "newtype/*.pyd" },
{ path = "newtype/extensions/*.so" },
{ path = "newtype/extensions/*.pyd" },
{ path = "newtype/*" },
{ path = "newtype/extensions/**" }, # need to include this for the packager to include it in the distribution
]
exclude = [
{ path = "tests/*"},
{ path = "examples/*"},
{ path = "scripts/*"},
{ path = "build/*"},
{ path = "build-dev/*"},
{ path = "dist/*"},
{ path = "docs/*"},
]
[tool.poetry.build]
script = "build.py"
generate-setup-file = false
[tool.poetry.scripts]
generate-ref-docs = "scripts.generate_ref_docs:main"
[tool.poetry.dependencies]
python = ">=3.8,<4.0"
[tool.poetry.group.docs.dependencies]
mkdocs = "*"
mkdocs-material = "*"
mkdocstrings = {extras = ["python"], version = "*"}
[tool.poetry.group.dev.dependencies]
pre_commit = "*"
ruff = "*"
mypy = "*"
isort = "*"
creosote = "*"
pre-commit = "^3"
tomli = "^2"
poetry-dynamic-versioning = "*"
pytest = "*"
pytest-cov = "*"
pytest-asyncio = "*"
pytest-mock = "*"
black = "*"
numpy = [
{ version = ">=2.1.3", python = ">=3.12" },
{ version = ">=1.24.0,<1.25.0", python = "<3.12" }
]
pandas = [
{ version = ">=2.2.3", python = ">=3.12" },
{ version = ">=2.0.0,<2.1.0", python = "<3.12" }
]
[tool.poetry.group.profiling]
optional = true
[tool.poetry.group.profiling.dependencies]
memray = { version = "^1.11.0", markers = "sys_platform != 'win32'" }
pytest-memray = { version = "*", markers = "sys_platform != 'win32'" }
[tool.poetry.group.debug]
optional = true
[tool.poetry.group.debug.dependencies]
line_profiler = "*"
[tool.poetry.group.tests.dependencies]
coverage = { extras = ["toml"], version = "*" }
pytest = "*"
pytest-cov = "*"
pytest-mock = "*"
pytest-asyncio = "*"
pydantic = "*"
[tool.coverage.run]
branch = true
omit = ["tests/*"]
[tool.coverage.report]
exclude_lines = [
# Have to re-enable the standard pragma
"pragma: no cover",
# Don't complain about missing debug-only code:
"def __repr__",
"if self.debug:",
"if debug:",
"if DEBUG:",
# Don't complain if tests don't hit defensive assertion code:
"raise AssertionError",
"raise NotImplementedError",
# Don't complain if non-runnable code isn't run:
"if 0:",
"if False:",
"if __name__ == .__main__.:",
]
[tool.pyright]
venvPath = "."
venv = ".venv"
extraPaths = ["tests/"]
include = ["newtype"]
exclude = ["**/__pycache__", "build_helpers/*.py"]
# ignore = ["freqtrade/vendor/**"]
[tool.ruff]
line-length = 100
extend-exclude = [".env", ".venv"]
target-version = "py38"
exclude = [
"migrations",
"__pycache__",
"manage.py",
"settings.py",
"env",
".env",
"venv",
".venv",
"build.py",
"scripts/",
"tests/",
"examples/email_str.py",
"examples/bounded_wrapped_ints.py",
"examples/newtype_enums.py",
"examples/mutable.py",
"examples/pydantic-compat.py",
"examples/newtype_enums_int.py",
]
[tool.ruff.format]
docstring-code-format = true
[tool.ruff.lint]
select = [
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"D", # pydocstyle
"E", # Error
"F", # pyflakes
"I", # isort
"N", # pep8-naming
"PGH", # pygrep-hooks
"PTH", # flake8-use-pathlib
"Q", # flake8-quotes
"S", # bandit
"SIM", # flake8-simplify
"TRY", # tryceratops
"UP", # pyupgrade
"W", # Warning
"YTT", # flake8-2020
]
ignore = [
"B905", # zip strict=True; remove once python <3.10 support is dropped.
"D100",
"D101",
"D102",
"D103",
"D104",
"D105",
"D106",
"D107",
"D200",
"D401",
"E402",
"E501",
"F401",
"TRY003", # Avoid specifying messages outside exception class; overly strict, especially for ValueError
]
# Exclude UP036 as it's causing the "exit if < 3.9" to fail.
extend-select = [
"C90", # mccabe
# "B", # bugbear
# "N", # pep8-naming
"F", # pyflakes
"E", # pycodestyle
"W", # pycodestyle
"UP", # pyupgrade
"I", # isort
"A", # flake8-builtins
"TID", # flake8-tidy-imports
# "EXE", # flake8-executable
# "C4", # flake8-comprehensions
"YTT", # flake8-2020
"S", # flake8-bandit
# "DTZ", # flake8-datetimez
# "RSE", # flake8-raise
# "TCH", # flake8-type-checking
"PTH", # flake8-use-pathlib
# "RUF", # ruff
"ASYNC", # flake8-async
"NPY", # numpy
]
extend-ignore = [
"E241", # Multiple spaces after comma
"E272", # Multiple spaces before keyword
"E221", # Multiple spaces before operator
"B007", # Loop control variable not used
"S603", # `subprocess` call: check for execution of untrusted input
"S607", # Starting a process with a partial executable path
"S608", # Possible SQL injection vector through string-based query construction
"NPY002", # Numpy legacy random generator
]
[tool.ruff.lint.isort]
lines-after-imports = 2
known-first-party = ["freqtrade_client"]
[tool.ruff.lint.flake8-bugbear]
# Allow default arguments like, e.g., `data: List[str] = fastapi.Query(None)`.
extend-immutable-calls = [
"chr",
"typer.Argument",
"typer.Option",
"fastapi.Depends",
"fastapi.Query",
]
[tool.ruff.lint.pydocstyle]
convention = "numpy"
[tool.ruff.lint.mccabe]
max-complexity = 12
[tool.ruff.lint.per-file-ignores]
"tests/*.py" = [
"D100",
"D101",
"D102",
"D103",
"D104",
"D105",
"D106",
"D107",
"S101", # use of "assert"
"S102", # use of "exec"
"S106", # possible hardcoded password.
"PGH001", # use of "eval"
]
"freqtrade/freqai/**/*.py" = [
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
]
"tests/**/*.py" = [
"S101", # allow assert in tests
"S104", # Possible binding to all interfaces
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
"S105", # Possible hardcoded password assigned to: "secret"
"S106", # Possible hardcoded password assigned to argument: "token_type"
"S110", # `try`-`except`-`pass` detected, consider logging the exception
]
"ft_client/test_client/**/*.py" = [
"S101", # allow assert in tests
]
[tool.ruff.lint.pep8-naming]
staticmethod-decorators = ["pydantic.validator", "pydantic.root_validator"]
[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
addopts = "-vv --tb=short"
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
log_format = "%(asctime)s %(levelname)s %(message)s"
log_date_format = "%Y-%m-%d %H:%M:%S"
[tool.codespell]
skip = 'poetry.lock,sources/*.c,sources/*.pyx,sources/*.pxd'
ignore-words-list = "coo,fo,strat,zar,selectin,nam,crate"
[tool.creosote]
venvs = [".venv"]
paths = ["newtype"]
deps-file = "pyproject.toml"
sections = ["tool.poetry.dependencies"]
exclude-deps = ["typing-extensions"]
[tool.setuptools]
include-package-data = true
zip-safe = false
[tool.setuptools.packages.find]
where = ["."]
include = ["newtype*"]
exclude = ["tests", "tests.*"]
namespaces = true
[tool.setuptools.dynamic]
version = { attr = "newtype.__version__" }
[tool.black]
line-length = 100
exclude = '''
(
/(
\.eggs # exclude a few common directories in the
| \.git # root of the project
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
)/
# Exclude vendor directory
| vendor
)
'''
[tool.isort]
line_length = 100
profile = "google"
# multi_line_output=3
lines_after_imports = 2
skip_glob = ["**/.env*", "**/env/*", "**/.venv/*", "**/docs/*"]
# known_first_party = ["freqtrade_client"]
[tool.mypy]
ignore_missing_imports = true
namespace_packages = false
warn_unused_ignores = true
exclude = [
'build.py',
'tests/*',
'docs/*',
'scripts/*',
'/*.sh',
'newtype/*.pyi',
]
plugins = ["newtype.mypy_plugin"]
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = true
no_implicit_optional = true
warn_redundant_casts = true
warn_return_any = true
warn_unreachable = true
strict_optional = true
[[tool.mypy.overrides]]
module = "tests.*"
ignore_errors = true
[tool.flake8]
# Default from https://flake8.pycqa.org/en/latest/user/options.html#cmdoption-flake8-ignore
# minus E226
ignore = ["E121", "E123", "E126", "E24", "E203", "E704", "W503", "W504"]
max-line-length = 100
max-complexity = 12
exclude = [
".git",
"__pycache__",
".eggs",
"user_data",
".venv",
".env",
"build.py",
"docs/*.py",
"examples/*.py",
]