Skip to main content

spudlang

Spud is a domain-specific programming language for creating grocery shopping lists.

One of the big overheads to effective grocery shopping is the time involved in creating a good shopping list. A good shopping list should:

  • contain all the ingredients that you need
  • contain nothing that you don't need
  • be organized
    • ingredients should be grouped together by where they appear in a store, or by which store sells them
  • be deduplicated
    • if two different recipes call for the same ingredient, then there shouldn't be two entries on your shopping list; the two entries should be added together

Creating grocery shopping lists that follow these guidelines takes time. Wouldn't it be so much easier if you just had to decide which recipes to make and then an organized and well-formatted grocery shopping list were produced for you?

With Spud, you can easily store recipes and preferred normalization rules in a personal library. Then, when you need to go shopping, you simply write the names of the recipes you want to make and presto! Spud will output a grocery shopping list that contains what you need to buy. You can even scale the quantities of ingredients, recipes, or entire shopping lists as needed.

Installation

The Spud interpreter is hosted through PyPI and can be downloaded using pip.

To install Spud, use:

pip install spudlang

Easy Syntax

The syntax is designed to closely follow the English language to make it easier for newcomers. For example:

6 kg carrots + chopped

Without any additional information, one would correctly assume that this line of Spud code refers to six kilograms of chopped carrots.

Spud can handle arbitrary units of measure, and allows users to use express numbers in whichever form is most natural.

6 kg carrots
1/3 cup water
9/7 lb potatoes
1 3/4 bunch parsley
3.21 cloves garlic

Note that the fourth line is a mixed fraction, referring to 1.75 bunches of parsley.

Also consider the following, which instructs the Spud interpreter to replace every 100 ml of cooked spinach in the original recipes with 500 ml of uncooked spinach in the final grocery list:

100 ml spinach +cooked -uncooked is 500 ml spinach -cooked +uncooked

Using constructs such as these, it is possible to easily represent a set of ingredients and normalize it into some standard form.

Organization

Spud keeps things organized:

apples are a type of fruit
bananas are a type of fruit

1 kg apples is 8.5 count apples

2 apples
0.5 kg apples
3 bananas
1 loaf bread

The first two lines declare that apples and bananas are fruits. The next line is a normalization rule, converting apples by weight into apples by number. These first three lines can be placed in an importable library, so that they do not need to be rewritten for every shopping list.

The output of the above program is:

- groceries
  - bread
    - 1 loaf
  - fruit
    - apples
      - 6.25 count
    - bananas
      - 3 count

The two lines calling for apples were converted into the same units and added into a single line item. Apples and bananas were categorized together as fruit.

License

Spudlang is released using the MIT License.

Metadata

Release files for spudlang 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spudlang 0.5.1
File Size Uploaded
spudlang-0.5.1.tar.gz 37.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spudlang 0.5.1
File Interpreter ABI Platform
spudlang-0.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 76.7 kB

Release files / spudlang-0.5.1.tar.gz

Download URL spudlang-0.5.1.tar.gz
Size 37.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8ab84e3380fffc521bbefa7512146a015856576fab10bc773ab852d295539b7e
BLAKE2b-256 checksum
How to use checksums
27f569256964ec16ba40d83ba110fe44307d291fffd39dead763d95ade1b688c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.15

Release files / spudlang-0.5.1-py3-none-any.whl

Download URL spudlang-0.5.1-py3-none-any.whl
Size 39.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
66e9a5c530cc198f6859977e719003dc1aca75e831dc947d87c43a9afdef9806
BLAKE2b-256 checksum
How to use checksums
c3c9f4a8383d6fcae7e29d6ce4222a7268f260d3a0d6a64b95aeedf422df80df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.15

Release history Release notifications | RSS feed

This release

0.5.1 This release

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page