-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathpyproject.toml
More file actions
171 lines (147 loc) · 5.71 KB
/
pyproject.toml
File metadata and controls
171 lines (147 loc) · 5.71 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
# ============================================================
# pyproject.toml (Python and MkDocs project configuration)
# ============================================================
# VARIANT: python-mkdocs
# 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-05-sql" # CUSTOM: Package distribution name (use lowercase and dashes).
readme = "README.md"
requires-python = ">=3.14"
version = "0.1.0"
dependencies = [
# REQ.DEPS: External packages used by the project code.
"datafun-toolkit>=0.9.4",
"duckdb>=1.4.4",
"pandas>=2.2.0",
]
[project.optional-dependencies]
# WHY: Optional dependency groups keep the core install clean and focused.
dev = [
# REQ.DEV.DEPS: External packages used for linting, testing, type checking, etc.
"bandit>=1.9.2",
"packaging>=26.0",
"pre-commit>=4.5.1",
"pytest>=9.0.2",
"pytest-cov>=7.0.0",
"pyright>=1.1.408",
"ruff>=0.14.10",
"validate-pyproject>=0.24.1",
]
docs = [
# REQ.DOCS.DEPS: External packages used to generate project documentation.
"mike>=2.1.3",
"mkdocs>=1.6.1",
"mkdocs-material>=9.7.1",
"mkdocs-static-i18n>=1.3.0",
"mkdocstrings[python]>=1.0.0",
]
# === PYRIGHT (TYPE CHECKING HELPS FIND COMMON ERRORS BEFORE THE CODE RUNS) ===
[tool.pyright]
# CUSTOM: Pyright configuration for static type checking.
# This configuration is NOT enforced by CI or pre-commit.
# It is provided for instructors and advanced users who
# explicitly run pyright. It is optional.
# WHY: Strict type checking helps catch bugs early.
include = ["src"]
extraPaths = ["src"]
exclude = [ "**/node_modules", "**/.*", ".venv","**/__pycache__","dist","build"]
pythonVersion = "3.14"
reportMissingImports = "warning"
reportPrivateUsage = "none"
typeCheckingMode = "basic" # strict | basic | off
useLibraryCodeForTypes = false
venv = ".venv"
venvPath = "."
# === PYTEST (VERIFY LOGIC) ===
[tool.pytest.ini_options]
# WHY: Ensure tests are discoverable and coverage is visible.
minversion = "7.0"
testpaths = ["tests"]
addopts = " --cov=src --cov-report=term-missing"
# === RUFF (PYTHON FORMATTING AND LINTING) ===
[tool.ruff]
# WHY: Ruff provides fast linting and formatting with deterministic output.
exclude = [
".eggs",
"*.egg-info",
".ruff_cache",
".venv",
"__pycache__",
"build",
"dist",
"site",
]
line-length = 88 # WHY: PEP 8 standard line length, wrap when possible.
preview = false # WHY: Stable features only; avoid preview features.
target-version = "py313" # WHY: Match latest supported Python version.
unsafe-fixes = false # WHY: Avoid potentially unsafe automatic fixes.
[tool.ruff.format]
# WHY: Formatter choices should be stable to keep diffs small and predictable.
indent-style = "space" # See also .gitattributes for indent style.
line-ending = "auto" # Match existing files and let .gitattributes handle it.
quote-style = "preserve" # Preserve existing quote styles to minimize churn.
[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
"PTH", # Prefer pathlib patterns
]
ignore = [
"E501", # Final line length handled by formatter
]
[tool.ruff.lint.isort]
# WHY: Ordering imports helps keep code diffs (differences) readable.
force-sort-within-sections = true
# === PER-FILE IGNORES (DEPENDS ON DOCSTRING POLICY) ===
[tool.ruff.lint.per-file-ignores]
# WHY: Some files MUST NOT undergo linting or automated fixes.
# POLICY: Docstring rules are NOT enabled (no "D" in [tool.ruff.lint].select).
"src/**/__init__.py" = ["F401"] # Allow re-export patterns
"src/**/_version.py" = ["ALL"] # Auto-generated file (do not lint)
"notebooks/**/*.ipynb" = ["F821"] # Notebooks may have runtime-defined names
# OPTIONAL: If docstring rules are enabled later (add "D" to select),
# replace the block above with the following:
#
# [tool.ruff.lint.per-file-ignores]
# "src/**/__init__.py" = ["D104", "F401"] # Allow omission + re-export patterns
# "src/**/_version.py" = ["ALL"] # Auto-generated file (do not lint)
# "tests/**/*.py" = ["D"] # Tests have different docstring norms
# "notebooks/**/*.ipynb" = ["F821"] # Notebooks may have runtime-defined names
# === CHOOSE PROJECT DOC STYLE ===
[tool.ruff.lint.pydocstyle]
# WHY: Choose one docstring convention project-wide to avoid mixed styles and churn.
# REQ: Google style is the default policy for this repository.
convention = "google" # ALT: "numpy" (choose one convention project-wide)
# === BUILD SYSTEM ===
#
# REQ.PROJECT:
# This project MUST define a build system so that local Python modules
# can be discovered and imported reliably.
#
# WHY:
# Although this project is not published to PyPI, tools such as editors,
# test runners, and CI need a consistent way to locate importable code.
#
# REQ.STRUCTURE:
# All importable Python code MUST live under src/.
#
# WHY:
# A src/ layout prevents accidental imports from the repository root and
# ensures consistent behavior across IDEs, tests, and command-line runs.
[build-system]
# REQ.BUILD: A build backend MUST be declared to enable package discovery.
build-backend = "setuptools.build_meta"
requires = ["setuptools>=80.9.0"]
[tool.setuptools]
# REQ.PACKAGES: Package discovery MUST be rooted at src/.
package-dir = { "" = "src" }
[tool.setuptools.packages.find]
# WHY: Explicitly define package discovery location.
where = ["src"]