-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpyproject.toml
More file actions
264 lines (218 loc) · 7.47 KB
/
Copy pathpyproject.toml
File metadata and controls
264 lines (218 loc) · 7.47 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
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "sample-project-python"
version = "1.4.0"
description = "Sample Python Project"
license = "MIT"
authors = [{name = "Dillon Stadther"}, ]
readme = "README.md"
requires-python = ">=3.9"
dependencies = []
[project.urls]
Documentation = "https://dlstadther.github.io/sample-project-python"
Repository = "https://github.com/dlstadther/sample-project-python"
[project.optional-dependencies]
df = [
"pandas >= 2.0.0",
]
[dependency-groups]
dev = [
"ghp-import >=2.1.0,<3",
"interrogate >=1.7.0,<2",
"mkdocstrings-python >=1.16.0,<3",
"nox >=2024.4.15,<2025",
"prek >=0.1.0,<1",
"pyrefly >=1.2.0,<2",
"pyscn >=1.31.2,<2",
"pytest >=8.3.2,<9",
"pytest-cov >=5.0.0,<6",
"python-semantic-release >=10.0.0,<11",
"ruff >=0.6.2,<1",
"sqlfluff >=3.1.1,<4",
"zensical >=0.0.60,<0.1 ; python_version >= '3.10'",
]
[tool.hatch.build]
packages = ["src/sample"]
#############
# Interrogate
#############
[tool.interrogate]
fail-under = 100
ignore-init-method = true
verbose = 1
exclude = ["tests", "docs", "noxfile.py", ".nox", ".venv", "dist", "build", ".mypy_cache", ".pytest_cache", ".ruff_cache"]
#######
# Pyscn
#######
# Code quality gate: complexity, dead code, clones, coupling, architecture.
# This only sets what deviates from pyscn's own defaults (or is left as an
# explicit toggle). Full option reference: https://docs.codescan.dev/configuration/reference/
[tool.pyscn.output]
format = "text" # Default output format: text, json, yaml, csv, html
show_details = false # Show detailed breakdown by default
sort_by = "complexity" # Default sort: name, complexity, risk
min_complexity = 1 # Minimum complexity to report
directory = "" # Output directory for reports (empty = default .pyscn/reports/, gitignored)
[tool.pyscn.complexity]
enabled = true # Enable complexity analysis
low_threshold = 9 # Functions with complexity ≤ 9 are low risk
medium_threshold = 19 # Functions with complexity 10-19 are medium risk
# Functions with complexity ≥ 20 are high risk
max_complexity = 0 # Maximum allowed complexity (0 = no limit). Must be 0 or > medium_threshold;
# the CI gate's own limit (10) is set independently via `pyscn check --max-complexity`
report_unchanged = true # Report functions with complexity = 1
[tool.pyscn.dead_code]
enabled = true # Enable dead code detection; see reference link above for tunable options
[tool.pyscn.cbo]
enabled = true # Enable class coupling (CBO) analysis; see reference link above for tunable options
[tool.pyscn.architecture]
enabled = false # This project is a flat single-package library, not a layered app
##########
# Coverage
##########
[tool.coverage.run]
omit = [".*", "*/site-packages/*"]
src = ["src"]
[tool.coverage.report]
fail_under = 70
show_missing = true
#########
# Pyrefly
#########
[tool.pyrefly]
project-includes = ["src", "tests", "noxfile.py"]
######
# Ruff
######
[tool.ruff]
line-length = 160
# auto-apply changes
#fix = true
#exit-non-zero-on-fix = true
[tool.ruff.lint]
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
select = [
"B", # flake8-bugbear
"C", # flake8-comprehensions
"E", # pycodestyle errors
"F", # pyflakes
"W", # pycodestyle warnings
]
# check out their meaning here
# https://flake8.pycqa.org/en/latest/user/error-codes.html
# https://www.flake8rules.com/
ignore = [
"E402", # Module level import not at top of file
"E501", # Line too long (82 > 79 characters)
# prefer list(), dict(), etc.
"C408", # Rewrite as a literal
]
########
# Pytest
########
[tool.pytest.ini_options]
addopts = "--cov=src --strict-markers"
markers = [
"df: marks tests as requiring the \"df\" extra install (deselect with '-m \"not df\"')",
]
pythonpath = [
"src"
]
##################
# Semantic Release
##################
[tool.semantic_release]
build_command = """\
uv lock --upgrade-package "$PACKAGE_NAME"
git add uv.lock
uv build
"""
commit_message = """\
chore: release v{version}
Automatically generated by python-semantic-release
"""
commit_parser = "conventional"
version_toml = [
# "file:variable:[format_type]"
"pyproject.toml:project.version:nf",
]
version_variables = [
# "file:variable:format_type"
"src/sample/__init__.py:__version__:nf",
]
[tool.semantic_release.changelog]
exclude_commit_patterns = [
"^Merge",
"^Revert",
]
[tool.semantic_release.branches.main]
match = "(main|master)"
prerelease_token = ""
prerelease = false
# TESTING: Uncomment the section below to allow releases from the current branch
# This makes it easy to test semantic release on any branch.
# To disable, comment out this entire section.
[tool.semantic_release.branches.test]
match = ".*" # Matches any branch name
prerelease_token = "rc"
prerelease = true
[tool.semantic_release.branches.pre_release]
match = "(pre-.*|beta.*|alpha.*)"
prerelease_token = "rc"
prerelease = true
##########
# Sqlfluff
##########
[tool.sqlfluff.core]
# Supported dialects https://docs.sqlfluff.com/en/stable/dialects.html
dialect = "postgres"
templater = "jinja"
sql_file_exts = ".sql,.sql.j2,.dml,.ddl"
# Comma separated list of rules to exclude, or None
# See https://docs.sqlfluff.com/en/stable/configuration.html#enabling-and-disabling-rules
# AM04 (ambiguous.column_count) and ST06 (structure.column_order) are
# two of the more controversial rules included to illustrate usage.
#exclude_rules =
# The standard max_line_length is 80 in line with the convention of
# other tools and several style guides. Many projects however prefer
# something a little longer.
# Set to zero or negative to disable checks.
max_line_length = 120
[tool.sqlfluff.indentation]
indented_ctes = true
indented_joins = false
indented_using_on = true
template_blocks_indent = false
[tool.sqlfluff.templater]
unwrap_wrapped_queries = true
# The default configuration for aliasing rules is "consistent"
# which will auto-detect the setting from the rest of the file. This
# is less desirable in a new project and you may find this (slightly
# more strict) setting more useful.
[tool.sqlfluff.rules.aliasing.table]
aliasing = "explicit"
[tool.sqlfluff.rules.aliasing.column]
aliasing = "explicit"
[tool.sqlfluff.rules.aliasing.length]
min_alias_length = 3
# The default configuration for capitalisation rules is "consistent"
# which will auto-detect the setting from the rest of the file. This
# is less desirable in a new project and you may find this (slightly
# more strict) setting more useful.
# Typically we find users rely on syntax highlighting rather than
# capitalisation to distinguish between keywords and identifiers.
# Clearly, if your organisation has already settled on uppercase
# formatting for any of these syntax elements then set them to "upper".
# See https://stackoverflow.com/questions/608196/why-should-i-capitalize-my-sql-keywords-is-there-a-good-reason
[tool.sqlfluff.rules.capitalisation.keywords]
capitalisation_policy = "lower"
[tool.sqlfluff.rules.capitalisation.identifiers]
capitalisation_policy = "lower"
[tool.sqlfluff.rules.capitalisation.functions]
extended_capitalisation_policy = "lower"
[tool.sqlfluff.rules.capitalisation.literals]
capitalisation_policy = "lower"
[tool.sqlfluff.rules.capitalisation.types]
extended_capitalisation_policy = "lower"