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
pip install notion-cobertos-fork # IMPORTANT due to a md2notion notion-py dependency. Order also matters
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
- Set up a virtual environment
python3 -m pip install virtualenv # only do this the first time
- Create a virtual environment
python3 -m virtualenv venv
- Activate the virtual environment
source venv/bin/activate
- Install the dependencies
python3 -m pip install -r requirements.in
- 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/*
Metadata
Release files for git-notion-pretty 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| git_notion_pretty-1.0.4.tar.gz | 6.3 kB | Without provenance | Details for git_notion_pretty-1.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| git_notion_pretty-1.0.4-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for git_notion_pretty-1.0.4-py2.py3-none-any.whl |
Total release size: 12.8 kB
Release files / git_notion_pretty-1.0.4.tar.gz
| Download URL | git_notion_pretty-1.0.4.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
43bbbb33167fe55b4e6988ae2741da38db97b177d3b41f6cef1eee62e4a5022b
|
|
BLAKE2b-256 checksum How to use checksums |
9546eea183b49dfba69540fa1d788a614101c85ec9057fabe7bbaa6bc9c3de5d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Release files / git_notion_pretty-1.0.4-py2.py3-none-any.whl
| Download URL | git_notion_pretty-1.0.4-py2.py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
7cd33e89ca471208338af94459b59034929b64111162aabd6042ca542e134d45
|
|
BLAKE2b-256 checksum How to use checksums |
f4bb8b32d7aa7358f8c309cb1ee212a22e348449238b51cd3c0e283fbd30feea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Security for git-notion-pretty 1.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.