-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
124 lines (116 loc) · 4.57 KB
/
pyproject.toml
File metadata and controls
124 lines (116 loc) · 4.57 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
[project]
name = "learning-notes"
version = "0.1.0"
requires-python = ">=3.10"
authors = [{ name = "Cyber-Syntax" }]
readme = { file = "README.md", content-type = "text/markdown" }
[dependency-groups]
dev = [
"mkdocs",
"mkdocs-git-authors-plugin>=0.10.0",
"mkdocs-git-committers-plugin-2>=2.5.0",
"mkdocs-git-revision-date-localized-plugin>=1.5.2",
"mkdocs-material>=9.7.6",
"mkdocstrings[python]>=1.0.4",
"pymdown-extensions>=10.21.3",
]
lint = ["ruff"]
[tool.ruff]
line-length = 79
indent-width = 4
include = ["pyproject.toml", "*.py", "scripts/**/*.py", "tests/**/*.py"]
[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"
# Enable auto-formatting of code examples in docstrings. Markdown,
# reStructuredText code/literal blocks and doctests are all supported.
#
# This is currently disabled by default, but it is planned for this
# to be opt-out in the future.
docstring-code-format = false
# set the line length limit used when formatting code snippets in
# docstrings.
#
# This only has an effect when the `docstring-code-format` setting is
# enabled.
docstring-code-line-length = "dynamic"
[tool.ruff.lint]
select = ["ALL"]
# TID252: Prefer absolute imports over relative imports from parent modules
# Enabled to auto-apply fixes for this rule
extend-safe-fixes = ["TID252"]
ignore = [
"ERA001", # comments expected in learning modules
"T201", # print() is expected in learning modules
# only relevant if you run a script with `python -1`,
# which seems unlikely for any of the scripts in this repo
"B010",
# Ignoring E202 due to https://github.com/PyCQA/pycodestyle/issues/373.
"E202",
# Incompatible pydocstyle rules: ignoring D202 and D213
"D202",
"D212",
# Incompatible with google style docstrings
"D203",
"D211",
"D213",
# Incompatible with ruff formatter rules
"W191", # tab-indentation
"E111", # indentation-with-invalid-multiple
"E114", # indentation-with-invalid-multiple-comment
"E117", # over-indented
"D206", # docstring-tab-indentation
"D300", # triple-single-quotes
"Q000", # bad-quotes-inline-string
"Q001", # bad-quotes-multiline-string
"Q002", # bad-quotes-docstring
"Q003", # avoidable-escaped-quote
"COM812", # missing-trailing-comma
"COM819", # prohibited-trailing-comma
"CPY001", # Missing copyright notice at top of file
"ISC001", # multi-line-implicit-string-concatenation (if used without ISC002 and flake8-implicit-str-concat.allow-multiline = false)
"TD002", # Missing author in TODO `# TODO(<author_name>): ...`
"TD003", # missing-todo-link
# Leave it to the formatter to split long lines and
# the judgement of all of us.
# "E501"
]
# incompatible with the formatter's treatment of import statements
[tool.ruff.lint.isort]
force-single-line = false
force-wrap-aliases = false
split-on-trailing-comma = false
# The number of blank lines to place after imports. Use -1 for automatic determination.
# When using the formatter, only the values -1, 1, and 2 are compatible because it enforces at least one empty and at most two empty lines after imports.
lines-after-imports = -1
# The number of lines to place between "direct" and import from imports.
# When using the formatter, only the values 0 and 1 are compatible because it preserves up to one empty line after imports in nested blocks.
lines-between-types = 0
[tool.ruff.lint.per-file-ignores]
"scripts/*.py" = [
"INP001", # Scripts are standalone, not part of a package
"T201", # print() is expected in CLI scripts
]
"test_*.py" = [
"S101", # asserts allowed in tests...
"ARG", # Unused function args -> fixtures nevertheless are functionally relevant...
"FBT", # Don't care about booleans as positional arguments in tests, e.g. via @pytest.mark.parametrize()
"PLR2004", # Magic value used in comparison, ...
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
"ANN", # No type annotations required in tests
"TRY003", # Long exception messages are fine in tests
"EM101", # String literals in exceptions are fine in tests
"S108", # Insecure temp file paths are fine in tests (not real I/O)
"SLF001", # Private member access is necessary for unit testing internal methods
]
[tool.ruff.lint.pydocstyle]
# Use Google-style docstrings.
convention = "google"
[tool.ruff.lint.pycodestyle]
max-line-length = 79