Skip to main content

Pyfood: A Python package to process food

Project description


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 works in the following region by default EU (Europe), which includes France, Germany, Italy, Portugal, Spain, United Kingdom. Support for Canada, Israel, Japan and Senegal is also provided

🍐 Label baskets or recipes

In a few lines of code, Pyfood can help automatically extract, translate, label a list of ingredients, e.g., from a basket of food, a recipe, a menu, a cookbook or a webapp, with multiple labels, e.g., vegetarian, vegan, nutrition and seasonality:

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['ingredients_by_taxon'] # [[pomme, kiwi], [sucre]]

Pyfood supports the following language by default UN (Universal), which includes DE (German), EN (English), ES (Spanish). FR (French), IT (Italian), PT (Portuguese)

🍓 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 and Unsplash

Useful links

🛠️ Documentation
🐛 Issue tracker
🍕 Package releases

License

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

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

pyfood-0.0.5.tar.gz (2.2 MB view hashes)

Uploaded Source

Built Distribution

pyfood-0.0.5-py3-none-any.whl (2.3 MB view hashes)

Uploaded Python 3

Supported by

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