swarmauri_parser_pypdf2 0.8.0.dev4__tar.gz → 0.8.2.dev6__tar.gz
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.
- swarmauri_parser_pypdf2-0.8.2.dev6/PKG-INFO +104 -0
- swarmauri_parser_pypdf2-0.8.2.dev6/README.md +79 -0
- {swarmauri_parser_pypdf2-0.8.0.dev4 → swarmauri_parser_pypdf2-0.8.2.dev6}/pyproject.toml +10 -1
- swarmauri_parser_pypdf2-0.8.0.dev4/PKG-INFO +0 -68
- swarmauri_parser_pypdf2-0.8.0.dev4/README.md +0 -49
- {swarmauri_parser_pypdf2-0.8.0.dev4 → swarmauri_parser_pypdf2-0.8.2.dev6}/LICENSE +0 -0
- {swarmauri_parser_pypdf2-0.8.0.dev4 → swarmauri_parser_pypdf2-0.8.2.dev6}/swarmauri_parser_pypdf2/PyPDF2Parser.py +0 -0
- {swarmauri_parser_pypdf2-0.8.0.dev4 → swarmauri_parser_pypdf2-0.8.2.dev6}/swarmauri_parser_pypdf2/__init__.py +0 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: swarmauri_parser_pypdf2
|
|
3
|
+
Version: 0.8.2.dev6
|
|
4
|
+
Summary: PyPDF2 Parser for Swarmauri.
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: swarmauri,parser,pypdf2
|
|
8
|
+
Author: Jacob Stewart
|
|
9
|
+
Author-email: jacob@swarmauri.com
|
|
10
|
+
Requires-Python: >=3.10,<3.13
|
|
11
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Natural Language :: English
|
|
16
|
+
Classifier: Development Status :: 3 - Alpha
|
|
17
|
+
Classifier: Intended Audience :: Developers
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
19
|
+
Requires-Dist: PyPDF2 (>=3.0.1)
|
|
20
|
+
Requires-Dist: swarmauri_base
|
|
21
|
+
Requires-Dist: swarmauri_core
|
|
22
|
+
Requires-Dist: swarmauri_standard
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+

|
|
26
|
+
|
|
27
|
+
<p align="center">
|
|
28
|
+
<a href="https://pypi.org/project/swarmauri_parser_pypdf2/">
|
|
29
|
+
<img src="https://img.shields.io/pypi/dm/swarmauri_parser_pypdf2" alt="PyPI - Downloads"/></a>
|
|
30
|
+
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_parser_pypdf2/">
|
|
31
|
+
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_parser_pypdf2.svg"/></a>
|
|
32
|
+
<a href="https://pypi.org/project/swarmauri_parser_pypdf2/">
|
|
33
|
+
<img src="https://img.shields.io/pypi/pyversions/swarmauri_parser_pypdf2" alt="PyPI - Python Version"/></a>
|
|
34
|
+
<a href="https://pypi.org/project/swarmauri_parser_pypdf2/">
|
|
35
|
+
<img src="https://img.shields.io/pypi/l/swarmauri_parser_pypdf2" alt="PyPI - License"/></a>
|
|
36
|
+
<a href="https://pypi.org/project/swarmauri_parser_pypdf2/">
|
|
37
|
+
<img src="https://img.shields.io/pypi/v/swarmauri_parser_pypdf2?label=swarmauri_parser_pypdf2&color=green" alt="PyPI - swarmauri_parser_pypdf2"/></a>
|
|
38
|
+
</p>
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
# Swarmauri Parser PyPDF2
|
|
43
|
+
|
|
44
|
+
Lightweight PDF parser for Swarmauri that uses [PyPDF2](https://pypdf2.readthedocs.io/) to extract text from each page. Returns a `Document` per page with metadata describing the source file and page number.
|
|
45
|
+
|
|
46
|
+
## Features
|
|
47
|
+
|
|
48
|
+
- Handles PDF input from file paths or raw bytes.
|
|
49
|
+
- Produces one `Document` per page, storing text in `content` and metadata fields (`page_number`, `source`).
|
|
50
|
+
- Gracefully returns an empty list if PyPDF2 cannot extract text from a page (e.g., scanned PDFs without OCR).
|
|
51
|
+
|
|
52
|
+
## Prerequisites
|
|
53
|
+
|
|
54
|
+
- Python 3.10 or newer.
|
|
55
|
+
- PyPDF2 (installed automatically). For encrypted PDFs, ensure you provide access credentials before parsing.
|
|
56
|
+
|
|
57
|
+
## Installation
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# pip
|
|
61
|
+
pip install swarmauri_parser_pypdf2
|
|
62
|
+
|
|
63
|
+
# poetry
|
|
64
|
+
poetry add swarmauri_parser_pypdf2
|
|
65
|
+
|
|
66
|
+
# uv (pyproject-based projects)
|
|
67
|
+
uv add swarmauri_parser_pypdf2
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Quickstart
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
from swarmauri_parser_pypdf2 import PyPDF2Parser
|
|
74
|
+
|
|
75
|
+
parser = PyPDF2Parser()
|
|
76
|
+
documents = parser.parse("manuals/device.pdf")
|
|
77
|
+
|
|
78
|
+
for doc in documents:
|
|
79
|
+
print(doc.metadata["page_number"], doc.content[:120])
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Parsing PDF Bytes
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
from swarmauri_parser_pypdf2 import PyPDF2Parser
|
|
86
|
+
|
|
87
|
+
with open("statements/bank.pdf", "rb") as f:
|
|
88
|
+
pdf_bytes = f.read()
|
|
89
|
+
|
|
90
|
+
parser = PyPDF2Parser()
|
|
91
|
+
pages = parser.parse(pdf_bytes)
|
|
92
|
+
print(len(pages), "pages parsed from bytes")
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Tips
|
|
96
|
+
|
|
97
|
+
- PyPDF2 extracts text only when the PDF contains accessible text objects. For scanned documents, run OCR first (e.g., with `swarmauri_ocr_pytesseract`).
|
|
98
|
+
- Remove or handle password protection before parsing; PyPDF2 cannot decrypt files without the password.
|
|
99
|
+
- Combine this parser with Swarmauri chunkers or summarizers to process large documents efficiently.
|
|
100
|
+
|
|
101
|
+
## Want to help?
|
|
102
|
+
|
|
103
|
+
If you want to contribute to swarmauri-sdk, read up on our [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/contributing.md) that will help you get started.
|
|
104
|
+
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://pypi.org/project/swarmauri_parser_pypdf2/">
|
|
5
|
+
<img src="https://img.shields.io/pypi/dm/swarmauri_parser_pypdf2" alt="PyPI - Downloads"/></a>
|
|
6
|
+
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_parser_pypdf2/">
|
|
7
|
+
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_parser_pypdf2.svg"/></a>
|
|
8
|
+
<a href="https://pypi.org/project/swarmauri_parser_pypdf2/">
|
|
9
|
+
<img src="https://img.shields.io/pypi/pyversions/swarmauri_parser_pypdf2" alt="PyPI - Python Version"/></a>
|
|
10
|
+
<a href="https://pypi.org/project/swarmauri_parser_pypdf2/">
|
|
11
|
+
<img src="https://img.shields.io/pypi/l/swarmauri_parser_pypdf2" alt="PyPI - License"/></a>
|
|
12
|
+
<a href="https://pypi.org/project/swarmauri_parser_pypdf2/">
|
|
13
|
+
<img src="https://img.shields.io/pypi/v/swarmauri_parser_pypdf2?label=swarmauri_parser_pypdf2&color=green" alt="PyPI - swarmauri_parser_pypdf2"/></a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Swarmauri Parser PyPDF2
|
|
19
|
+
|
|
20
|
+
Lightweight PDF parser for Swarmauri that uses [PyPDF2](https://pypdf2.readthedocs.io/) to extract text from each page. Returns a `Document` per page with metadata describing the source file and page number.
|
|
21
|
+
|
|
22
|
+
## Features
|
|
23
|
+
|
|
24
|
+
- Handles PDF input from file paths or raw bytes.
|
|
25
|
+
- Produces one `Document` per page, storing text in `content` and metadata fields (`page_number`, `source`).
|
|
26
|
+
- Gracefully returns an empty list if PyPDF2 cannot extract text from a page (e.g., scanned PDFs without OCR).
|
|
27
|
+
|
|
28
|
+
## Prerequisites
|
|
29
|
+
|
|
30
|
+
- Python 3.10 or newer.
|
|
31
|
+
- PyPDF2 (installed automatically). For encrypted PDFs, ensure you provide access credentials before parsing.
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# pip
|
|
37
|
+
pip install swarmauri_parser_pypdf2
|
|
38
|
+
|
|
39
|
+
# poetry
|
|
40
|
+
poetry add swarmauri_parser_pypdf2
|
|
41
|
+
|
|
42
|
+
# uv (pyproject-based projects)
|
|
43
|
+
uv add swarmauri_parser_pypdf2
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Quickstart
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from swarmauri_parser_pypdf2 import PyPDF2Parser
|
|
50
|
+
|
|
51
|
+
parser = PyPDF2Parser()
|
|
52
|
+
documents = parser.parse("manuals/device.pdf")
|
|
53
|
+
|
|
54
|
+
for doc in documents:
|
|
55
|
+
print(doc.metadata["page_number"], doc.content[:120])
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Parsing PDF Bytes
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from swarmauri_parser_pypdf2 import PyPDF2Parser
|
|
62
|
+
|
|
63
|
+
with open("statements/bank.pdf", "rb") as f:
|
|
64
|
+
pdf_bytes = f.read()
|
|
65
|
+
|
|
66
|
+
parser = PyPDF2Parser()
|
|
67
|
+
pages = parser.parse(pdf_bytes)
|
|
68
|
+
print(len(pages), "pages parsed from bytes")
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Tips
|
|
72
|
+
|
|
73
|
+
- PyPDF2 extracts text only when the PDF contains accessible text objects. For scanned documents, run OCR first (e.g., with `swarmauri_ocr_pytesseract`).
|
|
74
|
+
- Remove or handle password protection before parsing; PyPDF2 cannot decrypt files without the password.
|
|
75
|
+
- Combine this parser with Swarmauri chunkers or summarizers to process large documents efficiently.
|
|
76
|
+
|
|
77
|
+
## Want to help?
|
|
78
|
+
|
|
79
|
+
If you want to contribute to swarmauri-sdk, read up on our [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/contributing.md) that will help you get started.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "swarmauri_parser_pypdf2"
|
|
3
|
-
version = "0.8.
|
|
3
|
+
version = "0.8.2.dev6"
|
|
4
4
|
description = "PyPDF2 Parser for Swarmauri."
|
|
5
5
|
license = "Apache-2.0"
|
|
6
6
|
readme = "README.md"
|
|
@@ -11,6 +11,10 @@ classifiers = [
|
|
|
11
11
|
"Programming Language :: Python :: 3.10",
|
|
12
12
|
"Programming Language :: Python :: 3.11",
|
|
13
13
|
"Programming Language :: Python :: 3.12",
|
|
14
|
+
"Natural Language :: English",
|
|
15
|
+
"Development Status :: 3 - Alpha",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"Topic :: Software Development :: Libraries :: Application Frameworks",
|
|
14
18
|
]
|
|
15
19
|
authors = [{ name = "Jacob Stewart", email = "jacob@swarmauri.com" }]
|
|
16
20
|
dependencies = [
|
|
@@ -19,6 +23,11 @@ dependencies = [
|
|
|
19
23
|
"swarmauri_base",
|
|
20
24
|
"swarmauri_standard",
|
|
21
25
|
]
|
|
26
|
+
keywords = [
|
|
27
|
+
"swarmauri",
|
|
28
|
+
"parser",
|
|
29
|
+
"pypdf2",
|
|
30
|
+
]
|
|
22
31
|
|
|
23
32
|
[tool.uv.sources]
|
|
24
33
|
swarmauri_core = { workspace = true }
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: swarmauri_parser_pypdf2
|
|
3
|
-
Version: 0.8.0.dev4
|
|
4
|
-
Summary: PyPDF2 Parser for Swarmauri.
|
|
5
|
-
License: Apache-2.0
|
|
6
|
-
Author: Jacob Stewart
|
|
7
|
-
Author-email: jacob@swarmauri.com
|
|
8
|
-
Requires-Python: >=3.10,<3.13
|
|
9
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
-
Requires-Dist: PyPDF2 (>=3.0.1)
|
|
14
|
-
Requires-Dist: swarmauri_base
|
|
15
|
-
Requires-Dist: swarmauri_core
|
|
16
|
-
Requires-Dist: swarmauri_standard
|
|
17
|
-
Description-Content-Type: text/markdown
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-

|
|
21
|
-
|
|
22
|
-
<p align="center">
|
|
23
|
-
<a href="https://pypi.org/project/swarmauri_parser_pypdf2/">
|
|
24
|
-
<img src="https://img.shields.io/pypi/dm/swarmauri_parser_pypdf2" alt="PyPI - Downloads"/></a>
|
|
25
|
-
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_parser_pypdf2/">
|
|
26
|
-
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_parser_pypdf2.svg"/></a>
|
|
27
|
-
<a href="https://pypi.org/project/swarmauri_parser_pypdf2/">
|
|
28
|
-
<img src="https://img.shields.io/pypi/pyversions/swarmauri_parser_pypdf2" alt="PyPI - Python Version"/></a>
|
|
29
|
-
<a href="https://pypi.org/project/swarmauri_parser_pypdf2/">
|
|
30
|
-
<img src="https://img.shields.io/pypi/l/swarmauri_parser_pypdf2" alt="PyPI - License"/></a>
|
|
31
|
-
<a href="https://pypi.org/project/swarmauri_parser_pypdf2/">
|
|
32
|
-
<img src="https://img.shields.io/pypi/v/swarmauri_parser_pypdf2?label=swarmauri_parser_pypdf2&color=green" alt="PyPI - swarmauri_parser_pypdf2"/></a>
|
|
33
|
-
</p>
|
|
34
|
-
|
|
35
|
-
---
|
|
36
|
-
|
|
37
|
-
# Swarmauri Parser PyPDF2
|
|
38
|
-
|
|
39
|
-
A parser for reading and extracting text from PDF files using PyPDF2.
|
|
40
|
-
|
|
41
|
-
## Installation
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
pip install swarmauri_parser_pypdf2
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## Usage
|
|
48
|
-
Basic usage examples with code snippets
|
|
49
|
-
```python
|
|
50
|
-
from swarmauri.parsers.PyPDF2Parser import PyPDF2Parser
|
|
51
|
-
|
|
52
|
-
parser = PyPDF2Parser()
|
|
53
|
-
|
|
54
|
-
# Parsing from a file path
|
|
55
|
-
documents = parser.parse("path/to/your/file.pdf")
|
|
56
|
-
for doc in documents:
|
|
57
|
-
print(doc.content)
|
|
58
|
-
|
|
59
|
-
# Parsing from bytes
|
|
60
|
-
pdf_bytes = b"%PDF-1.4 ... (binary content)"
|
|
61
|
-
documents = parser.parse(pdf_bytes)
|
|
62
|
-
for doc in documents:
|
|
63
|
-
print(doc.content)
|
|
64
|
-
```
|
|
65
|
-
## Want to help?
|
|
66
|
-
|
|
67
|
-
If you want to contribute to swarmauri-sdk, read up on our [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/contributing.md) that will help you get started.
|
|
68
|
-
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-

|
|
3
|
-
|
|
4
|
-
<p align="center">
|
|
5
|
-
<a href="https://pypi.org/project/swarmauri_parser_pypdf2/">
|
|
6
|
-
<img src="https://img.shields.io/pypi/dm/swarmauri_parser_pypdf2" alt="PyPI - Downloads"/></a>
|
|
7
|
-
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_parser_pypdf2/">
|
|
8
|
-
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_parser_pypdf2.svg"/></a>
|
|
9
|
-
<a href="https://pypi.org/project/swarmauri_parser_pypdf2/">
|
|
10
|
-
<img src="https://img.shields.io/pypi/pyversions/swarmauri_parser_pypdf2" alt="PyPI - Python Version"/></a>
|
|
11
|
-
<a href="https://pypi.org/project/swarmauri_parser_pypdf2/">
|
|
12
|
-
<img src="https://img.shields.io/pypi/l/swarmauri_parser_pypdf2" alt="PyPI - License"/></a>
|
|
13
|
-
<a href="https://pypi.org/project/swarmauri_parser_pypdf2/">
|
|
14
|
-
<img src="https://img.shields.io/pypi/v/swarmauri_parser_pypdf2?label=swarmauri_parser_pypdf2&color=green" alt="PyPI - swarmauri_parser_pypdf2"/></a>
|
|
15
|
-
</p>
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
# Swarmauri Parser PyPDF2
|
|
20
|
-
|
|
21
|
-
A parser for reading and extracting text from PDF files using PyPDF2.
|
|
22
|
-
|
|
23
|
-
## Installation
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
pip install swarmauri_parser_pypdf2
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## Usage
|
|
30
|
-
Basic usage examples with code snippets
|
|
31
|
-
```python
|
|
32
|
-
from swarmauri.parsers.PyPDF2Parser import PyPDF2Parser
|
|
33
|
-
|
|
34
|
-
parser = PyPDF2Parser()
|
|
35
|
-
|
|
36
|
-
# Parsing from a file path
|
|
37
|
-
documents = parser.parse("path/to/your/file.pdf")
|
|
38
|
-
for doc in documents:
|
|
39
|
-
print(doc.content)
|
|
40
|
-
|
|
41
|
-
# Parsing from bytes
|
|
42
|
-
pdf_bytes = b"%PDF-1.4 ... (binary content)"
|
|
43
|
-
documents = parser.parse(pdf_bytes)
|
|
44
|
-
for doc in documents:
|
|
45
|
-
print(doc.content)
|
|
46
|
-
```
|
|
47
|
-
## Want to help?
|
|
48
|
-
|
|
49
|
-
If you want to contribute to swarmauri-sdk, read up on our [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/contributing.md) that will help you get started.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|