Skip to main content

Syncs GitHub Markdown files to Notion

Project description

Git Notion

Syncs Github markdown files in your repository to Notion.

This utility is described in the following blog post.

See example Notion page.

Installation

pip install git-notion

or for local installation:

git clone https://github.com/Harbor-Systems/git-notion.git
cd git-notion
pip install -e .

Configuring

NOTION_TOKEN_V2 - Can be found in your browser cookies for Notion's website.
NOTION_ROOT_PAGE - URL for notion page. Repo docs will be a new page under this page.
NOTION_EXCLUDE_REGEX - Regex for paths to ignore.
NOTION_INCLUDE_REGEX - Regex for paths to include.
NOTION_CONFIG_PATH - Path to the setup.cfg file.

These environment variables can be set.

export NOTION_TOKEN_V2=<YOUR_TOKEN>
export NOTION_ROOT_PAGE="https://www.notion.so/..."  # Can be in setup.cfg as well
export NOTION_IGNORE_REGEX="(?i)(vendor\/.*\.md|deleteme\.md)" # Can be in setup.cfg as well
export NOTION_INCLUDE_REGEX="(?i)(docs\/.*\.md|readme\.md)" # Can be in setup.cfg as well
export NOTION_CONFIG_PATH="docs/"

These parameters can be set in the setup.cfg for the repo.

[git-notion]
ignore_regex = models/.*
include_regex = docs/.*
notion_root_page = https://www.notion.so/...

Running Locally

  1. Set up a virtual environment
python3 -m pip install virtualenv # only do this the first time
  1. Create a virtual environment
python3 -m virtualenv venv
  1. Activate the virtual environment
source venv/bin/activate
  1. Install the dependencies
python3 -m pip install -r requirements.in
  1. Set any environment variables and run the command
export NOTION_TOKEN_V2=<...>
export NOTION_ROOT_PAGE="https://www.notion.so/..."
python3 git-notion-pretty/cli.py [options]

Usage

# To upload your current directory
git-notion-pretty

# To upload to a different directory name
git-notion-pretty --dir-name="Application Docs"

# To use a flat structure instead of the nested structure
git-notion-pretty --page-structure=flat

# To use the file name instead searching for and using the H1 header on the first line
git-notion-pretty --use-file-name

Pushing to PYPI

python3 -m bumpversion patch   # Look-up bumpversion
rm -rf dist/
python3 setup.py sdist bdist_wheel
python3 -m twine upload dist/*

Project details


Download files

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

Source Distribution

git_notion_pretty-1.0.2.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

git_notion_pretty-1.0.2-py2.py3-none-any.whl (6.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file git_notion_pretty-1.0.2.tar.gz.

File metadata

  • Download URL: git_notion_pretty-1.0.2.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for git_notion_pretty-1.0.2.tar.gz
Algorithm Hash digest
SHA256 06b596d61662f5bc6d4c6ec127445af5410b6ea6b7e9956cdb8fc318d32b2898
MD5 b6d219b1c1c0a577708c71a14e322b57
BLAKE2b-256 e085dc6abbf095a2d37cae7eceaa8234e8bb0bf7c141f97da4450b363d7b05ba

See more details on using hashes here.

File details

Details for the file git_notion_pretty-1.0.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for git_notion_pretty-1.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9eeb60fabee36b3378e1bdc68eecebafc7fd27fccb1ab8107140c19c35769e60
MD5 b3a3f62016b80906449fcaf0180d6a9d
BLAKE2b-256 e73516c1e9f22932579ad9781bf402aafb23421fd60265022f1840e623db5ce5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page