notionary 0.1.0__py3-none-any.whl → 0.1.2__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.
- notionary/__init__.py +9 -0
- notionary-0.1.2.dist-info/METADATA +214 -0
- notionary-0.1.2.dist-info/RECORD +6 -0
- notionary-0.1.2.dist-info/top_level.txt +1 -0
- notionary-0.1.0.dist-info/METADATA +0 -43
- notionary-0.1.0.dist-info/RECORD +0 -5
- notionary-0.1.0.dist-info/top_level.txt +0 -1
- {notionary-0.1.0.dist-info → notionary-0.1.2.dist-info}/WHEEL +0 -0
- {notionary-0.1.0.dist-info → notionary-0.1.2.dist-info}/licenses/LICENSE +0 -0
notionary/__init__.py
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
from .core.page.notion_page_manager import NotionPageManager
|
2
|
+
from .core.database.notion_database_manager import NotionDatabaseManager
|
3
|
+
from .core.database.notion_database_manager_factory import NotionDatabaseFactory
|
4
|
+
|
5
|
+
__all__ = [
|
6
|
+
"NotionPageManager",
|
7
|
+
"NotionDatabaseManager",
|
8
|
+
"NotionDatabaseFactory",
|
9
|
+
]
|
@@ -0,0 +1,214 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: notionary
|
3
|
+
Version: 0.1.2
|
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: notion-client>=2.0.0
|
14
|
+
Requires-Dist: markdown-it-py>=3.0.0
|
15
|
+
Requires-Dist: beautifulsoup4>=4.13.0
|
16
|
+
Requires-Dist: httpx>=0.28.0
|
17
|
+
Requires-Dist: python-dotenv>=1.1.0
|
18
|
+
Requires-Dist: lxml>=5.3.0
|
19
|
+
Requires-Dist: attrs>=25.3.0
|
20
|
+
Dynamic: author
|
21
|
+
Dynamic: author-email
|
22
|
+
Dynamic: classifier
|
23
|
+
Dynamic: description
|
24
|
+
Dynamic: description-content-type
|
25
|
+
Dynamic: home-page
|
26
|
+
Dynamic: license-file
|
27
|
+
Dynamic: requires-dist
|
28
|
+
Dynamic: requires-python
|
29
|
+
Dynamic: summary
|
30
|
+
|
31
|
+
# Notionary 📝
|
32
|
+
|
33
|
+
[](https://www.python.org/downloads/)
|
34
|
+
[](LICENSE)
|
35
|
+
|
36
|
+
**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.
|
37
|
+
|
38
|
+
## Features
|
39
|
+
|
40
|
+
- **Rich Markdown Support**: Write Notion pages using intuitive Markdown syntax with custom extensions
|
41
|
+
- **Dynamic Database Operations**: Create, update, and query database entries with schema auto-detection
|
42
|
+
- **Async-First Design**: Built for modern Python with full async/await support
|
43
|
+
- **Schema-Based Validation**: Automatic property validation based on database schemas
|
44
|
+
- **Intelligent Content Conversion**: Bidirectional conversion between Markdown and Notion blocks
|
45
|
+
|
46
|
+
## Installation
|
47
|
+
|
48
|
+
```bash
|
49
|
+
pip install notionary
|
50
|
+
```
|
51
|
+
|
52
|
+
## Custom Markdown Syntax
|
53
|
+
|
54
|
+
Notionary extends standard Markdown with special syntax to support Notion-specific features:
|
55
|
+
|
56
|
+
### Text Formatting
|
57
|
+
|
58
|
+
- Standard Markdown: `**bold**`, `*italic*`, `~~strikethrough~~`, `` `code` ``
|
59
|
+
- Highlights: `==highlighted text==`, `==red warning==`, `==blue==`
|
60
|
+
|
61
|
+
### Block Elements
|
62
|
+
|
63
|
+
#### Callouts
|
64
|
+
|
65
|
+
```markdown
|
66
|
+
!> [💡] This is a default callout with the light bulb emoji
|
67
|
+
!> [🔔] This is a callout with a bell emoji
|
68
|
+
!> {blue_background} [💧] This is a blue callout with a water drop emoji
|
69
|
+
!> {yellow_background} [⚠️] Warning: This is an important note
|
70
|
+
```
|
71
|
+
|
72
|
+
#### Toggles
|
73
|
+
|
74
|
+
```markdown
|
75
|
+
+++ How to use NotionPageManager
|
76
|
+
|
77
|
+
1. Initialize with NotionPageManager
|
78
|
+
2. Update metadata with set_title(), set_page_icon(), etc.
|
79
|
+
3. Add content with replace_content() or append_markdown()
|
80
|
+
```
|
81
|
+
|
82
|
+
#### Bookmarks
|
83
|
+
|
84
|
+
```markdown
|
85
|
+
[bookmark](https://notion.so "Notion Homepage" "Your connected workspace")
|
86
|
+
```
|
87
|
+
|
88
|
+
#### Multi-Column Layouts
|
89
|
+
|
90
|
+
```markdown
|
91
|
+
::: columns
|
92
|
+
::: column
|
93
|
+
Content for first column
|
94
|
+
:::
|
95
|
+
::: column
|
96
|
+
Content for second column
|
97
|
+
:::
|
98
|
+
:::
|
99
|
+
```
|
100
|
+
|
101
|
+
And more:
|
102
|
+
|
103
|
+
- Tables with standard Markdown syntax
|
104
|
+
- Code blocks with syntax highlighting
|
105
|
+
- To-do lists with `- [ ]` and `- [x]`
|
106
|
+
- Block quotes with `>`
|
107
|
+
|
108
|
+
## Database Management
|
109
|
+
|
110
|
+
Notionary makes it easy to work with Notion databases, automatically handling schema detection and property conversion:
|
111
|
+
|
112
|
+
```python
|
113
|
+
import asyncio
|
114
|
+
from notionary.core.database.notion_database_manager import NotionDatabaseManager
|
115
|
+
|
116
|
+
async def main():
|
117
|
+
database_id = "1a6389d5-7bd3-8097-aa38-e93cb052615a"
|
118
|
+
db = NotionDatabaseManager(database_id)
|
119
|
+
await db.initialize()
|
120
|
+
|
121
|
+
properties = {
|
122
|
+
"Title": "Created via Notionary",
|
123
|
+
"Description": "This entry was created using Notionary.",
|
124
|
+
"Status": "In Progress",
|
125
|
+
"Priority": "High"
|
126
|
+
}
|
127
|
+
|
128
|
+
result = await db.create_page(properties)
|
129
|
+
|
130
|
+
if result["success"]:
|
131
|
+
page_id = result["page_id"]
|
132
|
+
await db.update_page(page_id, {"Status": "Completed"})
|
133
|
+
|
134
|
+
filter_conditions = {
|
135
|
+
"property": "Status",
|
136
|
+
"status": {"equals": "Completed"}
|
137
|
+
}
|
138
|
+
|
139
|
+
pages = await db.get_pages(limit=10, filter_conditions=filter_conditions)
|
140
|
+
|
141
|
+
await db.close()
|
142
|
+
|
143
|
+
if __name__ == "__main__":
|
144
|
+
asyncio.run(main())
|
145
|
+
```
|
146
|
+
|
147
|
+
## Finding Databases by Name
|
148
|
+
|
149
|
+
Use fuzzy matching to find databases:
|
150
|
+
|
151
|
+
```python
|
152
|
+
from notionary.core.database.notion_database_manager_factory import NotionDatabaseFactory
|
153
|
+
|
154
|
+
async def main():
|
155
|
+
db_manager = await NotionDatabaseFactory.from_database_name("Projects")
|
156
|
+
print(f"Found database: {db_manager.title}")
|
157
|
+
await db_manager.close()
|
158
|
+
```
|
159
|
+
|
160
|
+
## Page Content Management
|
161
|
+
|
162
|
+
Create rich Notion pages using enhanced Markdown:
|
163
|
+
|
164
|
+
```python
|
165
|
+
from notionary.core.page.notion_page_manager import NotionPageManager
|
166
|
+
|
167
|
+
async def create_rich_page():
|
168
|
+
url = "https://www.notion.so/Your-Page-1cd389d57bd381e58be9d35ce24adf3d"
|
169
|
+
page_manager = NotionPageManager(url=url)
|
170
|
+
|
171
|
+
await page_manager.set_title("Notionary Demo")
|
172
|
+
await page_manager.set_page_icon(emoji="✨")
|
173
|
+
await page_manager.set_page_cover("https://images.unsplash.com/photo-1555066931-4365d14bab8c")
|
174
|
+
|
175
|
+
markdown = '''
|
176
|
+
# Notionary Rich Content Demo
|
177
|
+
|
178
|
+
!> [💡] This page was created with Notionary's custom Markdown syntax.
|
179
|
+
|
180
|
+
## Features
|
181
|
+
- Easy-to-use Python API
|
182
|
+
- **Rich** Markdown support
|
183
|
+
- Async functionality
|
184
|
+
|
185
|
+
+++ Implementation Details
|
186
|
+
Notionary uses a custom converter to transform Markdown into Notion blocks.
|
187
|
+
This makes it easy to create rich content programmatically.
|
188
|
+
'''
|
189
|
+
|
190
|
+
await page_manager.replace_content(markdown)
|
191
|
+
```
|
192
|
+
|
193
|
+
## Perfect for AI Agents and Automation
|
194
|
+
|
195
|
+
- **Dynamic Content Generation**: AI agents can generate content in Markdown and render it as Notion pages
|
196
|
+
- **Schema-Aware Operations**: Automatically validate and format properties
|
197
|
+
- **Simplified API**: Easier integration with AI workflows
|
198
|
+
|
199
|
+
## Examples
|
200
|
+
|
201
|
+
See the `examples` folder for:
|
202
|
+
|
203
|
+
- Database discovery and querying
|
204
|
+
- Rich page creation with Markdown
|
205
|
+
- Entry management
|
206
|
+
- Metadata manipulation
|
207
|
+
|
208
|
+
## License
|
209
|
+
|
210
|
+
MIT
|
211
|
+
|
212
|
+
## Contributing
|
213
|
+
|
214
|
+
Contributions welcome — feel free to submit a pull request!
|
@@ -0,0 +1,6 @@
|
|
1
|
+
notionary/__init__.py,sha256=5T16clJlSHFsopcPUnkGrEo8spNDUQ0i-O00UEF7nR8,320
|
2
|
+
notionary-0.1.2.dist-info/licenses/LICENSE,sha256=zOm3cRT1qD49eg7vgw95MI79rpUAZa1kRBFwL2FkAr8,1120
|
3
|
+
notionary-0.1.2.dist-info/METADATA,sha256=Jq8_KHO1h3KIKaA0JVbpyXbhRbBP6tkxAvausROYyVM,6153
|
4
|
+
notionary-0.1.2.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
5
|
+
notionary-0.1.2.dist-info/top_level.txt,sha256=fhONa6BMHQXqthx5PanWGbPL0b8rdFqhrJKVLf_adSs,10
|
6
|
+
notionary-0.1.2.dist-info/RECORD,,
|
@@ -0,0 +1 @@
|
|
1
|
+
notionary
|
@@ -1,43 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.4
|
2
|
-
Name: notionary
|
3
|
-
Version: 0.1.0
|
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: notion-client>=2.0.0
|
14
|
-
Requires-Dist: markdown-it-py>=3.0.0
|
15
|
-
Requires-Dist: beautifulsoup4>=4.13.0
|
16
|
-
Requires-Dist: httpx>=0.28.0
|
17
|
-
Requires-Dist: python-dotenv>=1.1.0
|
18
|
-
Requires-Dist: lxml>=5.3.0
|
19
|
-
Requires-Dist: attrs>=25.3.0
|
20
|
-
Dynamic: author
|
21
|
-
Dynamic: author-email
|
22
|
-
Dynamic: classifier
|
23
|
-
Dynamic: description
|
24
|
-
Dynamic: description-content-type
|
25
|
-
Dynamic: home-page
|
26
|
-
Dynamic: license-file
|
27
|
-
Dynamic: requires-dist
|
28
|
-
Dynamic: requires-python
|
29
|
-
Dynamic: summary
|
30
|
-
|
31
|
-
# 🧠Notionary
|
32
|
-
|
33
|
-
**Notionary** is a Python toolkit that enables seamless conversion between **Markdown** and **Notion blocks**, making it easier to build, edit, and format Notion pages programmatically.
|
34
|
-
|
35
|
-
---
|
36
|
-
|
37
|
-
## ✨ Features
|
38
|
-
|
39
|
-
- Convert Markdown strings into Notion block structures
|
40
|
-
- Convert Notion blocks back into Markdown
|
41
|
-
- Register and manage custom Notion block elements
|
42
|
-
- Generate LLM-ready prompts to explain your Markdown extensions
|
43
|
-
- Support for rich text formatting, inline styles, and block-level elements
|
notionary-0.1.0.dist-info/RECORD
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
notionary-0.1.0.dist-info/licenses/LICENSE,sha256=zOm3cRT1qD49eg7vgw95MI79rpUAZa1kRBFwL2FkAr8,1120
|
2
|
-
notionary-0.1.0.dist-info/METADATA,sha256=wQgkhmwcFG87iNI4Q3xa-XmuhISvYxvvC67QoxEuxfA,1436
|
3
|
-
notionary-0.1.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
4
|
-
notionary-0.1.0.dist-info/top_level.txt,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
5
|
-
notionary-0.1.0.dist-info/RECORD,,
|
@@ -1 +0,0 @@
|
|
1
|
-
|
File without changes
|
File without changes
|