Skip to main content

Python bindings for iMessage and Contacts database access

Project description

Text Imp

Python bindings for iMessage and Contacts database access. Requires MacOS and full file system access to run.

Requirements

  • Python >= 3.8
  • macOS (for iMessage database access)
  • uv package manager (recommended) or pip

Installation

This package requires Python 3.8 or later. We recommend using uv for package management.

Using uv (Recommended)

uv pip install text_imp

Using pip

pip install text_imp

Development Setup

  1. Clone the repository:
git clone https://github.com/yourusername/text_imp.git
cd text_imp
  1. Install uv if you haven't already:
curl -LsSf https://astral.sh/uv/install.sh | sh
  1. Create a virtual environment and install dependencies:
uv venv
source .venv/bin/activate  # On Unix/macOS
# or
.venv\Scripts\activate  # On Windows

# Install the package in editable mode with all dependencies
uv pip install -e .

Usage Example

import text_imp

# Get messages
messages = text_imp.get_messages()
print(messages)

# Get contacts
contacts = text_imp.get_contacts()
print(contacts)

# Get attachments
attachments = text_imp.get_attachments()
print(attachments)

# To join with messages table, use guid version of
# attachments with message guid
attachments_with_id = get_attachments_with_guid()
print(attachments_with_id)

# Get chats
chats = text_imp.get_chats()
print(chats)

# Get  handles
handles = text_imp.get_handles()
print(handles)

# Get chat handles
chat_handles = text_imp.get_chat_handles()
print(handles)

Example Data

Each function returns a Polars DataFrame with structured data. Here are examples of what the returned data looks like:

Messages DataFrame

Columns: date, text, is_from_me, handle_id, chat_id, guid, thread_originator_guid, thread_originator_part, service_type, variant, expressive, announcement_type, num_attachments, is_deleted, group_title, is_edited, is_tapback, is_reply, num_replies, date_delivered, date_read, is_url, has_replies, body

Message DataFrame Example

Contacts DataFrame

Columns: contact_id, first_name, last_name, state, city, normalized_contact_id

Contacts DataFrame Example

Attachments DataFrame

Columns: rowid, filename, uti, mime_type, transfer_name, emoji_description, is_sticker, path, extension, display_filename, file_size

Attachments DataFrame Example

Chats DataFrame

Columns: rowid, chat_identifier, service_name, display_name, name, resolved_display_name

Chats DataFrame Example

Handles DataFrame

Columns: rowid, id, person_centric_id

Handles DataFrame Example

Chat Handles DataFrame

Columns: chat_id, handle_id

Chat Handles DataFrame Example

Project Structure

text_imp/
├── src/           # Rust source code
├── text_imp/      # Python package directory
├── examples/      # Usage examples
├── tests/         # Test files
├── Cargo.toml     # Rust dependencies and configuration
└── pyproject.toml # Python package configuration

Building from Source

The package uses Maturin for building the Rust extensions. To build from source:

# Using uv
uv pip install -e .

# Or verify the installation
uv run --with text_imp --no-project -- python -c "import text_imp"

Troubleshooting

If you encounter the error AttributeError: module 'text_imp' has no attribute 'get_messages', try the following:

  1. Make sure you're on macOS (this package only works on macOS)
  2. Reinstall the package:
uv pip uninstall text_imp
uv pip install text_imp
  1. If installing from source, rebuild the package:
uv pip install -e .

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

text_imp-0.2.0.tar.gz (1.5 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

text_imp-0.2.0-cp312-cp312-macosx_11_0_arm64.whl (3.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

text_imp-0.2.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (6.8 MB view details)

Uploaded CPython 3.12macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

Details for the file text_imp-0.2.0.tar.gz.

File metadata

  • Download URL: text_imp-0.2.0.tar.gz
  • Upload date:
  • Size: 1.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.6

File hashes

Hashes for text_imp-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b5b8c264626076b5e7f72af354447dcfd213672abc1413acbec8a389e7660bc1
MD5 23452874700ab5ee5cc56f82409e5678
BLAKE2b-256 6d1aac0c3db80f2a66f4275cc2fee9cafee32693b3c558a62c21510f53b95f88

See more details on using hashes here.

File details

Details for the file text_imp-0.2.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for text_imp-0.2.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8f08b41f63cb69edbe22b54a812769a438473417274c3531a0acf4bbe2f9a977
MD5 7454a0ebb25bf59e66699586becb0851
BLAKE2b-256 5b1b04e04289bd3dead549cabfa2ead2d99f5283846a37e7b20491f3c8bd5ac5

See more details on using hashes here.

File details

Details for the file text_imp-0.2.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for text_imp-0.2.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 0e4caaa70548990584ce57fb477dedb36b773679bcd646e27baf99b4e8d4972b
MD5 104629a0a51c7f950b9920e72f0837a4
BLAKE2b-256 4c574b13f4a2b5f5158b63da9c598f22086191b30d897d33592db083d51391cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for text_imp-0.2.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:

Publisher: publish.yml on aglucky/text_imp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page