Skip to main content

Utility to assist with exporting recipes stored in Paprika to a Notion Database.

Project description

Setup

Run pip install paprika2notion

V0 of this library will assume you have downloaded and extracted your recipes to some path that we will refer to as: path/to/your/extracted/recipe.paprikarecipe.yaml

For help doing this, check out: paprika-recipes

You must then create a Notion database that provides write-access to a Notion integration. For details on setting up a Notion integration, see their website here

This database must contain, at minimum the following fields. Note that spelling matters, as the names are used for writing the template.:

  • Title: Recipe
  • Rich Text: Recipe write-up, Recipe write-up overflow, Paprika Hash, Nutritional Info
  • Select: Status, Meal Type, Tags
  • URL: URL

If you wish for a different field-set, you can edit the NotionRecipe's get_all_properties method.

The library reads your secrets from environment variables. See the snippet below for expected variables. I recommend using a secrets manager like Hashicorp Vault (not sponsored) to enable this. Otherwise, you can create a local config file.

Usage

This library is intended to make it easy for you to load recipes you have stored in Paprika into your Notion Workspace.

Once you have downloaded and extracted your recipes, you can load them as objects in python, edit them, and write to notion if you wish.

See below for an example writing a single recipe to my Notion database.

#%%
from __future__ import annotations
import os
import yaml
from paprika2notion import PaprikaRecipe, NotionRecipe
from notion_client import Client

c = Client(auth=os.environ["NOTION_TOKEN"])

with open("path/to/your/extracted/recipe.paprikarecipe.yaml", 'r', encoding='utf8') as f:
    t = PaprikaRecipe.from_dict(yaml.load(f, Loader=yaml.loader.Loader))

n = NotionRecipe.from_paprika(t)
n.write_to_notion(c, os.environ["NOTION_DATABASE_ID"])

By default, the tool will do a few things:

  • All categories in Paprika become Tags in Notion
  • Status and Meal Type are set to From Paprika, to enable you to identify recipes that may need touching up in Notion.
  • Paprika's Directions are written to Recipe write-up, and if > 2000 characters, overflow goes to Recipe write-up overflow

Contribution

There are a number of ways to contribute to paprika2notion.

  • Check out open Issues and submit a PR to resolve one

    • if you don't want to submit a PR, feel free to join the discussion on these issues anyways!
  • Use the tool and make improvements to solve your pain points

    • Find something annoying? We'd love your help fixing it! Anything that could make this a more seamless tool is probably welcome.
  • Some planned items that you're free to take a stab at before I get to them:

    • Automatically create appropriate Database/Page/Schema in Notion from tool
    • Automatically add all ingredient relations
      • If ingredient doesn't exist, create an appropriate one
  • Just ask! Feel free to reach out to me and ask if there's anything you can do to help with the project. Almost certainly we have some backlog items.

With any pull request, please include at minimum:

  • Doc strings for any major functions/methods.
  • a test case walkthrough.

If you're feeling especially helpful create a test using pytest and run it with cov after your changes.

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

paprika2notion-0.1.tar.gz (22.9 kB view details)

Uploaded Source

Built Distribution

paprika2notion-0.1-py3-none-any.whl (24.2 kB view details)

Uploaded Python 3

File details

Details for the file paprika2notion-0.1.tar.gz.

File metadata

  • Download URL: paprika2notion-0.1.tar.gz
  • Upload date:
  • Size: 22.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.4

File hashes

Hashes for paprika2notion-0.1.tar.gz
Algorithm Hash digest
SHA256 388725882faba4d638d2861e592fbc9138387c250d159bd06a74c28133032cec
MD5 020ce57a02c911480690c0f0bac540e9
BLAKE2b-256 03ab1b5d69951a147e907e7a777004dd0e816ba78c804502908d154e484dd9d4

See more details on using hashes here.

File details

Details for the file paprika2notion-0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for paprika2notion-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3682ea34de9c9b0dbb1d03e207d942658bde885288c9ae1b667b38c0bbe0af02
MD5 055f7f447944506832c4543f07f7640e
BLAKE2b-256 cb877fdb881c31a5e2bbb169188d4290e5eee9f020b49649bcc5ea38a6c062f5

See more details on using hashes here.

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