Open sourcing Pyfood 🍋

If you are what you eat, you might as well eat something good

Michel Deudon
5 min readMar 21, 2022
Photo by Christina Morillo from Pexels

Introduction

In the last decade, Python became increasingly popular. On Stack Overflow, an open forum for questions and answers, Python ranks as the number one programming language by popularity since 2018.

Many companies opted for Python by default, and an increasing number of teenagers start learning it in school or during programming boot camps. I even met some retired people starting to learn Python. Not to mention its popularity in research and data science…

What makes Python so popular is its simplicity and large community that provides support, releases and maintains packages like NumPy, Pandas and Matplolib to name the three most popular. These packages mean you don’t need to reinvent the wheel to build proof of concepts, test ideas and learn.

Packages make it easier to build products and applications for end users and stakeholders. For instance, Tensorflow and Pytorch enabled the wide adoption of deep learning in research, startups and tech companies. Sunpy helps astrophysicists. River supports the online machine learning community, and the list continues.

Why Pyfood ?

Surprisingly there’s no library out there which stands out for chefs, cooks, farmers, people working with food, in agriculture, gastronomy or nutrition. That’s what Pyfood aims to address. Pyfood’s ambition is to be the go-to library to work with food, deal with recipes, menus or cookbooks 🚀

Photo by Eneida Nieves from Pexels

In a nut, Pyfood is a simple Python package to process food, open sourced by Local Seasonal, a French non-profit with the mission to celebrate biodiversity along the seasons. Pyfood is totally free, licensed under a Creative Commons Attribution 4.0 International License, and you can use it for commercial applications.

As a library, Pyfood is built for engineers, developers and data scientists and aims to make their lives easier to work with food. By extension, it aims to support organizations making a positive impact on the way we produce, consume and share food such as Ecotable, Frichti, Phenix, TooGoodToGo, Marmiton or Yuka to name a few organizations in France.

Pyfood is open sourced and made public because our food system is far from being sustainable. One third of the food worldwide is wasted, according to the Food and Agricultural Organization. Meat is responsible for deforestation in the Amazon forest. Pesticides kill people, life, and the costs and pressure on our health system is astronomical.

As put by Ron Finley in his 2013 Ted Talk,
Food is the problem and food is the solution

I’m confident we can build a better a food system than the one we inherited and in a world where data is playing an increasing role, helping organizations innovate and take decisions, there’s an opportunity to build smarter applications and take better decisions for the benefit of future generations.

What Pyfood does ?

Concretely, in a few lines of code, Pyfood helps translate menus, extract vegetarian or vegan recipes from datasets and label them with seasonality, for example to recommend plant based options in season 🌱

A pumpkin soup in Fall, a tarte à la Rhubarbe in Spring, an Andalusian Gazpacho in Summer or a Quiche aux champignons in Winter

The original idea initially arose in October 2018 after meeting Yolanda in Almeria (Andalusia, Spain), a passionate and creative chef at Sanare committed to cook healthy recipes, vegetarian, local and in season to delight her guests, respect the environment and society.

Seasonality of Yolanda’s gazpacho in Spain using Pyfood

Pyfood can also be used to simply figure out what fruits, vegetables are in season in different regions, and it’s used by local-seasonal.org under the hood. If you are what you eat, then you might as well eat something good, right?

How to contribute ?

If you wish to contribute to the project, there are several ways to get involved. For example, you can report issues, request features, or alternatively fix, develop and test them for future releases.

The library can be extended in many ways, e.g., to support seasonality in new regions, work in new languages or with additional ingredients. There’s also some work to improve performance, opportunities to facilitate data storage and access for non developers and finally curating and open-sourcing a dataset of recipes to enable recommendations such as dishes of the day or menus of the week (panier du jour, plat du jour, menu de la semaine… in French).

Another way to contribute to Pyfood is simply to make it live and build on top of it. Here are a few ideas of applications that can be built with Pyfood:

  • (i) Identify restaurants providing vegan options by scrapping maps;
  • (ii) Educate, entertain, inspire people that want to learn to cook;
  • (iii) Enhance restaurants’ digital menus with automated translation;
  • (iv) Support people with personalized nutrition, for example to boost immunity, fight diabete, alzheimer, lose extra pounds or improve sleep.
Photo by Yaroslav Shuraev from Pexels

Feel free to reach out if you have any questions.
Thanks for your support and feedback

And as we say in France, bonne dégustation 🥂

Reference

--

--

Michel Deudon

Artivist and teacher ✨ Tackling disinformation par la formation 🌱 More on mtpcours.fr