-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
314 lines (261 loc) · 10.4 KB
/
pyproject.toml
File metadata and controls
314 lines (261 loc) · 10.4 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
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# =============================================================================
# pyproject.toml — plotstyle
# Build backend: Hatchling (PEP 517/518/621 native; no setup.py required)
# =============================================================================
[build-system]
requires = ["hatchling>=1.27", "hatch-vcs>=0.5"]
build-backend = "hatchling.build"
# -----------------------------------------------------------------------------
# Core project metadata (PEP 621)
# -----------------------------------------------------------------------------
[project]
name = "plotstyle"
dynamic = ["version"]
description = "Matplotlib/seaborn style presets matching scientific journal requirements, with validation, export safety, and preview capabilities."
readme = "README.md"
license = { text = "MIT" }
requires-python = ">=3.10"
authors = [
{ name = "Rahul Kaushal" },
]
keywords = [
"matplotlib",
"seaborn",
"scientific",
"plotting",
"journal",
"publication",
"figures",
"style",
"visualization",
"academic",
"research",
"typesetting",
"colorblind",
"accessibility",
"export",
"validation",
"rcParams",
"nature",
"ieee",
"science",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"Intended Audience :: Education",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Visualization",
"Topic :: Multimedia :: Graphics",
"Framework :: Matplotlib",
"Typing :: Typed",
]
dependencies = [
"matplotlib>=3.9,<4",
"tomli>=2.0; python_version < '3.11'",
]
# -----------------------------------------------------------------------------
# Optional dependency groups
# -----------------------------------------------------------------------------
[project.optional-dependencies]
# ── Image processing (used by style preview + export safety) ─────────────────
color = [
"Pillow>=11.0,<13",
]
# ── Font subsetting / inspection ──────────────────────────────────────────────
fonttools = [
"fonttools>=4.55,<5",
]
# ── Statistical plotting companion ───────────────────────────────────────────
seaborn = [
"seaborn>=0.13.2,<1",
"pandas>=2.2,<3", # seaborn 0.13 requires pandas; pin major
]
# ── Developer toolchain ───────────────────────────────────────────────────────
dev = [
"plotstyle[color]", # preview/export tests need Pillow
"pytest>=8.3,<10",
"pytest-cov>=6.0,<8",
"pytest-mpl>=0.18,<1",
"ruff>=0.15,<1",
"mypy>=1.15,<2",
"pre-commit>=4.0,<5",
]
# ── Documentation build ───────────────────────────────────────────────────────
docs = [
"sphinx>=9.0,<10",
"furo>=2025.12.19",
"myst-parser>=5.0,<6",
"sphinx-autodoc-typehints>=3.0,<4",
"sphinx-copybutton>=0.5,<1",
]
# ── Meta-group: installs all optional runtime extras ─────────────────────────
all = [
"plotstyle[color,fonttools,seaborn]",
]
# -----------------------------------------------------------------------------
# CLI entry points
# -----------------------------------------------------------------------------
[project.scripts]
plotstyle = "plotstyle.cli.main:main"
# -----------------------------------------------------------------------------
# Project URLs
# -----------------------------------------------------------------------------
[project.urls]
Homepage = "https://github.com/rahulkaushal04/plotstyle"
Documentation = "https://plotstyle.readthedocs.io"
Repository = "https://github.com/rahulkaushal04/plotstyle"
Issues = "https://github.com/rahulkaushal04/plotstyle/issues"
Changelog = "https://github.com/rahulkaushal04/plotstyle/blob/main/CHANGELOG.md"
Download = "https://pypi.org/project/plotstyle/"
# =============================================================================
# Build configuration
# =============================================================================
[tool.hatch.version]
source = "vcs" # version is derived from git tags (e.g. v1.2.3)
[tool.hatch.build.hooks.vcs]
version-file = "src/plotstyle/_version.py"
[tool.hatch.build.targets.sdist]
include = ["/src", "/tests", "/README.md", "/CHANGELOG.md", "/LICENSE"]
[tool.hatch.build.targets.wheel]
packages = ["src/plotstyle"]
# =============================================================================
# Hatch environments (replaces tox.ini / Makefile)
# =============================================================================
[tool.hatch.envs.default]
features = ["dev"]
[tool.hatch.envs.default.scripts]
test = "pytest {args:tests}"
test-cov = "pytest --cov=plotstyle --cov-report=term-missing --cov-report=xml {args:tests}"
lint = ["ruff check src tests", "ruff format --check src tests"]
fmt = ["ruff check --fix src tests", "ruff format src tests"]
typecheck = "mypy src"
[tool.hatch.envs.docs]
features = ["docs"]
[tool.hatch.envs.docs.scripts]
build = "sphinx-build -W -b html docs docs/_build/html"
serve = "python -m http.server 8000 --directory docs/_build/html"
# =============================================================================
# Ruff (linter + formatter; replaces Black, isort, Flake8, pyupgrade)
# =============================================================================
[tool.ruff]
src = ["src"]
target-version = "py310"
line-length = 100
indent-width = 4
[tool.ruff.lint]
# Core: pycodestyle (E/W), Pyflakes (F), isort (I), pyupgrade (UP),
# flake8-bugbear (B), flake8-simplify (SIM), flake8-annotations (ANN),
# pydocstyle (D), Perflint (PERF), Ruff-native (RUF)
select = [
"E", "W", # pycodestyle
"F", # Pyflakes
"I", # isort
"UP", # pyupgrade
"B", # flake8-bugbear
"SIM", # flake8-simplify
"ANN", # flake8-annotations (type hint coverage)
"D", # pydocstyle
"PERF", # Perflint
"RUF", # Ruff-specific
"TCH", # flake8-type-checking (moves TYPE_CHECKING-only imports)
"PTH", # flake8-use-pathlib (prefer pathlib over os.path)
"ERA", # eradicate commented-out code
]
ignore = [
"D100", "D101", "D102", "D104", # missing docstrings (relax for private/init modules)
"D203", # one-blank-line-before-class (conflicts with D211)
"D213", # multi-line-summary-second-line (conflicts with D212)
"E501", # line length handled by formatter
]
unfixable = ["ERA"] # never auto-delete commented code
[tool.ruff.lint.per-file-ignores]
"tests/**" = ["ANN", "D", "S101"] # relax annotations/docs/asserts in tests
"src/plotstyle/cli/**" = ["ANN201"] # CLI main() return type is implicit None
[tool.ruff.lint.isort]
known-first-party = ["plotstyle"]
split-on-trailing-comma = true
[tool.ruff.lint.pydocstyle]
convention = "numpy" # NumPy docstring convention suits scientific libraries
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
docstring-code-format = true
# =============================================================================
# Mypy (strict but practical)
# =============================================================================
[tool.mypy]
python_version = "3.10"
mypy_path = "src"
packages = ["plotstyle"]
# ── Strictness ────────────────────────────────────────────────────────────────
strict = true # enables the full strict bundle below
disallow_untyped_defs = true
disallow_incomplete_defs = true
disallow_untyped_decorators = true
check_untyped_defs = true
warn_return_any = true
warn_unused_ignores = true
warn_unused_configs = true
warn_redundant_casts = true
no_implicit_optional = true
no_implicit_reexport = true
extra_checks = true
# ── Output ────────────────────────────────────────────────────────────────────
show_error_codes = true
show_column_numbers = true
pretty = true
# ── Third-party stubs (no stubs yet, silence missing imports) ─────────────────
[[tool.mypy.overrides]]
module = [
"matplotlib.*",
"seaborn.*",
"PIL.*",
"fontTools.*",
]
ignore_missing_imports = true
# =============================================================================
# Pytest
# =============================================================================
[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = [
"-ra", # show short summary for all non-passing tests
"--strict-markers", # fail on unknown markers
"--tb=short",
]
filterwarnings = [
"error", # treat warnings as errors
"ignore::DeprecationWarning:matplotlib", # upstream, not ours
"ignore::PendingDeprecationWarning:matplotlib",
]
markers = [
"slow: tests that are slow to run",
"visual: tests that require matplotlib image comparison",
]
# =============================================================================
# Coverage (used by pytest-cov)
# =============================================================================
[tool.coverage.run]
source = ["plotstyle"]
branch = true
omit = ["src/plotstyle/_version.py", "src/plotstyle/cli/main.py"]
[tool.coverage.report]
show_missing = true
skip_covered = false
fail_under = 50
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
"raise NotImplementedError",
"\\.\\.\\.",
]