-
Notifications
You must be signed in to change notification settings - Fork 76
Expand file tree
/
Copy pathpyproject.toml
More file actions
130 lines (118 loc) · 4.43 KB
/
Copy pathpyproject.toml
File metadata and controls
130 lines (118 loc) · 4.43 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
# Python tooling configuration for the Millennium Dawn `tools/` developer scripts.
# This is NOT a package definition — the tools are run as scripts, not installed.
# It centralizes pytest, Ruff, Black, Pylint, mypy, and the Python dependency
# lists (see [dependency-groups]) so the CLI, pre-commit hooks, and CI all read
# the same settings from one place.
[tool.pytest.ini_options]
testpaths = ["tools/tests"]
python_files = ["*_test.py"]
addopts = "-q"
pythonpath = [
".",
"tools",
"tools/validation",
"tools/linting",
"tools/standardization",
"tools/docs_checks",
"tools/analysis",
"tools/assets",
]
[tool.pyright]
extraPaths = [
".",
"tools",
"tools/validation",
"tools/linting",
"tools/standardization",
"tools/docs_checks",
"tools/analysis",
"tools/assets",
]
venvPath = "."
venv = ".venv"
[tool.ruff]
line-length = 88
target-version = "py39"
[tool.ruff.lint]
# E + F are pyflakes/pycodestyle defaults: undefined names, unused imports and
# variables, bare excepts, broken format strings — real correctness signal.
# I is isort: import ordering, applied via `ruff check --fix`.
select = ["E", "F", "I"]
ignore = [
# The tools deliberately mutate sys.path before importing sibling modules
# (validation/, report_lib/). That idiom is repo-wide, not a mistake.
"E402",
# `l`, `I`, `O` single-letter names appear in tight loops throughout; not
# worth the churn of renaming.
"E741",
# Line length is Black's responsibility; long strings, URLs, and comments
# remain intentionally unwrapped, so E501 is pure noise.
"E501",
]
[tool.ruff.lint.isort]
# Without this, ruff classifies `import common` (tools/docs_checks/common.py)
# from the presence of the game-data `common/` directory at the repo root: it
# is first-party in a full checkout and third-party in CI's sparse `tools/`-only
# checkout, so the same file passes locally and fails I001 on CI.
known-first-party = ["common"]
[tool.ruff.lint.per-file-ignores]
# Library/hub modules re-export a public API surface (e.g. validator_common
# re-exports run_validator_main from shared_utils). pyflakes can't see the
# downstream consumers and flags the imports as unused — never auto-strip them.
"tools/shared_utils.py" = ["F401"]
"tools/loc.py" = ["F401"]
"tools/logging_tool.py" = ["F401"]
"tools/standardization/common_utils.py" = ["F401"]
"tools/validation/validator_common.py" = ["F401"]
[tool.pylint.main]
py-version = "3.10"
recursive = true
ignore = ["__pycache__"]
init-hook = "import sys; sys.path.extend(['tools', 'tools/analysis', 'tools/assets', 'tools/balance', 'tools/docs_checks', 'tools/generators', 'tools/linting', 'tools/publishing', 'tools/report_lib', 'tools/standardization', 'tools/validation'])"
[tool.pylint.messages_control]
# Ruff owns formatting, import order, and the project's broad style policy.
# Pylint remains enabled for correctness diagnostics, while dynamic script
# imports and optional analysis packages are handled by the existing runtime
# and analysis dependency groups.
disable = ["C", "R", "W", "import-error"]
[tool.coverage.run]
branch = true
source = ["tools"]
[tool.coverage.report]
omit = ["tools/tests/**", "tools/*_test.py", "**/__pycache__/**"]
include_namespace_packages = true
fail_under = 95
[tool.mypy]
python_version = "3.10"
files = [
"tools/report_lib",
"tools/shared_utils.py",
"tools/validation/validator_common.py",
"tools/validation/disk_cache.py",
]
exclude = "(^|/)tests/"
ignore_missing_imports = true
warn_unused_ignores = true
pretty = true
[dependency-groups]
# Single source for the Python packages the tools need; install with
# `pip install --group <name>` (PEP 735, pip >= 25.1). Replaces the old
# tools/requirements.txt and tools/report_lib/requirements-dev.txt.
# A few tools import these at runtime; everything else is stdlib-only.
runtime = ["requests==2.34.2", "pillow==12.2.0"]
# Lint, format, and test tooling. Ruff checks Python correctness/imports;
# Black is the sole formatter; Pylint checks correctness diagnostics and mypy
# checks the typed report and validator-core surfaces.
dev = [
"pytest>=9.1.0",
"coverage==7.10.7",
"pyyaml>=6.0.3",
"ruff==0.15.17",
"black==26.5.1",
"mypy==2.3.0",
"pylint==4.0.6",
]
# Optional: only the numeric balance/analysis scripts need these
# (tools/balance/set_energy_tech_scurves.py, tools/analysis/renewable_power_per_cost.py,
# tools/balance/set_renewable_hotspots.py). Not required for validators or CI.
analysis = ["numpy>=1.24", "scipy>=1.10", "matplotlib>=3.7"]