Pyfood: A Python package to process food
Project description
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
This work is licensed under a Creative Commons Attribution 4.0 International License by Local Seasonal
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyfood-0.0.5.tar.gz.
File metadata
- Download URL: pyfood-0.0.5.tar.gz
- Upload date:
- Size: 2.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.3 pkginfo/1.8.2 requests/2.21.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46cfac80f6a633e9d747b0034600fda12b28fe931acc3f998bcc4ae909db6104
|
|
| MD5 |
9df899d2a4eab5d0e4b0aabca66375af
|
|
| BLAKE2b-256 |
2376152040222a8f05eb401fef2e7754d897cb502fbe4824aee83f3231254007
|
File details
Details for the file pyfood-0.0.5-py3-none-any.whl.
File metadata
- Download URL: pyfood-0.0.5-py3-none-any.whl
- Upload date:
- Size: 2.3 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.3 pkginfo/1.8.2 requests/2.21.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e14ad1ef221a89fe8116d65013db923606ef2135447901b8b78028a9d9ea1107
|
|
| MD5 |
ae5ad11ced7a4cfb7ada746a887d4fa0
|
|
| BLAKE2b-256 |
7e148cf702f43e669efa71fbfcbffbb6c59e076dc34a7bf5f0656706caf250d4
|