attachments 0.5.2__tar.gz → 0.5.4__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.
- {attachments-0.5.2/src/attachments.egg-info → attachments-0.5.4}/PKG-INFO +38 -1
- {attachments-0.5.2 → attachments-0.5.4}/README.md +36 -0
- {attachments-0.5.2 → attachments-0.5.4}/pyproject.toml +4 -3
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/__init__.py +1 -1
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/presenters/visual/images.py +27 -2
- {attachments-0.5.2 → attachments-0.5.4/src/attachments.egg-info}/PKG-INFO +38 -1
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments.egg-info/requires.txt +1 -0
- {attachments-0.5.2 → attachments-0.5.4}/LICENSE +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/setup.cfg +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/adapt.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/core.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/data/__init__.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/highest_level_api.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/load.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/loaders/__init__.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/loaders/data/__init__.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/loaders/data/csv.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/loaders/documents/__init__.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/loaders/documents/office.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/loaders/documents/pdf.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/loaders/documents/text.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/loaders/media/__init__.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/loaders/media/archives.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/loaders/media/images.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/loaders/repositories/__init__.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/loaders/repositories/directories.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/loaders/repositories/git.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/loaders/repositories/utils.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/loaders/web/__init__.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/loaders/web/urls.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/matchers.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/modify.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/pipelines/__init__.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/pipelines/csv_processor.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/pipelines/docx_processor.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/pipelines/example_processors.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/pipelines/excel_processor.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/pipelines/image_processor.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/pipelines/pdf_processor.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/pipelines/pptx_processor.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/pipelines/webpage_processor.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/present.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/presenters/__init__.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/presenters/data/__init__.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/presenters/data/repositories.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/presenters/data/summaries.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/presenters/metadata/__init__.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/presenters/metadata/info.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/presenters/text/__init__.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/presenters/text/markdown.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/presenters/text/ocr.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/presenters/text/plain.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/presenters/text/structured.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/presenters/visual/__init__.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/py.typed +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/refine.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments/split.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments.egg-info/SOURCES.txt +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments.egg-info/dependency_links.txt +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments.egg-info/not-zip-safe +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/src/attachments.egg-info/top_level.txt +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/tests/test_api_methods.py +0 -0
- {attachments-0.5.2 → attachments-0.5.4}/tests/test_smoke.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: attachments
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.4
|
|
4
4
|
Summary: The Python funnel for LLM context - turn any file into model-ready text + images, in one line.
|
|
5
5
|
Author-email: Maxime Rivest <mrive052@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -27,6 +27,7 @@ Description-Content-Type: text/markdown
|
|
|
27
27
|
License-File: LICENSE
|
|
28
28
|
Requires-Dist: requests>=2.25.0
|
|
29
29
|
Requires-Dist: beautifulsoup4>=4.9.0
|
|
30
|
+
Requires-Dist: playwright>=1.52.0
|
|
30
31
|
Provides-Extra: dev
|
|
31
32
|
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
32
33
|
Requires-Dist: pytest-randomly>=3.15.0; extra == "dev"
|
|
@@ -243,6 +244,42 @@ result = rag(
|
|
|
243
244
|
print(result.answer)
|
|
244
245
|
```
|
|
245
246
|
|
|
247
|
+
### Optional: CSS Selector Highlighting 🎯
|
|
248
|
+
|
|
249
|
+
For advanced web scraping with visual element highlighting in screenshots:
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
# Install Playwright for CSS selector highlighting
|
|
253
|
+
pip install playwright
|
|
254
|
+
playwright install chromium
|
|
255
|
+
|
|
256
|
+
# Or with uv
|
|
257
|
+
uv add playwright
|
|
258
|
+
uv run playwright install chromium
|
|
259
|
+
|
|
260
|
+
# Or install with browser extras
|
|
261
|
+
pip install attachments[browser]
|
|
262
|
+
playwright install chromium
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
**What this enables:**
|
|
266
|
+
- 🎯 Visual highlighting of selected elements with animations
|
|
267
|
+
- 📸 High-quality screenshots with JavaScript rendering
|
|
268
|
+
- 🎨 Professional styling with glowing borders and badges
|
|
269
|
+
- 🔍 Perfect for extracting specific page elements
|
|
270
|
+
|
|
271
|
+
```python
|
|
272
|
+
# CSS selector highlighting examples
|
|
273
|
+
title = Attachments("https://example.com[select:h1]") # Highlights H1 elements
|
|
274
|
+
content = Attachments("https://example.com[select:.content]") # Highlights .content class
|
|
275
|
+
main = Attachments("https://example.com[select:#main]") # Highlights #main ID
|
|
276
|
+
|
|
277
|
+
# Multiple elements with counters and different colors
|
|
278
|
+
multi = Attachments("https://example.com[select:h1, .important][viewport:1920x1080]")
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
*Note: Without Playwright, CSS selectors still work for text extraction, but no visual highlighting screenshots are generated.*
|
|
282
|
+
|
|
246
283
|
### Advanced Pipeline Processing
|
|
247
284
|
|
|
248
285
|
For power users, use the full grammar system with composable pipelines:
|
|
@@ -147,6 +147,42 @@ result = rag(
|
|
|
147
147
|
print(result.answer)
|
|
148
148
|
```
|
|
149
149
|
|
|
150
|
+
### Optional: CSS Selector Highlighting 🎯
|
|
151
|
+
|
|
152
|
+
For advanced web scraping with visual element highlighting in screenshots:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# Install Playwright for CSS selector highlighting
|
|
156
|
+
pip install playwright
|
|
157
|
+
playwright install chromium
|
|
158
|
+
|
|
159
|
+
# Or with uv
|
|
160
|
+
uv add playwright
|
|
161
|
+
uv run playwright install chromium
|
|
162
|
+
|
|
163
|
+
# Or install with browser extras
|
|
164
|
+
pip install attachments[browser]
|
|
165
|
+
playwright install chromium
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**What this enables:**
|
|
169
|
+
- 🎯 Visual highlighting of selected elements with animations
|
|
170
|
+
- 📸 High-quality screenshots with JavaScript rendering
|
|
171
|
+
- 🎨 Professional styling with glowing borders and badges
|
|
172
|
+
- 🔍 Perfect for extracting specific page elements
|
|
173
|
+
|
|
174
|
+
```python
|
|
175
|
+
# CSS selector highlighting examples
|
|
176
|
+
title = Attachments("https://example.com[select:h1]") # Highlights H1 elements
|
|
177
|
+
content = Attachments("https://example.com[select:.content]") # Highlights .content class
|
|
178
|
+
main = Attachments("https://example.com[select:#main]") # Highlights #main ID
|
|
179
|
+
|
|
180
|
+
# Multiple elements with counters and different colors
|
|
181
|
+
multi = Attachments("https://example.com[select:h1, .important][viewport:1920x1080]")
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
*Note: Without Playwright, CSS selectors still work for text extraction, but no visual highlighting screenshots are generated.*
|
|
185
|
+
|
|
150
186
|
### Advanced Pipeline Processing
|
|
151
187
|
|
|
152
188
|
For power users, use the full grammar system with composable pipelines:
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "attachments"
|
|
7
|
-
version = "0.5.
|
|
7
|
+
version = "0.5.4"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name="Maxime Rivest", email="mrive052@gmail.com" },
|
|
10
10
|
]
|
|
@@ -31,8 +31,9 @@ keywords = ["llm", "ai", "pdf", "document", "multimodal", "openai", "claude" , "
|
|
|
31
31
|
# Core dependencies for the modular architecture
|
|
32
32
|
dependencies = [
|
|
33
33
|
# Core file processing
|
|
34
|
-
"requests>=2.25.0",
|
|
35
|
-
"beautifulsoup4>=4.9.0",
|
|
34
|
+
"requests>=2.25.0", # HTTP library for URL processing and web content
|
|
35
|
+
"beautifulsoup4>=4.9.0", # HTML parsing for web content and HTML files
|
|
36
|
+
"playwright>=1.52.0",
|
|
36
37
|
]
|
|
37
38
|
|
|
38
39
|
[project.urls]
|
|
@@ -31,7 +31,7 @@ adapt = SmartVerbNamespace(_adapters)
|
|
|
31
31
|
refine = SmartVerbNamespace(_refiners)
|
|
32
32
|
split = SmartVerbNamespace(_modifiers) # Split functions are also modifiers
|
|
33
33
|
|
|
34
|
-
__version__ = "0.5.
|
|
34
|
+
__version__ = "0.5.4"
|
|
35
35
|
|
|
36
36
|
__all__ = [
|
|
37
37
|
# Core classes and functions
|
|
@@ -597,8 +597,33 @@ def images(att: Attachment, soup: 'bs4.BeautifulSoup') -> Attachment:
|
|
|
597
597
|
try:
|
|
598
598
|
from playwright.async_api import async_playwright
|
|
599
599
|
except ImportError:
|
|
600
|
-
|
|
601
|
-
|
|
600
|
+
# Check if CSS selector was requested (which requires Playwright for highlighting)
|
|
601
|
+
css_selector = att.commands.get('select')
|
|
602
|
+
if css_selector:
|
|
603
|
+
# CSS selector highlighting was requested but Playwright isn't available
|
|
604
|
+
error_msg = (
|
|
605
|
+
f"🎯 CSS Selector Highlighting Unavailable: You requested CSS selector highlighting "
|
|
606
|
+
f"with [select:{css_selector}], but Playwright is not installed.\n\n"
|
|
607
|
+
f"To enable CSS selector highlighting and webpage screenshots:\n"
|
|
608
|
+
f" pip install playwright\n"
|
|
609
|
+
f" playwright install chromium\n\n"
|
|
610
|
+
f"Alternative installation methods:\n"
|
|
611
|
+
f" # With uv:\n"
|
|
612
|
+
f" uv add playwright\n"
|
|
613
|
+
f" uv run playwright install chromium\n\n"
|
|
614
|
+
f" # With attachments browser extras:\n"
|
|
615
|
+
f" pip install attachments[browser]\n"
|
|
616
|
+
f" playwright install chromium\n\n"
|
|
617
|
+
f"CSS selector highlighting provides:\n"
|
|
618
|
+
f" 🎯 Visual highlighting of selected elements with animations\n"
|
|
619
|
+
f" 📸 High-quality screenshots with JavaScript rendering\n"
|
|
620
|
+
f" 🎨 Professional styling with glowing borders and badges\n"
|
|
621
|
+
f" 🔍 Perfect for extracting specific page elements"
|
|
622
|
+
)
|
|
623
|
+
raise ImportError(error_msg)
|
|
624
|
+
else:
|
|
625
|
+
# Regular screenshot was requested
|
|
626
|
+
raise ImportError("Playwright not available. Install with: pip install playwright && playwright install chromium")
|
|
602
627
|
|
|
603
628
|
try:
|
|
604
629
|
import asyncio
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: attachments
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.4
|
|
4
4
|
Summary: The Python funnel for LLM context - turn any file into model-ready text + images, in one line.
|
|
5
5
|
Author-email: Maxime Rivest <mrive052@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -27,6 +27,7 @@ Description-Content-Type: text/markdown
|
|
|
27
27
|
License-File: LICENSE
|
|
28
28
|
Requires-Dist: requests>=2.25.0
|
|
29
29
|
Requires-Dist: beautifulsoup4>=4.9.0
|
|
30
|
+
Requires-Dist: playwright>=1.52.0
|
|
30
31
|
Provides-Extra: dev
|
|
31
32
|
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
32
33
|
Requires-Dist: pytest-randomly>=3.15.0; extra == "dev"
|
|
@@ -243,6 +244,42 @@ result = rag(
|
|
|
243
244
|
print(result.answer)
|
|
244
245
|
```
|
|
245
246
|
|
|
247
|
+
### Optional: CSS Selector Highlighting 🎯
|
|
248
|
+
|
|
249
|
+
For advanced web scraping with visual element highlighting in screenshots:
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
# Install Playwright for CSS selector highlighting
|
|
253
|
+
pip install playwright
|
|
254
|
+
playwright install chromium
|
|
255
|
+
|
|
256
|
+
# Or with uv
|
|
257
|
+
uv add playwright
|
|
258
|
+
uv run playwright install chromium
|
|
259
|
+
|
|
260
|
+
# Or install with browser extras
|
|
261
|
+
pip install attachments[browser]
|
|
262
|
+
playwright install chromium
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
**What this enables:**
|
|
266
|
+
- 🎯 Visual highlighting of selected elements with animations
|
|
267
|
+
- 📸 High-quality screenshots with JavaScript rendering
|
|
268
|
+
- 🎨 Professional styling with glowing borders and badges
|
|
269
|
+
- 🔍 Perfect for extracting specific page elements
|
|
270
|
+
|
|
271
|
+
```python
|
|
272
|
+
# CSS selector highlighting examples
|
|
273
|
+
title = Attachments("https://example.com[select:h1]") # Highlights H1 elements
|
|
274
|
+
content = Attachments("https://example.com[select:.content]") # Highlights .content class
|
|
275
|
+
main = Attachments("https://example.com[select:#main]") # Highlights #main ID
|
|
276
|
+
|
|
277
|
+
# Multiple elements with counters and different colors
|
|
278
|
+
multi = Attachments("https://example.com[select:h1, .important][viewport:1920x1080]")
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
*Note: Without Playwright, CSS selectors still work for text extraction, but no visual highlighting screenshots are generated.*
|
|
282
|
+
|
|
246
283
|
### Advanced Pipeline Processing
|
|
247
284
|
|
|
248
285
|
For power users, use the full grammar system with composable pipelines:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|