-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
205 lines (175 loc) · 6.51 KB
/
pyproject.toml
File metadata and controls
205 lines (175 loc) · 6.51 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
# ============================================================
# pyproject.toml (Python, MkDocs, PyPi project configuration)
# ============================================================
# VARIANT: python-mkdocs-pypi
# SOURCE: https://github.com/denisecase/templates
# REQ.PYTHON: Python projects MUST include pyproject.toml as the single source of truth.
# WHY: Centralizes project configuration.
[project]
name = "datafun-toolkit" # CUSTOM: Package distribution name (use lowercase and dashes).
readme = "README.md"
requires-python = ">=3.14"
dynamic = ["version"] # WHY: version managed by build system (setuptools_scm).
# CUSTOM: Project metadata.
authors = [{ name = "Denise Case", email = "dcase@nwmissouri.edu" }]
description = "Privacy-safe diagnostics, paths, and logging helpers for analytics projects."
keywords = ["data", "analytics", "logging", "diagnostics", "education", "toolkit"]
license-files = ["LICENSE"]
# PyPI classifiers to help with discovery.
classifiers = [
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.14",
"Topic :: Software Development :: Libraries",
"Topic :: Utilities",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Typing :: Typed",
]
# REQ.DEPS: Keep runtime dependencies minimal.
# OBS: This toolkit uses only the Python standard library.
dependencies = []
[project.optional-dependencies]
# WHY: Optional dependency groups keep the core install clean and focused.
dev = [
# packaging required by validate-pyproject (below).
"bandit>=1.9.4",
"deptry>=0.24.0",
"packaging>=26.0",
"pre-commit>=4.5.1",
"pytest>=9.0.2",
"pytest-cov>=7.0.0",
"pyright>=1.1.408",
"ruff>=0.14.13",
"validate-pyproject>=0.24.1",
]
docs = [
# REQ.DOCS.DEPS: External packages used to generate project documentation.
"mkdocstrings[python]>=1.0.0",
"zensical>=0.0.24",
]
[project.urls]
# WHY: Canonical project links used by tooling and documentation.
# CUSTOM: Replace with your repo values.
Documentation = "https://denisecase.github.io/datafun-toolkit/"
Issues = "https://github.com/denisecase/datafun-toolkit/issues"
Repository = "https://github.com/denisecase/datafun-toolkit"
[tool.deptry.per_rule_ignores]
DEP002 = [
# === DEV TOOLING (not required at runtime) ===
"bandit",
"deptry",
"packaging",
"pre-commit",
"pytest",
"pytest-cov",
"pyright",
"ruff",
"validate-pyproject",
# === DOCUMENTATION TOOLING (not required at runtime) ===
"mkdocstrings", # WHY: Needed for [python] extra (above).
"zensical", # WHY: Zensical is used for AI-assisted documentation.
]
[tool.pyright]
# WHY: Static type checking for early error detection and clearer interfaces.
typeCheckingMode = "strict"
include = ["src"]
extraPaths = ["src"]
pythonVersion = "3.14"
reportMissingImports = "warning"
reportPrivateUsage = "none"
useLibraryCodeForTypes = false
venv = ".venv"
venvPath = "."
[tool.pytest.ini_options]
# WHY: Ensure tests are discoverable and coverage is visible.
minversion = "7.0"
testpaths = ["tests"]
addopts = "-q --cov=datafun_toolkit --cov-report=term-missing"
[tool.ruff]
# WHY: Ruff provides fast linting and formatting with deterministic output.
exclude = [
".eggs",
"*.egg-info",
".ruff_cache",
".venv",
"__pycache__",
"build",
"dist",
"site",
]
fix = true
line-length = 100
preview = false
target-version = "py313" # WHY: Match latest supported Python version.
unsafe-fixes = false
[tool.ruff.format]
# WHY: Formatter choices should be stable to keep diffs small and predictable.
line-ending = "lf"
quote-style = "preserve"
[tool.ruff.lint]
# WHY: Professional baseline rules without requiring advanced refactors.
select = [
"E", # Basic syntax and structural correctness
"F", # Undefined names and unused imports
"W", # Warnings that catch easy issues early
"I", # Deterministic import ordering
"UP", # Modern Python constructs
"B", # Common bug patterns
"C4", # Comprehension correctness and clarity
"SIM", # Simplify obvious complexity
"RET", # Return practices
"PTH", # Prefer pathlib patterns
"D", # Docstring standards (see convention below)
"S", # Security checks (with deliberate exceptions)
]
ignore = [
"E501", # Line length handled by formatter
"D203", # Conflicts with D211
"D212", # Forces multi-line docstring summary to start on same line
"D213", # Choose one docstring summary placement style
"D413", # Reduce section-format noise unless required
"S101", # Allow assert (tests + internal invariants)
"W291", # Trailing whitespace - handled by formatter
"W292", # No newline at end of file - handled by formatter
"W293", # Blank lines contain whitespace - handled by formatter
]
[tool.ruff.lint.isort]
# WHY: Import ordering must be deterministic to keep diffs readable.
force-sort-within-sections = true
[tool.ruff.lint.per-file-ignores]
# WHY: Narrow exceptions belong here; do not weaken global rules broadly.
"src/**/__init__.py" = ["D104", "F401"]
"src/**/_version.py" = ["ALL"] # WHY: Auto-generated by setuptools_scm; ignore all issues.
"tests/**/*.py" = ["D", "S101"]
"src/**/py.typed" = ["ALL"] # WHY: py.typed files are not valid Python syntax.
[tool.ruff.lint.pydocstyle]
# WHY: Choose one docstring convention project-wide.
convention = "google"
# === BUILD SYSTEM ===
# REQ.BUILD:
# - `build-backend` must be a build backend (setuptools or hatchling).
# - `setuptools_scm` is a versioning plugin, not the build backend.
[build-system]
# WHY: Build system needed to create distributable packages.
# CUSTOM: Using scm for dynamic version management.
requires = [
"setuptools>=82.0.0",
"setuptools_scm>=9.2.2",
]
build-backend = "setuptools.build_meta"
[tool.setuptools]
include-package-data = true # WHY: Ensure non-code files are included in distributions.
package-dir = {"" = "src"} # WHY: src-layout keeps code separate from config and docs.
[tool.setuptools.package-data]
"datafun_toolkit" = ["py.typed", "*.yaml"]
[tool.setuptools.packages.find]
where = ["src"] # WHY: Explicitly define package discovery location.
[tool.setuptools_scm]
tag_regex = "^v(?P<version>\\d+\\.\\d+\\.\\d+)$" # WHY: Match tags like v1.2.3 for versioning.
fallback_version = "0.0.1"
local_scheme = "no-local-version"
version_file = "src/datafun_toolkit/_version.py"