Progress Bar displayed in Notion like tqdm for Python
Project description
notion-tqdm
Progress Bar displayed in Notion like tqdm for Python using notion-py
.
notion-tqdm
inherits from tqdm, so it can be run in the same way as tqdm.
Installation
pip install notion-tqdm
Usage
Preparation
-
Get Notion's Token for reference here
-
Duplicate this page in your own workspace and get the table link. (Note that it is a table link, not a page link.)
QuickStart
from notion_tqdm import notion_tqdm
from time import sleep
# Configure
token_v2 = '<token_v2>'
table_url = '<table_url>'
notion_email = '<notion_email>' # For multi-account users
notion_tqdm.set_config(token_v2, table_url, email=notion_email, timezone='Asia/Tokyo')
# Run Iterate
for i in notion_tqdm(range(100), desc='Processing'):
sleep(1)
print(i)
A row representing the progress should be added to the table as shown below.
Example: Running with the Other tqdm
from tqdm.auto import tqdm as tqdm_auto
from time import sleep
# Nest tqdm
tqdm = lambda *args, **kwags: tqdm_auto(notion_tqdm(*args, **kwags))
for i in tqdm(range(100)):
sleep(1)
print(i)
Example: Set Custom Property
Set the common parameters before the iterative process.
# After this setting, the value will be added to the column by default.
# The `machine` column must be added to the table beforehand.
notion_tqdm.set_common_props(machine='Jupyter1')
Set the dynamic parameters during the iterative process.
with notion_tqdm(range(50), desc='process') as pbar:
for i in pbar:
# ... some process ...
# The `precision`, `highparam` column must be
# added to the table beforehand.
pbar.update_props(precision=precision, highparam=highparam)
Example: Timeline View
With Notion's timeline view, you can visualize the execution time of the progress.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for notion_tqdm-0.0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8afd7bea96bf5c70638728f505a64dd12ceaaad060f5d4d7aae0d0ee5c659b9 |
|
MD5 | 384fcb664ed68f7336f49c4cc08d8a54 |
|
BLAKE2b-256 | b2797c3b8df0740fbed64f33639d4687ba6940b64b3e9c53c740b6ab290a2b0b |