Metadata-Version: 2.4
Name: nodetool-core
Version: 0.7.1
Summary: Nodetool Core is the core library for Nodetool, providing the necessary functionality for building and running AI workflows.
Author-email: Matthias Georgi <matti.georgi@gmail.com>
License-File: LICENSE
Requires-Python: >=3.11
Requires-Dist: aiofiles>=24.1.0
Requires-Dist: aiohttp>=3.13.1
Requires-Dist: brotli>=1.2.0
Requires-Dist: cryptography>=46.0.7
Requires-Dist: hf-transfer
Requires-Dist: hf-xet>=0.0.1
Requires-Dist: httpx>=0.27.2
Requires-Dist: huggingface-hub>=0.35.3
Requires-Dist: keyring>=25.5.0
Requires-Dist: msgpack>=1.1.0
Requires-Dist: numpy<2.5,>=2.0.0
Requires-Dist: pillow<13.0.0
Requires-Dist: psutil>=6.1.0
Requires-Dist: pycares<5
Requires-Dist: pydantic>=2.11.2
Requires-Dist: python-dotenv>=1.2.2
Requires-Dist: pyyaml>=6.0.2
Requires-Dist: tqdm>=4.67.0
Requires-Dist: websockets>=14.1
Provides-Extra: audio
Requires-Dist: pydub>=0.25.1; extra == 'audio'
Provides-Extra: data
Requires-Dist: ftfy>=6.3.1; extra == 'data'
Requires-Dist: joblib; extra == 'data'
Requires-Dist: networkx>=3.4.2; extra == 'data'
Requires-Dist: pandas>=2.2.3; extra == 'data'
Requires-Dist: tiktoken; extra == 'data'
Provides-Extra: dev
Requires-Dist: aioresponses>=0.7.8; extra == 'dev'
Requires-Dist: mypy>=1.0.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
Requires-Dist: pytest-cov>=7.0.0; extra == 'dev'
Requires-Dist: pytest-timeout>=2.3.1; extra == 'dev'
Requires-Dist: pytest-xdist>=3.6.0; extra == 'dev'
Requires-Dist: pytest>=9.0.3; extra == 'dev'
Requires-Dist: ruff==0.15.15; extra == 'dev'
Requires-Dist: ty>=0.0.7; extra == 'dev'
Provides-Extra: documents
Requires-Dist: html2text; extra == 'documents'
Requires-Dist: jinja2==3.1.6; extra == 'documents'
Requires-Dist: markitdown; extra == 'documents'
Requires-Dist: openpyxl>=3.1.3; extra == 'documents'
Requires-Dist: pdfplumber>=0.11.4; extra == 'documents'
Requires-Dist: pymupdf4llm>=0.0.27; extra == 'documents'
Requires-Dist: pymupdf>=1.25.2; extra == 'documents'
Requires-Dist: pypandoc>=1.14.0; extra == 'documents'
Requires-Dist: python-docx==1.2.0; extra == 'documents'
Provides-Extra: ocr
Requires-Dist: paddleocr>=3.2.0; extra == 'ocr'
Requires-Dist: paddlepaddle; extra == 'ocr'
Requires-Dist: pytesseract>=0.3.13; extra == 'ocr'
Provides-Extra: vectorstore
Requires-Dist: bs4==0.0.2; extra == 'vectorstore'
Requires-Dist: chromadb>=1.4.0; extra == 'vectorstore'
Requires-Dist: langchain-text-splitters==1.1.2; extra == 'vectorstore'
Provides-Extra: video
Requires-Dist: ffmpeg-python>=0.2.0; extra == 'video'
Requires-Dist: imageio-ffmpeg>=0.6.0; extra == 'video'
Requires-Dist: imageio>=2.37.0; extra == 'video'
Requires-Dist: opencv-python-headless>=4.11.0.86; extra == 'video'
Provides-Extra: viz
Requires-Dist: matplotlib==3.10.9; extra == 'viz'
Requires-Dist: seaborn>=0.13.2; extra == 'viz'
Description-Content-Type: text/markdown

# NodeTool Core

<h3>Python Node System & Worker</h3>

<p align="center">
  <img src="https://img.shields.io/badge/Python-3.11%2B-blue.svg" alt="Python Version Badge">
  <img src="https://img.shields.io/badge/License-AGPL%20v3-blue.svg" alt="License Badge">
</p>

NodeTool Core is the Python library that provides the node system and worker subprocess for [NodeTool](https://github.com/nodetool-ai/nodetool). The TypeScript server handles HTTP API, workflow orchestration, agents, and chat. Python handles node execution and local-compute providers (HuggingFace, MLX).

______________________________________________________________________

## What's Here

- **Node system** — `BaseNode`, `ProcessingContext`, type metadata
- **Worker subprocess** — `python -m nodetool.worker` communicates with the TS server via WebSocket+MessagePack
- **Provider infrastructure** — Base classes and registry for local-compute providers
- **Media processing** — Image, audio, video conversion utilities
- **DSL** — Graph construction and code generation helpers
- **Models** — Database models (Asset, Job, Secret, etc.)
- **Storage** — Abstract storage backends (memory, file, S3)

## Quick Start

```bash
# Install
conda create -n nodetool python=3.11 pandoc ffmpeg -c conda-forge
conda activate nodetool
uv sync

# Run tests
uv run pytest -q

# Start worker (normally spawned by TS server)
python -m nodetool.worker
```

## Writing Nodes

```python
from nodetool.workflows.base_node import BaseNode
from nodetool.workflows.processing_context import ProcessingContext

class MyNode(BaseNode):
    """
    Brief description
    tags, keywords, for, search
    """
    input_text: str = ""

    async def process(self, context: ProcessingContext) -> str:
        return self.input_text.upper()
```

Nodes use `ProcessingContext` for media conversion (`image_to_pil`, `audio_from_numpy`, etc.), secrets (`get_secret`), asset storage, and progress reporting.

## Architecture

```
TS Server (Fastify)
    ├── HTTP API, WebSocket, Auth
    ├── Workflow orchestration (DAG scheduling)
    ├── Cloud providers (OpenAI, Anthropic, Gemini, ...)
    └── Spawns Python worker subprocess
            ↕ WebSocket + MessagePack
Python Worker (this repo)
    ├── Node discovery & execution
    ├── Local providers (HuggingFace, MLX)
    └── Media processing (ffmpeg, PIL, numpy)
```

## External Node Packages

- **nodetool-huggingface** — HuggingFace model integrations + local provider
- **nodetool-mlx** — Apple Silicon optimized nodes + MLX provider
- **nodetool-replicate** — Replicate API integrations
- **nodetool-fal** — FAL AI service integrations
- **nodetool-elevenlabs** — ElevenLabs audio generation
- **nodetool-apple** — Apple platform integrations

## Development

```bash
# Setup
conda activate nodetool
uv sync --group dev

# Run tests
uv run pytest -q

# Lint
uv run ruff check .
```

## License

[AGPL License](LICENSE)

## Learn More

- [NodeTool Website](https://nodetool.ai)
- [Discord Community](https://discord.gg/nodetool)
