-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
296 lines (288 loc) · 7.72 KB
/
pyproject.toml
File metadata and controls
296 lines (288 loc) · 7.72 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
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "epubs-accessibility"
version = "2.0.0"
description = "Comprehensive toolkit for enhancing document accessibility"
authors = [{name = "Broderick Schipp", email = "schipp0@purdue.edu"}]
license = "MIT"
readme = "README.md"
requires-python = ">=3.9"
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Science/Research",
"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 :: Scientific/Engineering :: Image Processing",
"Topic :: Text Processing :: Markup :: XML",
"Topic :: Multimedia :: Graphics :: Graphics Conversion",
]
# Core dependencies (always required)
dependencies = [
# PDF Processing (Critical Path)
"PyMuPDF>=1.23.0,<1.25.0",
"pikepdf>=8.3.0,<9.0.0",
"pdf2image>=1.16.3,<2.0.0",
"pdfplumber>=0.7.0,<1.0.0",
# OCR Processing (Critical for enhancement pipeline)
"ocrmypdf>=16.0.0,<17.0.0",
# Image Processing
"Pillow>=10.0.0,<11.0.0",
"opencv-python-headless>=4.8.0,<5.0.0", # headless for better server compatibility
"scikit-image>=0.21.0,<1.0.0",
"numpy>=1.24.0,<2.0.0",
# OCR
"pytesseract>=0.3.10,<1.0.0",
# Data Processing
"pandas>=1.5.0,<3.0.0",
"scipy>=1.7.0,<2.0.0",
"tqdm>=4.66.0,<5.0.0",
# Configuration and Environment
"pyyaml>=6.0.0,<7.0.0",
"python-decouple>=3.6,<4.0",
# CLI and User Interface
"typer>=0.12.0,<1.0.0",
"rich>=13.0.0,<14.0.0",
# Utilities
"pathlib-mate>=1.0.0,<2.0.0",
"python-magic>=0.4.27,<1.0.0",
# Performance monitoring
"psutil>=5.9.0,<6.0.0",
]
[project.optional-dependencies]
# Document format support
docs = [
"python-docx>=1.0.0,<2.0.0",
"python-pptx>=0.6.21,<1.0.0",
"openpyxl>=3.0.7,<4.0.0",
"python-xmp-toolkit>=2.0.2,<3.0.0",
"reportlab>=4.0.0,<5.0.0", # For test PDF generation
]
# Machine Learning and AI features (Heavy dependencies)
ml = [
"torch>=2.0.0,<3.0.0",
"transformers>=4.49.0,<5.0.0",
"huggingface-hub>=0.20.0,<1.0.0",
"anthropic>=0.18.0,<1.0.0",
"scikit-learn>=1.3.0,<2.0.0",
"joblib>=1.3.0,<2.0.0",
"numpy>=1.24.0,<2.0.0",
"scipy>=1.7.0,<2.0.0",
# Phase 2B: Advanced Caching & ML Optimization
"faiss-cpu>=1.7.4,<2.0.0", # High-performance similarity search
]
# Apple Silicon optimizations
apple = [
"mlx-vlm>=0.0.3,<1.0.0",
]
# Web scraping capabilities
web = [
"selenium>=4.0.0,<5.0.0",
"requests>=2.28.0,<3.0.0",
"beautifulsoup4>=4.11.0,<5.0.0",
"urllib3>=1.26.0,<3.0.0",
]
# Development dependencies
dev = [
"pytest>=7.0.0,<8.0.0",
"pytest-cov>=4.0.0,<5.0.0",
"pytest-mock>=3.10.0,<4.0.0",
"pytest-xdist>=3.0.0,<4.0.0",
"black>=23.0.0,<24.0.0",
"isort>=5.12.0,<6.0.0",
"flake8>=6.0.0,<7.0.0",
"mypy>=1.0.0,<2.0.0",
"pre-commit>=3.0.0,<4.0.0",
"coverage>=7.0.0,<8.0.0",
"bandit>=1.7.0,<2.0.0", # Security linting
"safety>=2.3.0,<3.0.0", # Dependency vulnerability scanning
]
# Testing dependencies (lighter than dev)
test = [
"pytest>=7.0.0,<8.0.0",
"pytest-cov>=4.0.0,<5.0.0",
"pytest-mock>=3.10.0,<4.0.0",
"pytest-xdist>=3.0.0,<4.0.0",
"hypothesis>=6.0.0,<7.0.0", # Property-based testing
"factory-boy>=3.2.0,<4.0.0", # Test fixtures
"reportlab>=4.0.0,<5.0.0", # For test PDF generation
]
# All optional dependencies combined (for convenience)
all = [
"python-docx>=1.0.0,<2.0.0",
"python-pptx>=0.6.21,<1.0.0",
"openpyxl>=3.0.7,<4.0.0",
"python-xmp-toolkit>=2.0.2,<3.0.0",
"selenium>=4.0.0,<5.0.0",
"requests>=2.28.0,<3.0.0",
"beautifulsoup4>=4.11.0,<5.0.0",
"reportlab>=4.0.0,<5.0.0",
]
[project.scripts]
# Simplified CLI entry point (Stage 2 & 3 complete)
epubs = "src.processor.main_simple:app"
# Scraper CLI (functional component)
epubs-scrape = "src.scraper.purdue_downloader:main"
[project.urls]
Homepage = "https://github.com/schipp0/ePubs_Main"
Repository = "https://github.com/schipp0/ePubs_Main"
Documentation = "https://epubs-accessibility.readthedocs.io"
"Bug Tracker" = "https://github.com/schipp0/ePubs_Main/issues"
[tool.setuptools.packages.find]
# All code now lives in src/ directory
where = ["src"]
exclude = ["venv*", "test_venv*", "build*", "dist*", "*.egg-info*", "temp_processing*", "logs*", "archive*"]
[tool.setuptools.package-data]
"*" = [
"config/*.yaml",
"config/**/*.yaml",
"resources/*",
"resources/**/*",
"*.md",
"*.txt",
]
# Testing configuration
[tool.pytest.ini_options]
minversion = "7.0"
addopts = [
"-ra",
"-q",
"--strict-markers",
"--strict-config",
"--cov=src.processor",
"--cov=src.scraper",
"--cov-report=term-missing",
"--cov-report=html:htmlcov",
"--cov-report=xml",
"--junit-xml=test-results.xml",
]
testpaths = ["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",
"ocr: marks tests that require OCR engine",
"gpu: marks tests that require GPU",
"macos: marks tests as macOS specific",
"windows: marks tests as Windows specific",
"linux: marks tests as Linux specific",
]
# Code formatting with Black
[tool.black]
line-length = 88
target-version = ['py39', 'py310', 'py311', 'py312']
include = '\.pyi?$'
extend-exclude = '''
/(
# directories
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| venv
| _build
| buck-out
| build
| dist
| archived
)/
'''
# Import sorting with isort
[tool.isort]
profile = "black"
multi_line_output = 3
line_length = 88
known_first_party = ["src"]
known_third_party = [
"numpy", "pandas", "PIL", "cv2", "pytesseract",
"pikepdf", "fitz", "yaml", "click", "rich"
]
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
# Type checking with mypy
[tool.mypy]
python_version = "3.9"
warn_return_any = true
warn_unused_configs = true
warn_redundant_casts = true
warn_unused_ignores = true
disallow_any_generics = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = true
no_implicit_optional = true
warn_no_return = true
warn_unreachable = true
strict_equality = true
[[tool.mypy.overrides]]
module = [
"cv2.*",
"pytesseract.*",
"fitz.*",
"pikepdf.*",
"pdf2image.*",
"mlx_vlm.*",
]
ignore_missing_imports = true
# Coverage configuration
[tool.coverage.run]
source = ["src/processor", "src/scraper"]
omit = [
"*/tests/*",
"*/test_*",
"*/conftest.py",
"*/venv/*",
"*/build/*",
"*/dist/*",
"*/temp_processing/*",
"*/logs/*",
"*/archive/*",
]
[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",
]
show_missing = true
skip_covered = false
# Flake8 configuration
[tool.flake8]
max-line-length = 88
extend-ignore = [
"E203", # whitespace before ':'
"E501", # line too long (handled by black)
"W503", # line break before binary operator
]
exclude = [
".git",
"__pycache__",
"build",
"dist",
".venv",
"venv",
".eggs",
"*.egg",
"archived",
]
max-complexity = 10
# Security scanning with bandit