from tomatopy import Recipe
# Create a recipe
marinara = Recipe("Classic Marinara")
marinara.add_ingredient(tomato)
marinara.add_ingredient(garlic)
marinara.add_ingredient(basil)
# Set cooking parameters
marinara.set_cooking_method("simmer")
marinara.set_duration("30m")
marinara.set_temperature(100)
Batch Cooking
# Cook multiple recipes
recipes = [marinara, pizza_sauce, tomato_soup]
results = kitchen.cook_batch(recipes)
# Process results
for recipe, result in zip(recipes, results):
print(f"{recipe.name}: {result.consistency}")
Temperature Control
Temperature Monitoring
# Monitor temperature during cooking
with kitchen.temperature_monitor() as monitor:
sauce = kitchen.cook(tomato, method="simmer")
temperature_history = monitor.get_history()
print(f"Average temperature: {monitor.get_average()}°C")
Temperature Alerts
# Set up temperature alerts
kitchen.set_temperature_alert(
min_temp=95,
max_temp=105,
callback=lambda temp: print(f"Temperature alert: {temp}°C")
)
Cooking Validation
Safety Checks
# Perform safety checks
if kitchen.validate_cooking_parameters(
temperature=200,
duration="2h",
pressure=103.4
):
# Proceed with cooking
result = kitchen.cook(...)
else:
print("Invalid cooking parameters")
try:
# Attempt invalid cooking operation
kitchen.cook(
tomato,
method="invalid_method",
temperature=1000 # Too hot!
)
except CookingError as e:
print(f"Error: {e}") # "Invalid cooking method"
try:
# Attempt unsafe temperature
kitchen.set_temperature(500) # Too hot!
except TemperatureError as e:
print(f"Error: {e}") # "Temperature exceeds safe range"
Best Practices
Always Validate Parameters
if kitchen.validate_cooking_parameters(
temperature=temp,
duration=duration,
pressure=pressure
):
# Proceed with cooking
Monitor Temperature
with kitchen.temperature_monitor() as monitor:
result = kitchen.cook(...)
if monitor.get_max() > safety_threshold:
print("Warning: Temperature exceeded safety threshold")
Use Appropriate Methods
# Choose method based on ingredient
if ingredient.requires_gentle_cooking:
method = "simmer"
else:
method = "boil"