edocapi 0.0.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,335 @@
1
+ Metadata-Version: 2.4
2
+ Name: edocapi
3
+ Version: 0.0.2
4
+ Summary: A lightweight Python framework for building document-processing and document-automation APIs.
5
+ Author-email: EMMANUEL EMMANUEL ETIM <emmanuel224etim089@gmail.com>
6
+ Maintainer-email: EMMANUEL EMMANUEL ETIM <emmanuel224etim089@gmail.com>
7
+ License-Expression: MIT
8
+ Project-URL: Homepage, https://github.com/emmanuelemmanueletim/edocApi
9
+ Project-URL: Documentation, https://github.com/emmanuelemmanueletim/edocApi#readme
10
+ Project-URL: Repository, https://github.com/emmanuelemmanueletim/edocApi.git
11
+ Project-URL: Issues, https://github.com/emmanuelemmanueletim/edocApi/issues
12
+ Keywords: document,api,pdf,docx,conversion,starlette,framework,document-processing
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Framework :: AsyncIO
23
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
24
+ Classifier: Topic :: Text Processing
25
+ Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
26
+ Requires-Python: >=3.9
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ Requires-Dist: starlette>=0.37.0
30
+ Requires-Dist: python-multipart>=0.0.9
31
+ Requires-Dist: uvicorn[standard]>=0.27.0
32
+ Requires-Dist: pypdf>=4.0.0
33
+ Requires-Dist: python-docx>=1.1.0
34
+ Requires-Dist: markdown>=3.5
35
+ Requires-Dist: Pillow>=10.0.0
36
+ Provides-Extra: html
37
+ Requires-Dist: weasyprint>=61.0; extra == "html"
38
+ Provides-Extra: pdf-images
39
+ Requires-Dist: pdf2image>=1.17.0; extra == "pdf-images"
40
+ Provides-Extra: all
41
+ Requires-Dist: weasyprint>=61.0; extra == "all"
42
+ Requires-Dist: pdf2image>=1.17.0; extra == "all"
43
+ Provides-Extra: dev
44
+ Requires-Dist: pytest>=7.4.0; extra == "dev"
45
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
46
+ Requires-Dist: httpx>=0.26.0; extra == "dev"
47
+ Requires-Dist: build>=1.0.0; extra == "dev"
48
+ Requires-Dist: twine>=5.0.0; extra == "dev"
49
+ Dynamic: license-file
50
+
51
+ # eDocAPI
52
+
53
+ **A lightweight Python framework for building document-processing and document-automation APIs.**
54
+
55
+ > Simple API for the developer. Powerful document processing underneath.
56
+
57
+ Built on [Starlette](https://www.starlette.io/). Version **0.0.2**.
58
+
59
+ ---
60
+
61
+ ## Installation
62
+
63
+ **Core** (PDF, DOCX text/HTML, images, Markdown text/HTML, uploads, CLI):
64
+
65
+ ```bash
66
+ pip install edocapi
67
+ ```
68
+
69
+ **With HTML/Markdown/DOCX → PDF** (pulls in WeasyPrint):
70
+
71
+ ```bash
72
+ pip install edocapi[html]
73
+ ```
74
+
75
+ WeasyPrint needs system libraries. On Debian/Ubuntu:
76
+
77
+ ```bash
78
+ sudo apt-get install -y libcairo2 libpango-1.0-0 libpangocairo-1.0-0 \
79
+ libgdk-pixbuf-2.0-0 libffi-dev shared-mime-info
80
+ ```
81
+
82
+ **With PDF → images** (requires poppler):
83
+
84
+ ```bash
85
+ pip install edocapi[pdf-images]
86
+ # system: sudo apt-get install -y poppler-utils
87
+ ```
88
+
89
+ **Everything:**
90
+
91
+ ```bash
92
+ pip install edocapi[all]
93
+ ```
94
+
95
+ **Development (from source):**
96
+
97
+ ```bash
98
+ pip install -e ".[dev,html]"
99
+ ```
100
+
101
+ ## Build and publish
102
+
103
+ From the repository root, build and check the package before uploading:
104
+
105
+ ```powershell
106
+ py -m pip install --upgrade build twine
107
+ py -m build
108
+ py -m twine check dist/*
109
+ py -m twine upload dist/*
110
+ ```
111
+
112
+ Use `__token__` as the Twine username and your PyPI API token as the password
113
+ when prompted. Do not commit the token. See [PUBLISH.md](PUBLISH.md) for the
114
+ full checklist.
115
+
116
+ ---
117
+
118
+ ## Quick Start
119
+
120
+ Create `main.py`:
121
+
122
+ ```python
123
+ from edocapi import App, Document
124
+
125
+ app = App()
126
+
127
+ @app.post("/convert")
128
+ def convert(file):
129
+ return Document(file).to_pdf()
130
+
131
+ @app.post("/compress")
132
+ def compress(file):
133
+ return Document(file).compress()
134
+
135
+ @app.post("/extract")
136
+ def extract(file):
137
+ return {"text": Document(file).extract_text()}
138
+
139
+ @app.post("/merge")
140
+ def merge(files):
141
+ return Document.merge(files)
142
+
143
+ @app.get("/")
144
+ def home():
145
+ return {"message": "eDocAPI v0.0.2", "supported": Document.supported_types()}
146
+ ```
147
+
148
+ Run the development server:
149
+
150
+ ```bash
151
+ edocapi run
152
+ # or with auto-reload:
153
+ edocapi run --reload
154
+ ```
155
+
156
+ Upload a document to `POST /convert` and receive a PDF.
157
+
158
+ ---
159
+
160
+ ## Core Concepts
161
+
162
+ ### Application
163
+
164
+ ```python
165
+ from edocapi import App
166
+
167
+ app = App(
168
+ debug=True,
169
+ max_file_size="25MB",
170
+ )
171
+ ```
172
+
173
+ ### Document
174
+
175
+ ```python
176
+ from edocapi import Document
177
+
178
+ # From uploaded file (Path)
179
+ doc = Document(file)
180
+
181
+ # From HTML string
182
+ doc = Document.html("<h1>Invoice</h1><p>Total: ₦50,000</p>")
183
+
184
+ # From Markdown
185
+ doc = Document.markdown("# Hello World")
186
+ ```
187
+
188
+ ### Conversions
189
+
190
+ ```python
191
+ Document(file).to_pdf() # → Document (PDF)
192
+ Document(file).to_text() # → str
193
+ Document(file).extract_text() # → str
194
+ Document(file).to_html() # → str
195
+ Document(file).to_images() # → list[Document]
196
+ ```
197
+
198
+ ### PDF Operations
199
+
200
+ ```python
201
+ Document(file).compress(level="medium")
202
+ Document(file).split() # list of single-page Documents
203
+ Document(file).extract_pages(1, 5) # 1-based inclusive
204
+ Document(file).rotate(90, pages=[1, 2])
205
+ Document.merge([file1, file2])
206
+ Document(file).info() # dict of metadata
207
+ ```
208
+
209
+ ---
210
+
211
+ ## Supported Formats (v0.0.2)
212
+
213
+ | Input | to_pdf | to_text | to_html | to_images | Notes |
214
+ |-----------|--------|---------|---------|-----------|------------------------|
215
+ | PDF | ✓ | ✓ | ✓* | ✓** | *text-based HTML |
216
+ | DOCX | ✓ | ✓ | ✓ | – | |
217
+ | HTML | ✓ | ✓ | ✓ | – | |
218
+ | Markdown | ✓ | ✓ | ✓ | – | |
219
+ | JPG/PNG/WEBP | ✓ | – | – | ✓ | |
220
+ | TXT | – | ✓ | – | – | via Document constructor |
221
+
222
+ \* PDF→HTML is a simple text extraction wrapper, not a visual rendering.
223
+ \*\* PDF→Images requires optional `pdf2image` + system poppler.
224
+
225
+ ---
226
+
227
+
228
+ ## Deploying
229
+
230
+ The package exposes an ASGI application. In your application's `main.py`, create
231
+ `app = App()` and start it with an ASGI server. For example:
232
+
233
+ ```bash
234
+ uvicorn main:app.asgi --host 0.0.0.0 --port ${PORT:-8000} --workers 2
235
+ ```
236
+
237
+ Keep `debug=False` in hosted environments. If you enable HTML-to-PDF conversion,
238
+ install WeasyPrint's operating-system libraries in the image or host as well as
239
+ the `html` extra. Set the reverse proxy's request-body limit to match
240
+ `max_file_size`; for larger workloads, use a worker queue and monitor temporary
241
+ disk usage.
242
+
243
+ ## Configuration
244
+
245
+ ```python
246
+ app = App(
247
+ debug=False, # more detailed errors when True
248
+ max_file_size="10MB", # "10MB", "25MB", 10485760, etc.
249
+ temp_dir=None, # custom temp directory (optional)
250
+ )
251
+ ```
252
+
253
+ ---
254
+
255
+ ## Error Handling
256
+
257
+ eDocAPI raises specific exceptions that become consistent JSON responses:
258
+
259
+ ```json
260
+ {
261
+ "error": "UnsupportedFileType",
262
+ "message": "The uploaded file type is not supported. (extension: .xlsx)"
263
+ }
264
+ ```
265
+
266
+ Available exceptions: `EdocAPIError`, `UnsupportedFileType`, `InvalidDocument`, `FileTooLarge`, `FileNotFound`, `ConversionError`, `ProcessingError`, `ValidationError`.
267
+
268
+ ---
269
+
270
+ ## CLI
271
+
272
+ ```bash
273
+ edocapi --version
274
+ edocapi run # main:app on http://0.0.0.0:8000
275
+ edocapi run --reload
276
+ edocapi run myapp:app --port 8080
277
+ ```
278
+
279
+ ---
280
+
281
+ ## Architecture
282
+
283
+ ```
284
+ eDocAPI
285
+ │
286
+ Document abstraction
287
+ │
288
+ +───────────+───────────+
289
+ │ │ │
290
+ PDF DOCX Images …
291
+ │ │ │
292
+ pypdf python-docx Pillow
293
+ │
294
+ weasyprint (HTML/PDF)
295
+ ```
296
+
297
+ Processors are registered internally and can be extended in future versions.
298
+
299
+ ---
300
+
301
+ ## Development
302
+
303
+ ```bash
304
+ pip install -e ".[dev]"
305
+ pytest
306
+ ```
307
+
308
+ ---
309
+
310
+
311
+ ## Release status
312
+
313
+ eDocAPI is alpha software. Review conversion behavior, optional system
314
+ dependencies, and workload limits before exposing it to untrusted public
315
+ traffic. See [PUBLISH.md](PUBLISH.md) for the release checklist.
316
+
317
+ ## Roadmap
318
+
319
+ - **v0.1** – OpenAPI generation, more formats, plugin system
320
+ - **v0.2** – OCR, background jobs, cloud storage adapters
321
+ - **v0.3+** – Document signing, AI integrations, advanced workflows
322
+
323
+ ---
324
+
325
+ ## Author
326
+
327
+ **EMMANUEL EMMANUEL ETIM**
328
+ Email: [emmanuel224etim089@gmail.com](mailto:emmanuel224etim089@gmail.com)
329
+ GitHub: [https://github.com/emmanuelemmanueletim/edocApi](https://github.com/emmanuelemmanueletim/edocApi)
330
+
331
+ ---
332
+
333
+ ## License
334
+
335
+ MIT — Copyright (c) 2026 EMMANUEL EMMANUEL ETIM
@@ -0,0 +1,27 @@
1
+ edocapi/__init__.py,sha256=76j1nU8qXPfe0umcte9d_-W4ZvSIn4ScdlOJgIjVktk,1246
2
+ edocapi/app.py,sha256=dIBZkwXBDUZEgI0MzLNy3Rs_Yerdx2OzsMHXzn1rEo8,8722
3
+ edocapi/config.py,sha256=Ex87_7yPffgtFYxV-9BBD2W2sjBcSLHzGCiqw-wNfhM,2196
4
+ edocapi/document.py,sha256=TOXDGIjtsAJRhPfSktqpYm9VVp3xX-P9kw3Pu2jNNqY,10718
5
+ edocapi/exceptions.py,sha256=8Zdov4QpWIMiSs7D7TLtK7Irb8y8Uv26qxuvLXKD6a8,3089
6
+ edocapi/files.py,sha256=NBKksfDNFAJ6L2p5drJfTd_GjyeQHq96YOSsN5RK-ow,3386
7
+ edocapi/responses.py,sha256=iQ09A5ZADPu80HAvpT7NofOvgF4MeBSSBYJLg9uayQo,2444
8
+ edocapi/cli/__init__.py,sha256=eOJ6XuREuklX5qc3vvw2MOTXtUQdGGsRm9dDUyUQxA0,54
9
+ edocapi/cli/main.py,sha256=giLHYQ1QdalMgN7XNg2dpzLUGlRjve8vn1C4FsvlnD4,2251
10
+ edocapi/processors/__init__.py,sha256=9bIiez2jL8dIB8AKuTQuJyylTDUwGxdgQM7bzCnkwrc,408
11
+ edocapi/processors/base.py,sha256=cDnOVdGc40vP_ISmMcRLI_469pghazhIanAkPwfX5hY,3224
12
+ edocapi/processors/docx.py,sha256=H1jvy8qm9KFE1MDvGzUobxo3g29W-7hPULD3MpH9z9M,4021
13
+ edocapi/processors/html.py,sha256=KTAyxtrFVml3P0LR-H2LiZ31wq9R47Z6gQlsk5b01AU,2278
14
+ edocapi/processors/image.py,sha256=kg2Ydbrayf4-Pddp23oL1Ti1w3mlB7ZMPHgELIkubBo,3012
15
+ edocapi/processors/markdown.py,sha256=z6fxEExYzglMmD3UsRu2DJMndm3nBJQJv_AC_hC91zs,2121
16
+ edocapi/processors/pdf.py,sha256=qCcrtgsmOHXWJ1CXIjcHqWKjhnlX4zfmrZn93Ggf4xo,8836
17
+ edocapi/processors/txt.py,sha256=LdhRxU7SxJPAy5Jxy5_L2hK0RCaWy5rNlK3UJEp6jls,1775
18
+ edocapi/storage/__init__.py,sha256=G5NEUrYRmv2yat-MVMEBTvOOA5qMpiZjeJ5kYziO5g0,119
19
+ edocapi/storage/temporary.py,sha256=ACljc_rZTAFxKD4kmx6tsjww-3Pwz7GvujRSSTkWt64,4160
20
+ edocapi/validation/__init__.py,sha256=FVsXlu17O5LF4w13u19mLwdgGHjZsBEWwy5MBewpJWo,248
21
+ edocapi/validation/files.py,sha256=dt8SZz_5PkbEEo573poSWg0YOmx3B4hHiohH6jUy3k8,5829
22
+ edocapi-0.0.2.dist-info/licenses/LICENSE,sha256=WGyjSY_ziZJt4j230U49aIgCq3XUF-qzY6XNPGK9OXA,1079
23
+ edocapi-0.0.2.dist-info/METADATA,sha256=qjemYu5__cgk81HqlFaFHEcwktizcnAlimAWpRMxDKY,9013
24
+ edocapi-0.0.2.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
25
+ edocapi-0.0.2.dist-info/entry_points.txt,sha256=ow_kMFx2w8P-JN_1OlzAjKK5sqCBj5S3i6NXCDI97kU,50
26
+ edocapi-0.0.2.dist-info/top_level.txt,sha256=WKc0psuAnp8XcMW1Ib6EfgNo6xa2k9mCbMQ0aH96ED4,8
27
+ edocapi-0.0.2.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ edocapi = edocapi.cli.main:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 EMMANUEL EMMANUEL ETIM
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ edocapi