Skip to main content

Recipe-to-Cart CLI Tool for Nemlig.com

Project description

Nemlig Shopper 🛒

A CLI tool that parses recipes from URLs or text, matches ingredients to products on Nemlig.com (Danish online grocery store), and adds them directly to your cart.

Features

  • Recipe Parsing: Extract ingredients from recipe URLs (supports 100+ recipe sites) or manual text input
  • Product Matching: Automatically match ingredients to Nemlig.com products with smart scoring
  • Recipe Scaling: Double, halve, or scale recipes to any serving size
  • Meal Planning: Combine multiple recipes with ingredient consolidation
  • Pantry Check: Identifies common household items (salt, oil, etc.) so you don't buy what you have
  • Dietary Filters: Filter for lactose-free, gluten-free, or vegan products
  • Interactive Review: TUI for reviewing and swapping product matches before checkout
  • Export: Shopping lists to JSON, Markdown, or PDF

Installation

# Clone the repository
git clone https://github.com/mhattingpete/nemlig-shopper.git
cd nemlig-shopper

# Install with uv (recommended)
uv sync

Quick Start

# 1. Log in to Nemlig.com
uv run nemlig login

# 2. Add a recipe to cart
uv run nemlig add https://www.valdemarsro.dk/pasta-carbonara/

# 3. Add multiple recipes (ingredients are consolidated)
uv run nemlig add URL1 URL2 URL3

See QUICKSTART.md for more examples.

Commands

Command Description
nemlig login Authenticate with Nemlig.com
nemlig add Parse recipes/items and add to cart
nemlig parse Parse recipe from URL or text without adding to cart
nemlig search QUERY Search Nemlig products
nemlig pantry Manage household pantry items
nemlig export Export shopping list to file

Usage Examples

Adding Recipes

# Basic usage
uv run nemlig add https://example.com/recipe

# Scale to double
uv run nemlig add https://example.com/recipe --scale 2

# Scale to 8 servings
uv run nemlig add https://example.com/recipe --servings 8

# With dietary filter
uv run nemlig add https://example.com/recipe --lactose-free

# Preview without adding to cart
uv run nemlig add https://example.com/recipe --dry-run

# Skip pantry check
uv run nemlig add https://example.com/recipe --skip-pantry-check

Multiple Recipes

# Combine multiple recipes (ingredients consolidated)
uv run nemlig add \
  https://www.valdemarsro.dk/pasta-carbonara/ \
  https://www.valdemarsro.dk/lasagne/

Manual Items

# Add manual items
uv run nemlig add --text "mælk, brød, æg"

# Mixed: recipe URL + manual items
uv run nemlig add --text "https://recipe.com/pasta
mælk
æg x6"

# From file
uv run nemlig add --file shopping-list.txt

Pantry Management

# List your pantry items
uv run nemlig pantry list

# Add items you always have
uv run nemlig pantry add "fish sauce" "sesame oil"

# Remove items (so they're included in shopping)
uv run nemlig pantry remove "eggs"

# Show default pantry items
uv run nemlig pantry defaults

# Reset to defaults
uv run nemlig pantry clear

Configuration

Credentials can be provided via:

  1. Environment variables (.env file):

    NEMLIG_USERNAME=your-email@example.com
    NEMLIG_PASSWORD=your-password
    
  2. Saved credentials: Run uv run nemlig login to save credentials locally

Configuration files are stored in ~/.nemlig-shopper/:

  • credentials.json - Login credentials (chmod 600)
  • pantry.txt - Pantry items (one per line, edit directly or via CLI)

Supported Recipe Sites

Uses recipe-scrapers supporting 100+ sites:

  • Valdemarsro (Danish)
  • AllRecipes
  • BBC Good Food
  • Bon Appétit
  • Serious Eats
  • And many more...

Development

# Install dependencies
uv sync

# Run tests
uv run pytest

# Run a specific test
uv run pytest tests/test_recipe_parser.py -v

Notes

  • Uses an unofficial Nemlig.com API (discovered via network inspection)
  • Product matching uses smart scoring but may occasionally need manual adjustment
  • Danish ingredient names match better than English
  • Prices are estimates; actual cart totals may differ slightly

License

MIT License - 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

nemlig_shopper-1.0.0.tar.gz (81.2 kB view details)

Uploaded Source

Built Distribution

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

nemlig_shopper-1.0.0-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file nemlig_shopper-1.0.0.tar.gz.

File metadata

  • Download URL: nemlig_shopper-1.0.0.tar.gz
  • Upload date:
  • Size: 81.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.22

File hashes

Hashes for nemlig_shopper-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c72f2777ceab977cbd250fb2b84f865d8ccd0611e67f757bda0b771e6e74ddc3
MD5 9f088d0b29141906a008b66168fd9503
BLAKE2b-256 60621df744f28b441d839a477df3709d48c9a71240c3613139763426b0164123

See more details on using hashes here.

File details

Details for the file nemlig_shopper-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for nemlig_shopper-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 224bf2a56ea647fcb3b896db88e3306049913c11cd64ff1d7b89993d1a41a978
MD5 85550359e141030460cd96f01dd262d7
BLAKE2b-256 0e122415e5995b86ef6ceb565d90733b1339920ad1484de1bddfe826298f8ea7

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