A Pydantic-based implementation of the vCon (Virtual Conversation Container) format.
# Using pip
pip install pydantic-vcon
# Using Poetry
poetry add pydantic-vcon
This project uses Poetry for dependency management and packaging.
# Install Poetry (if not already installed)
curl -sSL https://install.python-poetry.org | python3 -
# Clone the repository
git clone https://github.com/howethomas/pydantic-vcon.git
cd pydantic-vcon
# Install dependencies
poetry install
# Run tests
poetry run pytest
# Format code
poetry run black .
poetry run isort .
# Type checking
poetry run mypy .
# Linting
poetry run ruff check .
from pydantic_vcon import VCon, Party, Dialog, DialogType, Encoding
from datetime import datetime
# Create a new vCon
vcon = VCon.build_new()
# Add a party
party = Party(
tel="+1234567890",
name="John Doe"
)
vcon.add_party(party)
# Add a dialog
dialog = Dialog(
type=DialogType.TEXT,
start=datetime.now(),
parties=0, # Reference to the first party
body="Hello, world!",
encoding=Encoding.JSON
)
vcon.add_dialog(dialog)
# Convert to JSON
json_str = vcon.to_json()
- Full implementation of the vCon format using Pydantic models
- Type validation and automatic conversion
- JSON serialization/deserialization
- Helper methods for common operations
- Comprehensive validation
For detailed documentation, please visit the documentation site.
This project is licensed under the MIT License - see the LICENSE file for details.