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 as .env or at ~/.pinit/config
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

Configuration Loading

Configuration is loaded in this priority order (highest to lowest):

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

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.3.tar.gz (51.4 kB view details)

Uploaded Source

Built Distribution

smartpin-0.2.3-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for smartpin-0.2.3.tar.gz
Algorithm Hash digest
SHA256 4b33cef7f025565601056a4ad7307daa08236d2cc8ed53e99cf12372ef1e9955
MD5 c0b740bba6f67e26ecefa6b9d760748c
BLAKE2b-256 f1619e568b2064faff357542fe39b86ae14c2c68a5de1326523ed0774f6630cb

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for smartpin-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 579a5a376c4c58c60ad639fa4f80cbe416daceac92b226afc42e64f2cc2926ee
MD5 ac282171149ef04d1d117aa7d7f7f1ee
BLAKE2b-256 731e30adc25101d494de318543914257009cb50441f8a0bcaa71809e64873afe

See more details on using hashes here.

Supported by

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