pyfood_logo


documentation


pypi


creative_commons_license

Pyfood is a simple Python package to process food, in different languages. Pyfood’s ambition is to be the go-to library to deal with food, recipes, online menus or cookbooks.

Installation

Pyfood is intended to work with Python 3.6 or above. Installation can be done with pip:

pip install pyfood

Quickstart

At the core of Pyfood is the concept of a shelf embedded in a given region, a certain month_id and optionally a source language.
You can load a shelf embedded in France in January with the following Python snippet:

from pyfood.utils import Shelf
shelf = Shelf(region='France', month_id=0)

Pyfood currently works in the following regions:

  • Canada ๐Ÿ‡จ๐Ÿ‡ฆ
  • EU ๐Ÿ‡ช๐Ÿ‡บ (Europe, default)
  • France ๐Ÿ‡ซ๐Ÿ‡ท
  • Germany ๐Ÿ‡ฉ๐Ÿ‡ช
  • Israel ๐Ÿ‡ฎ๐Ÿ‡ฑ
  • Italy ๐Ÿ‡ฎ๐Ÿ‡น
  • Japan ๐Ÿ‡ฏ๐Ÿ‡ต
  • Portugal ๐Ÿ‡ต๐Ÿ‡น
  • Senegal ๐Ÿ‡ธ๐Ÿ‡ณ
  • Spain ๐Ÿ‡ช๐Ÿ‡ธ
  • United Kingdom ๐Ÿ‡ฌ๐Ÿ‡ง

๐Ÿ Label baskets or recipes

Pyfood can help automatically extract and label a list of ingredients, e.g., from a basket of food, a recipe, a menu, a cookbook or a website, with attributes/categories (e.g., fruits, vegetables) and labels (e.g., vegetarian, vegan, nutrition, seasonality), in a few lines of code:

results = shelf.process_ingredients(['apple','kiwi','sugar'])
results['labels'] # vegetarian, vegan, nutrition, seasonality

๐Ÿ‹ Translate ingredients

Pyfood comes with a vocabulary of more than 600 ingredients and synonymes, in multiple languages, and makes it easy to work with recipes in different languages or translate ingredients from a language to another one:

results = shelf.process_ingredients(['apple','kiwi','sugar'], lang_dest='FR')
results['food_list'] # pomme, kiwi, sucre

Pyfood currently supports the following languages:

  • DE (German)
  • EN (English)
  • ES (Spanish)
  • FR (French)
  • IT (Italian)
  • PT (Portuguese)
  • UN (Universal, default)

๐Ÿ“ What’s in season?

Finally, Pyfood can also be used to simply query what fruits or vegetables are in season:

fruits_in_season = shelf.get_seasonal_food(key='001')
vegetables_in_season = shelf.get_seasonal_food(key='002')

Credits

๐Ÿ“Š CIQUAL ANSES
๐Ÿ“ท Pexels
๐Ÿ“ท Unsplash

Useful links

License

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License by Local Seasonal

GitHub

View Github