notionary 0.2.14__py3-none-any.whl → 0.2.16__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,276 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: notionary
3
- Version: 0.2.14
4
- Summary: A toolkit to convert between Markdown and Notion blocks
5
- Home-page: https://github.com/mathisarends/notionary
6
- Author: Mathis Arends
7
- Author-email: mathisarends27@gmail.com
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: License :: OSI Approved :: MIT License
10
- Requires-Python: >=3.7
11
- Description-Content-Type: text/markdown
12
- License-File: LICENSE
13
- Requires-Dist: httpx>=0.28.0
14
- Requires-Dist: python-dotenv>=1.1.0
15
- Requires-Dist: pydantic>=2.11.4
16
- Requires-Dist: posthog>=3.0.0
17
- Requires-Dist: click>=8.0.0
18
- Requires-Dist: openai>=1.30.1
19
- Requires-Dist: langchain>=0.2.0
20
- Requires-Dist: tiktoken>=0.6.0
21
- Dynamic: author
22
- Dynamic: author-email
23
- Dynamic: classifier
24
- Dynamic: description
25
- Dynamic: description-content-type
26
- Dynamic: home-page
27
- Dynamic: license-file
28
- Dynamic: requires-dist
29
- Dynamic: requires-python
30
- Dynamic: summary
31
-
32
- # Notionary 📝
33
-
34
- [![Python Version](https://img.shields.io/badge/python-3.8%2B-blue.svg)](https://www.python.org/downloads/)
35
- [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
36
-
37
- **Notionary** is a powerful Python library for interacting with the Notion API, making it easy to create, update, and manage Notion pages and databases programmatically with a clean, intuitive interface. It's specifically designed to be the foundation for AI-driven Notion content generation.
38
-
39
- ---
40
-
41
- ## Features
42
-
43
- - **Rich Markdown Support**: Create Notion pages using intuitive Markdown syntax with custom extensions
44
- - **Dynamic Database Operations**: Create, update, and query database entries with schema auto-detection
45
- - **Extensible Block Registry**: Add, customize, or remove Notion block elements with a flexible registry pattern
46
- - **LLM-Ready Prompts**: Generate system prompts explaining Markdown syntax for LLMs to create Notion content
47
- - **Async-First Design**: Built for modern Python with full async/await support
48
- - **Schema-Based Validation**: Automatic property validation based on database schemas
49
- - **Intelligent Content Conversion**: Bidirectional conversion between Markdown and Notion blocks
50
-
51
- ---
52
-
53
- ## Installation
54
-
55
- ```bash
56
- pip install notionary
57
- ```
58
-
59
- ---
60
-
61
- ## Quick Start
62
-
63
- ### Creating and Managing Pages
64
-
65
- ```python
66
- import asyncio
67
- from notionary import NotionPage
68
-
69
- async def main():
70
- # Create a page from URL
71
- page = NotionPage.from_url("https://www.notion.so/your-page-url")
72
-
73
- # Or find by name
74
- page = await NotionPage.from_page_name("My Project Page")
75
-
76
- # Update page metadata
77
- await page.set_title("Updated Title")
78
- await page.set_emoji_icon("🚀")
79
- await page.set_random_gradient_cover()
80
-
81
- # Add markdown content
82
- markdown = """
83
- # Project Overview
84
-
85
- !> [💡] This page was created programmatically using Notionary.
86
-
87
- ## Features
88
- - **Rich** Markdown support
89
- - Async functionality
90
- - Custom syntax extensions
91
-
92
- +++ Implementation Details
93
- | Notionary uses a custom converter to transform Markdown into Notion blocks.
94
- | This makes it easy to create rich content programmatically.
95
- """
96
-
97
- await page.replace_content(markdown)
98
-
99
- if __name__ == "__main__":
100
- asyncio.run(main())
101
- ```
102
-
103
- ### Working with Databases
104
-
105
- ```python
106
- import asyncio
107
- from notionary import NotionDatabase, DatabaseDiscovery
108
-
109
- async def main():
110
- # Discover available databases
111
- discovery = DatabaseDiscovery()
112
- await discovery()
113
-
114
- # Connect to a database by name
115
- db = await NotionDatabase.from_database_name("Projects")
116
-
117
- # Create a new page in the database
118
- page = await db.create_blank_page()
119
-
120
- # Set properties
121
- await page.set_property_value_by_name("Status", "In Progress")
122
- await page.set_property_value_by_name("Priority", "High")
123
-
124
- # Query pages from database
125
- async for page in db.iter_pages():
126
- title = await page.get_title()
127
- print(f"Page: {title}")
128
-
129
- if __name__ == "__main__":
130
- asyncio.run(main())
131
- ```
132
-
133
- ## Custom Markdown Syntax
134
-
135
- Notionary extends standard Markdown with special syntax to support Notion-specific features:
136
-
137
- ### Text Formatting
138
-
139
- - Standard: `**bold**`, `*italic*`, `~~strikethrough~~`, `` `code` ``
140
- - Links: `[text](url)`
141
- - Quotes: `> This is a quote`
142
- - Divider: `---`
143
-
144
- ### Callouts
145
-
146
- ```markdown
147
- !> [💡] This is a default callout with the light bulb emoji
148
- !> [🔔] This is a notification with a bell emoji
149
- !> [⚠️] Warning: This is an important note
150
- ```
151
-
152
- ### Toggles
153
-
154
- ```markdown
155
- +++ How to use Notionary
156
- | 1. Initialize with NotionPage
157
- | 2. Update metadata with set_title(), set_emoji_icon(), etc.
158
- | 3. Add content with replace_content() or append_markdown()
159
- ```
160
-
161
- ### Multi-Column Layout
162
-
163
- ```markdown
164
- ::: columns
165
- ::: column
166
-
167
- ## Left Column
168
-
169
- - Item 1
170
- - Item 2
171
- - Item 3
172
- :::
173
- ::: column
174
-
175
- ## Right Column
176
-
177
- This text appears in the second column. Multi-column layouts are perfect for:
178
-
179
- - Comparing features
180
- - Creating side-by-side content
181
- - Improving readability of wide content
182
- :::
183
- :::
184
- ```
185
-
186
- ### Code Blocks
187
-
188
- ```python
189
- def hello_world():
190
- print("Hello from Notionary!")
191
- ```
192
-
193
- ### To-do Lists
194
-
195
- ```markdown
196
- - [ ] Define project scope
197
- - [x] Create timeline
198
- - [ ] Assign resources
199
- ```
200
-
201
- ### Tables
202
-
203
- ```markdown
204
- | Feature | Status | Priority |
205
- | --------------- | ----------- | -------- |
206
- | API Integration | Complete | High |
207
- | Documentation | In Progress | Medium |
208
- ```
209
-
210
- ### More Elements
211
-
212
- ```markdown
213
- ![Caption](https://example.com/image.jpg)
214
- @[Caption](https://youtube.com/watch?v=...)
215
- [bookmark](https://example.com "Title" "Description")
216
- ```
217
-
218
- ## Block Registry & Customization
219
-
220
- ```python
221
- from notionary import NotionPage, BlockRegistryBuilder
222
-
223
- # Create a custom registry with only the elements you need
224
- custom_registry = (
225
- BlockRegistryBuilder()
226
- .with_headings()
227
- .with_callouts()
228
- .with_toggles()
229
- .with_columns() # Include multi-column support
230
- .with_code()
231
- .with_todos()
232
- .with_paragraphs()
233
- .build()
234
- )
235
-
236
- # Apply this registry to a page
237
- page = NotionPage.from_url("https://www.notion.so/your-page-url")
238
- page.block_registry = custom_registry
239
-
240
- # Replace content using only supported elements
241
- await page.replace_content("# Custom heading with selected elements only")
242
- ```
243
-
244
- ## AI-Ready: Generate LLM Prompts
245
-
246
- ```python
247
- from notionary import BlockRegistryBuilder
248
-
249
- # Create a registry with all standard elements
250
- registry = BlockRegistryBuilder.create_full_registry()
251
-
252
- # Generate the LLM system prompt
253
- llm_system_prompt = registry.get_notion_markdown_syntax_prompt()
254
- print(llm_system_prompt)
255
- ```
256
-
257
- ## Examples
258
-
259
- See the `examples/` folder for:
260
-
261
- - [Database discovery and querying](examples/database_discovery_example.py)
262
- - [Rich page creation with Markdown](examples/page_example.py)
263
- - [Database management](examples/database_management_example.py)
264
- - [Iterating through database entries](examples/database_iteration_example.py)
265
- - [Temporary usage & debugging](examples/temp.py)
266
-
267
- ## Perfect for AI Agents and Automation
268
-
269
- - **LLM Integration**: Generate Notion-compatible content with any LLM using the system prompt generator
270
- - **Dynamic Content Generation**: AI agents can generate content in Markdown and render it directly as Notion pages
271
- - **Schema-Aware Operations**: Automatically validate and format properties based on database schemas
272
- - **Simplified API**: Clean, intuitive interface for both human developers and AI systems
273
-
274
- ## Contributing
275
-
276
- Contributions welcome — feel free to submit a pull request!
@@ -1,2 +0,0 @@
1
- [console_scripts]
2
- notionary = notionary.cli.main:main
@@ -1 +0,0 @@
1
- notionary