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.0-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.0-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.0-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.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for daro-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c7637a48f3f7e2f60b985dfa64c3c30794c07b0ef65c973c379f86f393988a27
MD5 07335af9af5196c1e6e9bdd0c1bcc665
BLAKE2b-256 14bd89e23de8dca5c6862ea091ab0774c4dfaf348347606b84070b644c6f12dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for daro-0.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f9f40f0cfe08ee11a928926bd7b04a8ae8cb5fe0ff0383c0d80336841cca9b0d
MD5 e288a21e6ba33794e24060c86056b749
BLAKE2b-256 ead970e47c830375a5c557ee48c413b881f5d5b6607734206f6b8f0a266996a5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: daro-0.1.0-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.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 304e23acef56ca2aee2cf5d82a4ef5bad7d547c29129f57bec3da60e3b7107d7
MD5 d3ac595468d08662744a0f2537f4c6fd
BLAKE2b-256 68555907afb6ab08bfbeb49458751829030fa9862fe51d4e85fce4b316d65580

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