Skip to main content

AI-powered Pinboard bookmark manager using AI for tagging and summarization

Project description

๐Ÿ“š smartpin (pinit CLI)

Python License Version

AI-powered Pinboard bookmark manager that automatically extracts metadata from web pages

smartpin installs the CLI tool pinit, which intelligently analyzes web pages and creates perfectly organized bookmarks for your Pinboard account. Just provide a URL, and AI will extract the title, generate a concise description, and suggest relevant tags - no manual data entry required! ๐Ÿค–โœจ

โœจ Features

  • ๐Ÿค– Automatic metadata extraction - AI analyzes pages to extract title, description, and relevant tags
  • ๐ŸŽฏ Smart tagging - AI suggests contextually appropriate tags for better organization
  • ๐Ÿ”„ Flexible AI models - Supports Claude, GPT-4, Gemini, and other LLM providers
  • ๐ŸŒ Reliable content fetching - Local HTTP client with BeautifulSoup for robust page parsing (v0.2.0)
  • ๐Ÿ’ป Rich terminal UI - Beautiful output with progress indicators and formatted results
  • ๐Ÿงช Dry-run mode - Preview extractions without saving to Pinboard
  • ๐Ÿ“Š JSON output - Machine-readable format for scripting and automation
  • ๐Ÿ”’ Privacy controls - Mark bookmarks as private or "to read" as needed

๐Ÿš€ Quick Start

Installation

# Clone the repository
git clone https://github.com/kevinmcmahon/smartpin.git
cd smartpin

# Install with uv (recommended)
uv pip install -e .

# Or install all dependencies
uv sync

Configuration

1. Get your Pinboard API token:

Visit https://pinboard.in/settings/password to find your API token.

2. Set up environment variables:

# Required: Pinboard authentication
export PINBOARD_API_TOKEN=your_username:your_token

# Required: AI provider API key (choose one based on your model)
export ANTHROPIC_API_KEY=your_key  # For Claude models
# OR
export OPENAI_API_KEY=your_key     # For GPT models
# OR see LLM docs for other providers

3. Optional: Create a .env file for persistent configuration:

# Create in project directory or ~/.pinit/.env
PINBOARD_API_TOKEN=your_username:your_token

# Choose your AI provider (set the appropriate key)
ANTHROPIC_API_KEY=your_anthropic_api_key  # For Claude models
# OPENAI_API_KEY=your_openai_api_key     # For GPT models

# Optional: specify model (defaults to anthropic/claude-sonnet-4-0)
PINIT_MODEL=gpt-4  # or claude-opus-4-0, gpt-3.5-turbo, etc.

Basic Usage

# Add a bookmark with AI analysis
pinit add https://example.com

# Preview extraction without saving
pinit add https://example.com --dry-run

# Add private bookmark marked as "to read"
pinit add https://example.com --private --toread

# Get JSON output for scripting
pinit add https://example.com --json

๐Ÿ“– Usage Examples

Standard Bookmark Addition

$ pinit add https://example.com/ai-software-development

Output:

โ”Œโ”€ Extracted Bookmark โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Title: How to Build Better Software with AI          โ”‚
โ”‚ URL: https://example.com/ai-software-development      โ”‚
โ”‚ Description: A comprehensive guide exploring how     โ”‚
โ”‚ artificial intelligence can enhance software         โ”‚
โ”‚ development workflows and code quality.              โ”‚
โ”‚ Tags: ai, software-development, programming, guide   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โœ“ Bookmark saved successfully!

Advanced Options

# Use a different AI model
pinit add https://example.com --model gpt-4

# Or use GPT-3.5 for faster/cheaper processing
pinit add https://example.com --model gpt-3.5-turbo

# Check your configuration
pinit config

# JSON output for automation
pinit add https://example.com --json | jq '.tags'

๐Ÿ”ง Configuration

Environment Variables

Configuration is loaded in this priority order:

  1. Local .env file (project directory)
  2. User configuration ~/.pinit/.env
  3. System environment variables

AI Model Configuration

The application uses the LLM library for flexible AI model integration:

  • Default model: anthropic/claude-sonnet-4-0 (can be changed via PINIT_MODEL)
  • Supported providers: Anthropic Claude, OpenAI GPT, Google Gemini, and many others
  • Easy model switching: Change models without code modifications
  • Required API keys depend on your chosen provider:
    • ANTHROPIC_API_KEY for Claude models
    • OPENAI_API_KEY for GPT models
    • GEMINI_API_KEY for Google Gemini
    • See LLM documentation for other providers

Supported Models

Provider Popular Models Environment Variable
OpenAI gpt-4, gpt-4-turbo, gpt-3.5-turbo OPENAI_API_KEY
Anthropic claude-sonnet-4-0, claude-opus-4-0 ANTHROPIC_API_KEY
Google gemini-pro, gemini-ultra GEMINI_API_KEY
Cohere command, command-light COHERE_API_KEY
Others Various See LLM docs

Choose the model that best fits your needs:

  • Speed: GPT-3.5-turbo, Claude Sonnet, Gemini Pro
  • Quality: GPT-4, Claude Opus, Gemini Ultra
  • Cost: GPT-3.5-turbo, Cohere Command-light

๐Ÿ› ๏ธ Development

Setup Development Environment

# Install development dependencies
make dev

# Run all quality checks
make check

# Individual commands
make lint      # Run Ruff linting
make typecheck # Run MyPy type checking
make format    # Auto-format code
make clean     # Remove cache files

Architecture

smartpin installs the CLI tool pinit, which follows modern Python best practices with:

  • Type hints throughout the codebase
  • Comprehensive error handling with user-friendly messages
  • Clean separation of concerns between CLI, AI processing, and API interactions
  • Rich terminal formatting for beautiful output
  • Configurable AI models via the LLM library abstraction

Core Components

  • PinboardBookmarkExtractor - Interfaces with AI models to analyze web pages
  • pinboard_client - Wrapper functions for Pinboard API operations
  • cli - Click-based command interface with Rich formatting
  • Jinja2 templates - Customizable prompts for AI extraction

๐Ÿ“ฆ Dependencies

  • CLI Framework: click - Command-line interface creation
  • Terminal UI: rich - Beautiful terminal formatting
  • AI Integration: llm - Universal LLM library for multiple providers
  • API Client: pinboard - Official Pinboard API client
  • Configuration: python-dotenv - Environment variable management
  • Templating: jinja2 - Prompt template rendering

๐Ÿค Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Run quality checks (make check)
  4. Commit your changes (git commit -m 'Add amazing feature')
  5. Push to the branch (git push origin feature/amazing-feature)
  6. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

๐Ÿ™ Acknowledgments


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

smartpin-0.2.2.tar.gz (50.3 kB view details)

Uploaded Source

Built Distribution

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

smartpin-0.2.2-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file smartpin-0.2.2.tar.gz.

File metadata

  • Download URL: smartpin-0.2.2.tar.gz
  • Upload date:
  • Size: 50.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.9

File hashes

Hashes for smartpin-0.2.2.tar.gz
Algorithm Hash digest
SHA256 a377a9a6612014e048ddd6c389f8af4b340e1906f3158c50dacbb63af21b31b2
MD5 135b50cb95c1dff4c6e150128982627e
BLAKE2b-256 67af45c944073e17facbf5caa09f8585cab22f4c58d4fd0429217c0ebde04ac0

See more details on using hashes here.

File details

Details for the file smartpin-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: smartpin-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.9

File hashes

Hashes for smartpin-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7df142412db4312e69e9f3d1cca29497bb5d0a146393c7413380de55c5c4d772
MD5 bb77d6b8324cfd20384beb6c6f063892
BLAKE2b-256 6edbcec18ca49985dcfb8fff09b03d87d245e4e36c05efd2251d1936b25b49d6

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