Skip to main content

A Python library for syncing and managing Pinboard bookmarks

Project description

pinboard-tools

PyPI version Python versions License

A Python library for syncing and managing Pinboard bookmarks.

Features

  • Bidirectional sync with Pinboard.in API
  • SQLite database for local bookmark storage
  • Tag analysis and similarity detection
  • Conflict resolution for sync operations
  • Rate limiting to respect API limits
  • Chunking utilities for LLM processing

Installation

pip install pinboard-tools

Quick Start

from pinboard_tools import (
    init_database,
    get_session,
    PinboardAPI,
    BidirectionalSync,
)

# Initialize database
init_database("bookmarks.db")

# Set up API client
api = PinboardAPI(api_token="your-pinboard-api-token")

# Create sync engine
with get_session() as session:
    sync = BidirectionalSync(session, api)
    
    # Perform full sync
    stats = sync.sync()
    print(f"Added: {stats['added']}, Updated: {stats['updated']}")

Core Components

Database Models

  • Bookmark - Bookmark entity with all Pinboard fields
  • Tag - Tag entity with normalization
  • BookmarkTag - Many-to-many relationship
  • SyncStatus - Track sync state

Sync Engine

  • PinboardAPI - API client with rate limiting
  • BidirectionalSync - Full sync with conflict resolution

Tag Analysis

  • TagSimilarityDetector - Find similar tags
  • TagConsolidator - Merge duplicate tags

Utilities

  • chunk_bookmarks_for_llm - Prepare data for LLM processing
  • DateTime helpers for Pinboard format

Database Schema

The library uses a normalized SQLite schema:

-- See schema.sql for complete structure
bookmarks (url, title, description, tags, time, ...)
tags (name, normalized_name)
bookmark_tags (bookmark_id, tag_id)
sync_status (last_sync, last_update)

API Reference

Initialization

# Initialize database with schema
init_database(db_path: str)

# Get database session
with get_session() as session:
    # Use session for queries

Syncing

# Create API client
api = PinboardAPI(api_token="your-token")

# Sync bookmarks
sync = BidirectionalSync(session, api)
stats = sync.sync(full_sync=False)

Tag Analysis

# Find similar tags
detector = TagSimilarityDetector(session)
similar_groups = detector.find_similar_tags(threshold=0.8)

# Consolidate tags
consolidator = TagConsolidator(session)
consolidator.consolidate_tags(old_tag="python3", new_tag="python")

License

Apache License 2.0 - see LICENSE file for details

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

pinboard_tools-0.1.4.tar.gz (75.6 kB view details)

Uploaded Source

Built Distribution

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

pinboard_tools-0.1.4-py3-none-any.whl (27.0 kB view details)

Uploaded Python 3

File details

Details for the file pinboard_tools-0.1.4.tar.gz.

File metadata

  • Download URL: pinboard_tools-0.1.4.tar.gz
  • Upload date:
  • Size: 75.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for pinboard_tools-0.1.4.tar.gz
Algorithm Hash digest
SHA256 9d43c548954d7d323a0051e04501025e12a118e2ab1e66b0e03cf74bba3de623
MD5 839476a5fbdf7fa7475f438a55273c65
BLAKE2b-256 abca71457c727aa002a4c99f8dcac02aed7626b389d9e9a03a689c5c84553e8c

See more details on using hashes here.

File details

Details for the file pinboard_tools-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: pinboard_tools-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 27.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for pinboard_tools-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2137acb825ba4549d4868bebbfa2d287dfc94a260722baf9fe32f255e0a57fce
MD5 c5d3c7c6a98e7c842a14dec77da369ef
BLAKE2b-256 c97dc742a15cf7f04680869d84e93eeb0d10bbfda3b9356fb7a4a99773da93ea

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