forked from yfedoseev/pdf_oxide
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
189 lines (170 loc) · 5.49 KB
/
Copy pathpyproject.toml
File metadata and controls
189 lines (170 loc) · 5.49 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
[build-system]
requires = ["maturin>=1.0,<2.0"]
build-backend = "maturin"
[project]
name = "pdf_oxide"
version = "0.3.17"
description = "The fastest Python PDF library: 0.8ms mean, 5× faster than PyMuPDF. Text extraction, markdown conversion, PDF creation. 100% pass rate on 3,830 PDFs."
readme = "README.md"
requires-python = ">=3.8"
license = {text = "MIT OR Apache-2.0"}
authors = [
{name = "PDF Oxide Contributors", email = "yfedoseev@gmail.com"},
]
keywords = ["pdf", "text-extraction", "pdf-parser", "pymupdf-alternative", "rag", "llm", "ocr", "markdown", "document-parser", "pdf-to-text", "pdf-to-markdown", "data-extraction"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Rust",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Text Processing",
"Topic :: Text Processing :: General",
"Topic :: Text Processing :: Markup :: HTML",
"Topic :: Text Processing :: Markup :: Markdown",
"Topic :: Scientific/Engineering :: Information Analysis",
]
[project.urls]
Homepage = "https://github.com/yfedoseev/pdf_oxide"
Documentation = "https://pdf.oxide.fyi/docs/getting-started/python"
"API Reference (Rust)" = "https://docs.rs/pdf_oxide"
"API Reference (Python)" = "https://pdf.oxide.fyi/docs/reference/python-api"
"Performance Benchmarks" = "https://pdf.oxide.fyi/docs/performance"
Repository = "https://github.com/yfedoseev/pdf_oxide"
"Bug Tracker" = "https://github.com/yfedoseev/pdf_oxide/issues"
[project.optional-dependencies]
ocr = [
# OCR requires ONNX Runtime and heavy ML dependencies
"onnxruntime>=1.20.1",
]
[dependency-groups]
dev = [
# Linter and formatter (fast, all-in-one tool written in Rust)
"ruff>=0.1.0",
# Testing
"pytest>=7.0",
"pytest-cov>=4.0",
# Type checking (optional)
"mypy>=1.0",
"ty>=0.0.15",
# Build tool for Python bindings
"maturin>=1.0,<2.0",
]
test = [
"pytest>=7.0.0",
"pytest-cov>=4.0.0",
]
benchmark = [
"pikepdf>=9.2.1",
"borb>=3.0.4",
"pymupdf>=1.24.11",
"pymupdf4llm>=0.0.17",
"pdfplumber>=0.11.5",
"pypdf>=5.9.0",
"pypdfium2>=5.3.0",
"pdfminer-six>=20231228",
"playa-pdf>=1.0.0",
]
seg-edgar = [
"sec-edgar-downloader>=5.0.3",
]
convert-models = [
"torch>=2.4.1",
"onnxruntime>=1.20.1",
"transformers>=4.46.3",
]
inspect-tj-array = [
"pymupdf>=1.24.11",
]
check-pdf-structure = [
"pypdf",
]
analyze-pdf-spacing = [
"pymupdf>=1.24.11",
]
[tool.maturin]
features = ["python"]
python-source = "python"
module-name = "pdf_oxide.pdf_oxide"
# Ensure generated .pyi stubs are packaged (they are gitignored, so include explicitly)
include = ["pdf_oxide/**/*.pyi"]
[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
# Ruff - Fast Python linter and formatter (written in Rust)
# Replaces: Black, isort, Flake8, pyupgrade, and more
# Docs: https://docs.astral.sh/ruff/
[tool.ruff]
line-length = 100
target-version = "py38"
extend-exclude = [
".git",
"__pycache__",
"build",
"dist",
".eggs",
"*.egg-info",
]
[tool.ruff.lint]
# Enable these rule sets
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort (import sorting)
"N", # pep8-naming
"B", # flake8-bugbear (find likely bugs)
"C4", # flake8-comprehensions
"SIM", # flake8-simplify
"TCH", # flake8-type-checking
]
# Disable specific rules if needed
ignore = [
"E501", # Line too long (handled by formatter)
"B008", # Do not perform function calls in argument defaults
"UP", # pyupgrade (modernize Python code) # compatible with py38
]
# Allow unused variables when underscore-prefixed
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[tool.ruff.lint.per-file-ignores]
# Ignore import violations in __init__.py files
"__init__.py" = ["F401", "F403"]
# Allow print statements in scripts
"scripts/*.py" = ["T201"]
[tool.ruff.lint.isort]
known-first-party = ["pdf_oxide"]
force-single-line = false
lines-after-imports = 2
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "lf"
[tool.ty.rules]
possibly-missing-attribute = "error"
possibly-missing-import = "error"
possibly-unresolved-reference = "warn"
[tool.ty.src]
# Linting codes in `scripts` needs lots of dependencies, so we don't include `scripts` here
# Instead, we could let .py files in `scripts` be checked when they are changed by pre-commit
include = ["python/pdf_oxide"]
[tool.ty.environment]
python = "./.venv"
[tool.pdm.scripts]
fmt = {composite = ["cargo fmt", "ruff check . --select I --fix", "ruff format ."]}
lint = {composite = ["cargo check", "cargo clippy -- -D warnings", "ruff check . --fix", "ty check ."]}
# Generate .pyi from Rust (mypy stubgen). Use: pdm run stub_gen
stub_gen = "uv run stubgen -p pdf_oxide -o python"