forked from harvard-edge/cs249r_book
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
267 lines (234 loc) · 6.07 KB
/
pyproject.toml
File metadata and controls
267 lines (234 loc) · 6.07 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
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "mlsysbook"
version = "1.0.0"
description = "Machine Learning Systems Textbook - Tools and Scripts"
readme = "README.md"
requires-python = ">=3.9"
license = {text = "MIT"}
authors = [
{name = "MLSysBook Contributors", email = "info@mlsysbook.ai"}
]
keywords = ["machine-learning", "systems", "textbook", "education", "ai"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Education",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Documentation",
"Topic :: Text Processing :: Markup",
]
dependencies = [
# Core dependencies for Quarto/Jupyter integration
"jupyterlab-quarto>=0.3.0",
"jupyter>=1.0.0",
# Bibliography and document processing
"pybtex>=0.24.0",
"pypandoc>=1.11",
"pyyaml>=6.0",
# Data processing and validation
"pandas>=2.0.0",
"numpy>=1.24.0",
"jsonschema>=4.0.0",
# Image processing
"Pillow>=9.0.0",
# HTTP and API interactions
"requests>=2.31.0",
# Text processing
"titlecase>=2.4.1",
# Terminal output and UI
"rich>=13.0.0",
# Type checking and validation
"typing-extensions>=4.5.0",
# Utilities
"click>=8.0.0",
"pathlib2>=2.3.0; python_version<'3.11'",
]
[project.optional-dependencies]
dev = [
# Testing
"pytest>=7.0.0",
"pytest-cov>=4.0.0",
"pytest-mock>=3.10.0",
"pytest-asyncio>=0.21.0",
# Code quality
"black>=23.0.0",
"isort>=5.12.0",
"flake8>=6.0.0",
"mypy>=1.0.0",
"pylint>=2.17.0",
# Security
"bandit>=1.7.0",
"safety>=2.3.0",
# Documentation
"sphinx>=6.0.0",
"sphinx-rtd-theme>=1.2.0",
# Pre-commit hooks
"pre-commit>=3.0.0",
]
ai = [
# AI/ML specific dependencies
"openai>=1.0.0",
"sentence-transformers>=2.2.0",
"transformers>=4.21.0",
"torch>=1.12.0",
"scikit-learn>=1.3.0",
"gradio>=3.40.0",
"ollama>=0.1.0",
]
build = [
# Build and publishing tools
"twine>=4.0.0",
"build>=0.10.0",
"setuptools>=61.0",
"wheel>=0.40.0",
]
[project.urls]
Homepage = "https://mlsysbook.ai"
Documentation = "https://docs.mlsysbook.ai"
Repository = "https://github.com/mlsysbook/mlsysbook"
Issues = "https://github.com/mlsysbook/mlsysbook/issues"
Changelog = "https://github.com/mlsysbook/mlsysbook/blob/main/CHANGELOG.md"
[project.scripts]
binder = "book.cli.main:main"
mlsysbook = "book.cli.main:main"
[tool.setuptools.packages.find]
where = ["."]
include = ["book*", "book.tools*", "book.cli*"]
exclude = ["tests*", "docs*"]
[tool.setuptools.package-data]
"book.tools.scripts" = ["**/*.yaml", "**/*.yml", "**/*.json", "**/*.txt", "**/*.md"]
# Black formatting configuration
[tool.black]
line-length = 100
target-version = ['py39', 'py310', 'py311', 'py312']
include = '\.pyi?$'
extend-exclude = '''
/(
# Exclude build artifacts
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
# Exclude generated files
| contents/
| quarto/
)/
'''
# isort import sorting configuration
[tool.isort]
profile = "black"
line_length = 100
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
ensure_newline_before_comments = true
src_paths = ["book/tools"]
skip_glob = ["book/quarto/contents/*", "book/quarto/*"]
# MyPy type checking configuration
[tool.mypy]
python_version = "3.9"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_no_return = true
warn_unreachable = true
strict_equality = true
show_error_codes = true
[[tool.mypy.overrides]]
module = [
"pypandoc.*",
"pybtex.*",
"titlecase.*",
"gradio.*",
"ollama.*",
]
ignore_missing_imports = true
# Pytest configuration
[tool.pytest.ini_options]
minversion = "7.0"
addopts = [
"--strict-markers",
"--strict-config",
"--cov=book/tools",
"--cov-report=term-missing",
"--cov-report=html",
"--cov-fail-under=80"
]
testpaths = ["tests", "book/tests"]
python_files = ["test_*.py", "*_test.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"integration: marks tests as integration tests",
"unit: marks tests as unit tests",
"ai: marks tests that require AI models",
]
# Coverage configuration
[tool.coverage.run]
source = ["book/tools"]
branch = true
omit = [
"*/tests/*",
"*/test_*",
"*/__pycache__/*",
"*/.*",
]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if self.debug:",
"if settings.DEBUG",
"raise AssertionError",
"raise NotImplementedError",
"if 0:",
"if __name__ == .__main__.:",
"class .*\\bProtocol\\):",
"@(abc\\.)?abstractmethod",
]
# Pylint configuration
[tool.pylint.messages_control]
disable = [
"C0330", # Wrong hanging indentation before block (conflicts with black)
"C0326", # Bad whitespace (conflicts with black)
"R0903", # Too few public methods (sometimes OK for data classes)
"R0913", # Too many arguments (sometimes necessary)
]
[tool.pylint.format]
max-line-length = "100"
[tool.pylint.design]
max-args = 8
max-locals = 20
max-branches = 15
max-statements = 60
# Bandit security linting
[tool.bandit]
exclude_dirs = ["tests", "book/quarto/contents", "book/quarto"]
skips = ["B101", "B601"] # Skip assert_used and shell=True (sometimes needed)
# Flake8 configuration (in setup.cfg or .flake8 file)
# Note: flake8 doesn't support pyproject.toml yet