A native desktop application for Ubuntu that uses the OpenAI API (GPT-4) to generate recipes, stores them in an SQLite database, and provides a searchable recipe book interface built with GTK+ 3.
-
Recipe Generation:
Generate recipes on the fly using ChatGPT with detailed instructions, a list of ingredients, and an estimated calorie count. -
Recipe Book:
Save generated recipes in an SQLite database.- Search and Filter: Search recipes by name or ingredient and filter by calories.
- Detailed View: Select recipes to view full instructions.
- Delete Functionality: Select and delete recipes from your collection (checkbox-based selection).
-
Modular Architecture:
The project is organized into separate modules for database operations (db.py), OpenAI integration (openai_integration.py), utility functions (utils.py), and the GTK user interface (gui.py). -
DevContainer Support:
A.devcontainerconfiguration is provided to enable a consistent development environment using Docker and VSCode Remote Containers on Ubuntu 24.04 LTS.
- Programming Language: Python 3
- User Interface: GTK+ 3 (via PyGObject)
- Database: SQLite
- API Integration: OpenAI API (GPT-4)
- Environment Management: python-dotenv
- Containerization: Docker, VSCode DevContainers
- Ubuntu 24.04 LTS (or a similar Linux distribution)
- Docker (if you wish to use the DevContainer)
- Visual Studio Code with the Remote - Containers extension (for containerized development)
- Python 3.8+
-
Clone the Repository
git clone https://github.com/pageza/recipe-book.git cd recipe-book -
Create a
.envFileCreate a file named
.envin the project root (this file should be added to your.gitignore) and add your OpenAI API key:OPENAI_API_KEY=your-actual-openai-api-key
-
Using the VSCode DevContainer (Recommended)
- Open the project folder in VSCode.
- Open the Command Palette (
Ctrl+Shift+P) and select "Remote-Containers: Reopen in Container". - Once the container is running, open a terminal and run:
python main.py
-
Running Locally (Without a DevContainer)
- Install the required system packages (if not already installed):
sudo apt-get install python3-gi python3-gi-cairo gir1.2-gtk-3.0
- Install Python dependencies:
pip3 install -r requirements.txt
- Run the application:
python3 main.py
recipe-book/
├── .devcontainer/
│ ├── Dockerfile
│ └── devcontainer.json
├── .env # Contains environment variables (gitignored)
├── .gitignore
├── db.py # Database initialization and operations
├── gui.py # GTK user interface and callbacks
├── main.py # Application entry point
├── openai_integration.py # OpenAI API integration logic
├── utils.py # Utility functions (e.g., formatting recipe text)
├── requirements.txt # Python dependencies
└── README.md # Project documentation
Generate a Recipe:
In the "Generate Recipe" tab, enter a prompt (or modifications) and click the Generate Recipe button. The generated recipe appears in the output pane.
Save a Recipe:
After generating a recipe, click Save Recipe to open a dialog pre-populated with recipe data. Edit as needed and click OK to save the recipe to the database.
View and Delete Recipes:
In the "Recipe Book" tab:
- Use the search bar to filter recipes by name or ingredient.
- The left pane displays a list of recipes with checkboxes for selection.
- The right pane shows full recipe details when a recipe is selected.
- Click Delete Selected to remove checked recipes from the database.
Contributions are welcome! Please fork the repository and submit a pull request with your changes. For major changes, open an issue first to discuss what you would like to change.
This project is licensed under the MIT License. See the LICENSE file for details.
- OpenAI for the API.
- The GTK+ community for PyGObject.
- The VSCode Remote - Containers team for their excellent tooling.