Skip to content

Commit bf3adee

Browse files
refactor: slim default dependencies and document optional extras
- Move MarkItDown to new `office_document` extra and lazy-load in markdown conversion - Remove bson usage; generate time-ordered IDs via `time_ns` + UUID fragment - Promote `pure-python-adb` to default deps; replace `android` extra in `all` - Relax Python constraint to `>=3.10` and align setup/readme docs - Remove obsolete mypy ignore for `bson`
1 parent a9847aa commit bf3adee

8 files changed

Lines changed: 2762 additions & 2021 deletions

File tree

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,37 @@ Ready to build your first agent? Check out our documentation:
129129

130130
## Quick Install
131131

132+
```bash
133+
pip install askui
134+
```
135+
136+
**Requires Python >=3.10*
137+
138+
The default install includes core dependencies (Agent OS client, HTTP, common model APIs, Android tooling, etc.). Add **optional extras** only when you need the features below.
139+
132140
```bash
133141
pip install askui[all]
134142
```
135143

136-
**Requires Python >=3.10, <3.14**
144+
`all` pulls in every optional extra in one command (larger install). Prefer picking individual extras when you know what you need. Or start using AskUI with a minimal install and add extras as you need them.
145+
146+
### Optional install extras
147+
148+
| Extra | When to use it |
149+
| --- | --- |
150+
| *(none)* | Everyday automation. Smallest footprint. |
151+
| `all` | You want every optional integration below without choosing extras (CI images, demos, or “install everything once”). |
152+
| `office-document` | Reading or converting **Office files** (Excel `.xls`/`.xlsx`, Word `.docx`) via MarkItDown—e.g. extracting content from spreadsheets or documents in workflows. To be used in `get()` methods. |
153+
| `bedrock` | Running **Anthropic Claude through AWS Bedrock** (`anthropic[bedrock]`). Use when your org routes Claude via Bedrock, not the direct Anthropic API. |
154+
| `vertex` | Running **Anthropic Claude on Google Vertex AI** plus Vertex client libraries. Use when models are hosted on Vertex, not only the public Anthropic API. |
155+
| `otel` | **OpenTelemetry** export and instrumentation you enable in code: OTLP over HTTP, plus optional instrumentation for `httpx` and SQLAlchemy. Use for production tracing/metrics pipelines—not required for local scripts. |
156+
| `web` | **Browser automation with Playwright** (e.g. web-focused agents and Playwright-backed flows). Core desktop control still uses Agent OS; this extra is for the Playwright stack. |
157+
158+
Combine extras as needed, for example:
159+
160+
```bash
161+
pip install askui[bedrock,otel]
162+
```
137163

138164
You'll also need to install AskUI Agent OS for device control. See [Setup Guide](docs/01_setup.md) for detailed instructions.
139165

docs/01_setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This guide will get AskUI Vision Agent installed and configured on your system.
44

55
## Python Package Installation
66

7-
AskUI Vision Agent requires Python >=3.10, and <3.14.
7+
AskUI Vision Agent requires Python >=3.10.
88

99
For installing the python-sdk please run
1010

docs/10_extracting_data.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ The AskUI Python SDK supports the use of various file formats.
4343
- Word Files (.docx, .doc)
4444
- CSV Files (.csv)
4545

46+
**Office documents (Excel and Word)** are loaded as `OfficeDocumentSource` and converted to Markdown with MarkItDown. That stack is optional: the base `askui` install does not include it. Install AskUI with the **office-document** extra when you use Excel or Word as `get()` sources:
47+
48+
```bash
49+
pip install "askui[office-document]"
50+
```
51+
4652
**Model Compatibility Matrix**
4753

4854
| File Format | AskUI Gemini | Anthropic Claude | Google Gemini

mypy.ini

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ namespace_packages = true
2424
[mypy-jsonref.*]
2525
ignore_missing_imports = true
2626

27-
[mypy-bson.*]
28-
ignore_missing_imports = true
29-
3027
[mypy-alembic.*]
3128
ignore_missing_imports = true
3229

pdm.lock

Lines changed: 2707 additions & 2002 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,16 @@ dependencies = [
2828
"protobuf>=6.31.1",
2929
"google-genai>=1.20.0",
3030
"filetype>=1.2.0",
31-
"markitdown[xls,xlsx,docx]>=0.1.2",
3231
"asyncer==0.0.8",
33-
"bson>=0.5.10",
3432
"aiofiles>=24.1.0",
3533
"anyio==4.10.0", # We need to pin this version otherwise listing mcp tools using fastmcp within runner fails
3634
"sqlalchemy[mypy]>=2.0.44",
3735
"apscheduler==4.0.0a6",
3836
"opentelemetry-api>=1.38.0",
3937
"imagehash>=4.3.0",
38+
"pure-python-adb>=0.3.0.dev0"
4039
]
41-
requires-python = ">=3.10,<3.14"
40+
requires-python = ">=3.10"
4241
readme = "README.md"
4342
license = {text = "MIT"}
4443
dynamic = ["version"]
@@ -217,9 +216,9 @@ known-first-party = ["askui"]
217216
known-third-party = ["pytest", "mypy"]
218217

219218
[project.optional-dependencies]
220-
all = ["askui[android,bedrock,otel,vertex,web]"]
221-
android = [
222-
"pure-python-adb>=0.3.0.dev0"
219+
all = ["askui[office-document,bedrock,otel,vertex,web]"]
220+
office-document = [
221+
"markitdown[xls,xlsx,docx]>=0.1.2"
223222
]
224223
bedrock = [
225224
"anthropic[bedrock]>=0.72.0"

src/askui/utils/id_utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
import time
2+
import uuid
13
from typing import Any
24

3-
import bson
45
from pydantic import Field
56

67

@@ -14,7 +15,9 @@ def generate_time_ordered_id(prefix: str) -> str:
1415
str: Time-ordered ID string
1516
"""
1617

17-
return f"{prefix}_{str(bson.ObjectId())}"
18+
timestamp_hex = f"{time.time_ns():x}"
19+
random_hex = uuid.uuid4().hex[:12]
20+
return f"{prefix}_{timestamp_hex}{random_hex}"
1821

1922

2023
def IdField(prefix: str) -> Any:

src/askui/utils/markdown_utils.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
from pathlib import Path
33
from typing import BinaryIO
44

5-
from markitdown import MarkItDown
6-
7-
_MARKDOWN_CONVERTER = MarkItDown()
8-
95

106
def convert_to_markdown(source: Path | bytes | BinaryIO) -> str:
117
"""Converts a source to markdown text.
@@ -16,9 +12,18 @@ def convert_to_markdown(source: Path | bytes | BinaryIO) -> str:
1612
Returns:
1713
str: The markdown representation of the source.
1814
"""
15+
try:
16+
from markitdown import MarkItDown
17+
except ImportError:
18+
error_msg = (
19+
"Office document support is not available."
20+
" Please install it with `pip install askui[office-document]`."
21+
)
22+
raise ImportError(error_msg) # noqa: B904
23+
markdown_converter = MarkItDown()
1924
if isinstance(source, bytes):
2025
bytes_source = BytesIO(source)
21-
result = _MARKDOWN_CONVERTER.convert(bytes_source)
26+
result = markdown_converter.convert(bytes_source)
2227
return result.text_content
23-
result = _MARKDOWN_CONVERTER.convert(source)
28+
result = markdown_converter.convert(source)
2429
return result.text_content

0 commit comments

Comments
 (0)