-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
169 lines (149 loc) · 5.59 KB
/
pyproject.toml
File metadata and controls
169 lines (149 loc) · 5.59 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
[project]
name = "learn-to-code"
description = ""
# readme = "README.md"
license = { text = "MIT" }
authors = [{ name = "Mike Foster" }]
dynamic = ["version"]
requires-python = ">=3.12"
classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Rust",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Topic :: Software Development :: Libraries :: Python Modules",
"Intended Audience :: Developers",
"Natural Language :: English",
]
[project.urls]
# Homepage = ""
# Documentation = ""
# Repository = ""
# Issues = ""
# Changelog = ""
[tool.setuptools.dynamic]
version = { file = "__pyversion__" }
# ===========================
# Build, package
# ===========================
[build-system]
requires = ["setuptools"]
[tool.setuptools.packages.find]
where = ["."]
# ===========================
# Test, lint, documentation
# ===========================
[dependency-groups]
lint = ["ruff"]
typing = [
{include-group = "test"},
"pytype; python_version <= '3.12'",
]
test = [
"ipytest",
"pytest",
"pytest-doctest-mkdocstrings",
"pytest-ipynb2",
]
cov = [
{include-group = "test"},
"pytest-cov",
]
dev = [
"jupyter",
{include-group = "lint"},
{include-group = "typing"},
{include-group = "test"},
{include-group = "cov"},
]
[tool.pytest.ini_options]
xfail_strict = true
addopts = [
"--doctest-modules",
"--doctest-mdcodeblocks",
"--doctest-glob=*.pyi",
"--doctest-glob=*.md",
]
testpaths = ["tests", "learntocode"]
python_files = ["*.py"]
[tool.coverage.run]
branch = true
omit = ["tests/*"]
[tool.coverage.report]
exclude_also = [
"def __repr__",
"if TYPE_CHECKING:",
"except ImportError:",
]
[tool.coverage.html]
show_contexts = true
[tool.pytype]
inputs = ["learntocode"]
[tool.ruff]
line-length = 120
format.skip-magic-trailing-comma = false
format.quote-style = "double"
exclude = [".ipython/**"]
[tool.ruff.lint]
select = ["ALL"]
flake8-pytest-style.fixture-parentheses = false
flake8-pytest-style.parametrize-names-type = "list"
flake8-annotations.mypy-init-return = true
extend-ignore = [
"E701", # One-line ifs are not great, one-liners with suppression are worse
"ERA001", # pytype suppression blocks are identified as commented-out code
"ANN202", # Return type annotation for private functions
"ANN401", # Using Any often enough that supressing individually is pointless
"W291", # Double space at EOL is linebreak in md-docstring
"W292", # Too much typing to add newline at end of each file
"W293", # Whitespace only lines are OK for us
"D401", # First line of docstring should be in imperative mood ("Returns ..." is OK, for example)
"D203", # 1 blank line required before class docstring (No thank you, only after the class docstring)
"D212", # Multi-line docstring summary should start at the first line (We start on new line, D209)
"D215", # Section underline is over-indented (No underlines)
"D400", # First line should end with a period (We allow any punctuation, D415)
"D406", # Section name should end with a newline (We use a colon, D416)
"D407", # Missing dashed underline after section (No underlines)
"D408", # Section underline should be in the line following the section's name (No underlines)
"D409", # Section underline should match the length of its name (No underlines)
"D413", # Missing blank line after last section (Not required)
"TD", # TODOs don't need to include github issue etc. until merging to `main`
"FIX002", # TODOs are fine in general
"ANN201", # Don't need type annotations in learn to code
"D103", # No need for docstrings when learning to code
"S101", # `assert` is OK - we are mixing tests and code for now ...
"INP001", # NBot packaging, so no need for __init__.py
]
extend-select = [
"TD005", # TODOs need a description, even outside of `main`
]
[tool.ruff.lint.per-file-ignores]
# Additional ignores for tests
"**/test_*.py" = [
"INP001", # Missing __init__.py
"ANN", # Missing type annotations
"S101", # Use of `assert`
"PLR2004", # Magic number comparisons are OK in tests
"D1", # Don't REQUIRE docstrings for tests - but they are nice
"N802", # Test case names may include caps (e.g. when referring to a class under test)
]
"**/conftest.py" = [
"D100", # conftest.py doesn't need a top-level docstring
"INP001", # Missing __init__.py
"S101", # Use of `assert`
"PLR2004", # Magic number comparisons are OK in tests
]
"**/__init__.py" = [
"F401", # Unused imports are fine: using __init__.py to expose them with implicit __ALL__
]
"tests/assets/expected.pyi" = [
"ANN001", "ANN201", # Cannot automatically generate type annotations
]
"**/*.ipynb" = [
"ANN", # Missing type annotations
"D1", # Don't REQUIRE docstrings - but lint them if they exist
"S101", # Use of `assert`
"T201", # Allow `print` in Jupyter notebooks (although `display` is better)
"PLR2004", # Magic numbers are OK in workbooks
"F811", # OK to reassign variables (across cells) in notebooks
]