Abstraction layer for the Notion API with declarative schema mapping
Project description
notion-api-utils
Abstraction layer for the Notion API. Define schemas declaratively and convert Python dicts to Notion's JSON format without writing boilerplate.
Install
pip install notion-api-utils
Usage
from notion_api_utils import Schema, Field, Title, RichText, Number, Select, Date, to_notion_properties
# Define a schema mapping your data to Notion properties
schema = Schema(fields={
"name": Field("Name", Title),
"email": Field("Email", Email),
"age": Field("Age", Number),
"status": Field("Status", Select),
"date": Field("Created At", Date),
})
# Your data
data = {
"name": "Lucas",
"email": "lucas@example.com",
"age": 25,
"status": "Active",
"date": "2026-03-25",
}
# Convert to Notion properties JSON
properties = to_notion_properties(data, schema)
# Use `properties` in your Notion API call body
Output:
{
"Name": {"title": [{"text": {"content": "Lucas"}}]},
"Email": {"email": "lucas@example.com"},
"Age": {"number": 25},
"Status": {"select": {"name": "Active"}},
"Created At": {"date": {"start": "2026-03-25"}}
}
Supported Property Types
| Type | Input |
|---|---|
Title |
str |
RichText |
str |
Number |
int | float |
Select |
str |
MultiSelect |
list[str] |
Date |
str | date | datetime or {"start": ..., "end": ...} |
Checkbox |
bool |
Email |
str |
Url |
str |
PhoneNumber |
str |
Status |
str |
Relation |
list[str] (page IDs) |
People |
list[str] (user IDs) |
Files |
list[str] (URLs) |
Custom Source Key
When your dict key differs from the schema key:
schema = Schema(fields={
"nome": Field("Name", Title, source_key="nome_completo"),
})
data = {"nome_completo": "Lucas"}
properties = to_notion_properties(data, schema)
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
iaxys_notion_utils-0.2.5.tar.gz
(15.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file iaxys_notion_utils-0.2.5.tar.gz.
File metadata
- Download URL: iaxys_notion_utils-0.2.5.tar.gz
- Upload date:
- Size: 15.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4819741190702bcf430b6c7d7f359f2957d3c84b1fdb80aca944a7930bb5b319
|
|
| MD5 |
f3ae7b4e002ec437d232f42b33e3f24a
|
|
| BLAKE2b-256 |
27122bbca675a5a7b9c70c21dce1d4a58798768311565ddce778b2427a6e0a96
|
File details
Details for the file iaxys_notion_utils-0.2.5-py3-none-any.whl.
File metadata
- Download URL: iaxys_notion_utils-0.2.5-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c701e62c5c448704027bd4e707578bce3d3572dacd208c79bc51d7f1397d634
|
|
| MD5 |
247210753a1f265d7f02ebd8f7c35057
|
|
| BLAKE2b-256 |
51e7a5eba786ce67cf25459e3ebd6a53056b5815b7f501941016e45e748888a3
|