Skip to main content

A CLI tool for managing personal board data with IM sync - Python bindings for daro Rust CLI

Project description

daro - Python Package

PyPI version Python versions

A CLI tool for managing personal board data with IM sync - Python bindings for the daro Rust CLI.

Features

  • Hybrid CLI: Automatically uses Rust daro binary if installed, falls back to Python implementation
  • Full Rust API Access: All core daro functionality available in Python via maturin bindings
  • CLI Commands: Complete CLI interface matching the Rust daro commands
  • TUI Interface: Direct access to the full-featured Rust TUI with real-time IM sync
  • Type Safety: Strongly-typed Python bindings using PyO3

How It Works

The daro Python CLI uses a smart hybrid approach:

  1. Rust Binary Preferred: When you run daro command, it first checks if the Rust daro binary is installed on your system
  2. Seamless Delegation: If Rust daro is found, all commands are delegated to it for maximum performance and features
  3. Python Fallback: If Rust daro is not available, it falls back to the Python implementation using Rust bindings
  4. Check Status: Run daro doctor to see which implementation is being used
$ daro doctor
Daro CLI
========

Version: 0.1.0
Build time: 2026-03-28T09:36:33.389017+00:00

Rust version: 1.91.0
Platform: macos aarch64
Config directory: /Users/jintian/.config/daro

Installation

Prerequisites

  1. Rust toolchain (for building from source):

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    
  2. Python 3.8+

  3. maturin (for building):

    pip install maturin
    

Install from PyPI (recommended)

pip install daro

Install from source

# Clone the repository
cd daro-py

# Install with maturin
maturin develop --release

# Or build and install
maturin build --release
pip install target/wheels/daro-*.whl

Usage

CLI Commands

# Check version
daro --version

# Login
daro login -u your_username

# Check login status
daro status

# Logout
daro logout

# Add a new board item
daro add -T "My Todo" -c "Description" -y Todo

# Add interactively
daro add -i

# List items
daro list
daro list -t Todo --page 1
daro list -s "search term"

# Edit an item
daro edit <id> -T "New Title" -c "New content"

# Delete an item
daro delete <id>

# Show statistics
daro stats

# Run TUI (full Rust TUI experience)
daro tui

Python API

from daro import DaroDb, DaroAuth, PyBoardDataType, PyBoardDataStatus

# Authentication
auth = DaroAuth()

# Login
user = auth.login("username", "password")
print(f"Logged in as: {user.user_nick_name}")

# Check login status
if auth.is_logged_in():
    print(f"Username: {auth.get_username()}")

# Database operations
db = DaroDb()  # Uses default path ~/.config/daro/daro.db

# Create a board item
item = db.create_board(
    title="My Task",
    content="Task description",
    board_type=PyBoardDataType.Todo,
)
print(f"Created: {item.id}")

# Get a board item
item = db.get_board(item.id)
print(f"Title: {item.title}")
print(f"Type: {item.type.label()}")  # Chinese label: 待办

# Update a board item
updated = db.update_board(
    id=item.id,
    title="Updated Title",
    status=PyBoardDataStatus.Done,
)

# List board items
items = db.list_boards(page=0, per_page=20)
for item in items:
    print(f"{item.title} - {item.status}")

# Filter by type
todos = db.list_boards(page=0, per_page=20, board_type=PyBoardDataType.Todo)

# Search
results = db.search_boards("keyword")

# Get statistics
stats = db.get_stats()
print(f"Total: {stats['total']}")
print(f"By type: {stats['by_type']}")
print(f"By status: {stats['by_status']}")

# Delete a board item
db.delete_board(item.id)

# Logout
auth.logout()

Board Data Types

from daro import PyBoardDataType

# All available types
PyBoardDataType.Todo       # 待办
PyBoardDataType.Thought    # 思考
PyBoardDataType.Note       # 笔记
PyBoardDataType.Diary      # 日记
PyBoardDataType.Clip       # 碎碎念
PyBoardDataType.Image      # 图片
PyBoardDataType.Link       # 链接
PyBoardDataType.Word       # 单词
PyBoardDataType.Video      # 视频
PyBoardDataType.Audio      # 声音
PyBoardDataType.Prompt     # 提示词
PyBoardDataType.Feed       # Feed流
PyBoardDataType.Book       # 书籍
PyBoardDataType.Paper      # 论文
PyBoardDataType.Transaction # 记账
PyBoardDataType.Quote      # 慧语
PyBoardDataType.Group      # 分组
PyBoardDataType.Other      # 其他

Board Data Status

from daro import PyBoardDataStatus

PyBoardDataStatus.Todo
PyBoardDataStatus.Doing
PyBoardDataStatus.Done
PyBoardDataStatus.Archived

TUI Mode

The daro tui command launches the full Rust TUI with all features:

  • Real-time IM sync with memox messages
  • Keyboard shortcuts:
    • n - Create new item
    • e - Edit selected item
    • d - Delete selected item
    • Tab - Switch focus
    • Enter - Toggle preview
    • s - Cycle view mode
    • h - Show help
    • q - Quit
  • Content-only editing mode (i key)
  • Settings popup (Shift+S)
  • Preview panel (p key)

Configuration

Configuration is stored at ~/.config/daro/config.toml:

api_url = "http://ark.manaai.cn/api/v1"
im_broker_url = "ark.manaai.cn"
mqtt_port = 1883
base_url = "https://ark.manaai.cn"
database = { path = "daro.db" }

Credentials are encrypted and stored at ~/.config/daro/credential.

Development

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black daro/
ruff check daro/

# Build wheel
maturin build --release

# Test installation
pip install target/wheels/daro-*.whl

Architecture

daro Python Package
├── daro._daro (Rust extension module via maturin)
│   ├── DaroDb - Database operations
│   ├── DaroAuth - Authentication
│   ├── PyBoardDataType - Type enum
│   ├── PyBoardDataStatus - Status enum
│   └── PyBoardData - Data class
├── daro.cli (Python CLI using click)
│   ├── login/logout/status
│   ├── add/edit/delete/list
│   ├── stats
│   └── tui (calls Rust TUI)
└── daro.tui (Python wrapper)
    └── Invokes Rust daro tui command

License

MIT License

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

For issues and feature requests, please use the GitHub issue tracker.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

daro-0.1.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.5 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

daro-0.1.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (7.0 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

daro-0.1.1-cp38-abi3-macosx_11_0_arm64.whl (6.7 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

File details

Details for the file daro-0.1.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for daro-0.1.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 649bd77e606fc80cc2a3ba3c3cdaeb9feeb7e54fba7047161a1551831491ba24
MD5 ef82ad2ec39fc6dc1baea976d8a72a86
BLAKE2b-256 ad639c137946280fbea4a3feee81e0e5329c71f50f267da7c18ab07c2aaee50d

See more details on using hashes here.

File details

Details for the file daro-0.1.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for daro-0.1.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7ddee3e4b53e27e2726f89ff2fd8d3aec565f945c8f8e3e0553b12517bf5d039
MD5 59ad8d065b0a53592b70d41bd43dbdaa
BLAKE2b-256 c31ef53eea2b58845bb93d1459d3397521f20773f9bfb2c1413c09ca19153d78

See more details on using hashes here.

File details

Details for the file daro-0.1.1-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: daro-0.1.1-cp38-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 6.7 MB
  • Tags: CPython 3.8+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for daro-0.1.1-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 01d2ff7eeebd79cb99d745e94bf43d57ac4d2f40dbfe4b49acad9adf4c42e307
MD5 58efda63744d9ad6c158728042408cc7
BLAKE2b-256 93b096aa15ea6bdf81a3fb07b94fdefafc60762f3597f2f2223fed9f295ac540

See more details on using hashes here.

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