Metadata-Version: 2.4
Name: autogroceries
Version: 2.2.3
Summary: Automate your grocery shop.
Author: David Zhang
License: MIT License
        
        Copyright (c) 2025, David Zhang
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Requires-Python: >=3.13
Requires-Dist: click==8.2.1
Requires-Dist: playwright==1.54.0
Requires-Dist: python-dotenv==1.1.1
Provides-Extra: build
Requires-Dist: build==1.3.0; extra == 'build'
Provides-Extra: dev
Requires-Dist: pre-commit==4.3.0; extra == 'dev'
Requires-Dist: pytest-cov==6.0.0; extra == 'dev'
Requires-Dist: pytest==8.4.1; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs-material==9.6.18; extra == 'docs'
Requires-Dist: mkdocs==1.6.1; extra == 'docs'
Requires-Dist: mkdocstrings[python]==0.30.0; extra == 'docs'
Description-Content-Type: text/markdown

# autogroceries

[![test_deploy](https://github.com/dzhang32/autogroceries/actions/workflows/test_deploy.yml/badge.svg)](https://github.com/dzhang32/autogroceries/actions/workflows/test_deploy.yml)
[![pypi](https://img.shields.io/pypi/v/autogroceries.svg)](https://pypi.org/project/autogroceries/)

`autogroceries` simplifies grocery shopping by using [Playwright](https://playwright.dev/) to automate the addition of ingredients to your basket.

## Installation

I recommend using [uv](https://docs.astral.sh/uv/) to manage the python version, virtual environment and `autogroceries` installation:

```bash
uv venv --python 3.13
source .venv/bin/activate
uv pip install autogroceries
# Install Chromium browser binary required for playwright.
playwright install chromium
```

## Usage

`autogroceries` uses [Playwright](https://playwright.dev/) to interface with the Sainsbury's or Waitrose website, automatically filling your cart with an inputted list of ingredients.

`autogroceries` is designed to be used as a CLI tool, with a single command:

```bash
❯ autogroceries --help
Usage: autogroceries [OPTIONS]

  Automate your grocery shopping using playwright.

  Please set the [STORE]_USERNAME and [STORE]_PASSWORD in a .env file in the
  same directory you run autogroceries. Replace [STORE] with the store name in
  caps e.g. SAINSBURYS_USERNAME.

Options:
  --store [sainsburys|waitrose]  The store to shop at.  [required]
  --ingredients-path PATH        Path to csv file (without header) detailing
                                 ingredients. Each line should be in the
                                 format 'ingredient,quantity' e.g. 'eggs,2'.
                                 [required]
  --log-path PATH                If provided, will output shopping log to this
                                 path.
  --help                         Show this message and exit.
```

The `autogroceries` CLI expects a `.env` file in the same directory from where you execute the command. This `.env` will be loaded by [python-dotenv](https://pypi.org/project/python-dotenv/) and should define the "[STORE]_USERNAME" and "[STORE]_PASSWORD" variables, with "[STORE]" replaced by the name of the store in uppercase, for instance:

```bash
# .env
SAINSBURYS_USERNAME=your_username
SAINSBURYS_PASSWORD=your_password
```

## Demo: autogroceries in action

<video src="https://user-images.githubusercontent.com/32676710/173201096-95633b21-d023-439d-9d18-8d00d0e33c4a.mp4" controls style="max-width: 100%; height: auto;">
  Your browser does not support the video tag.
</video>

## Disclaimer

️`autogroceries` is developed for **educational use only**. Users are responsible for:

- Following website's `robots.txt` and Terms of Service.
- Using appropriate delays and respecting rate limits.
- Complying with applicable laws.
