Compose complex notion formulas in Python.
Project description
Notion Formulas
Notion Formulas is a Python library designed for composing and manipulating complex formulas for Notion programmatically. Enhance your Notion workspace by leveraging the power of Python to create and manage formulas.
Installation
To get started with Notion Formulas, you can install the package using pip:
pip install notion-formulas
Usage
from notion_formulas import Number, prop
x: Number = prop("x")
y: Number = prop("y")
print(x + y) # Prints `prop("x") + prop("y")`
API
The complete Notion Formulas API maintains consistency with the original names, with the following adjustments:
- Camel casing is converted to snake case (e.g.,
replaceAll()
becomesreplace_all()
). - Functions matching python keywords are modified with a trailing underscore: (i.g.
if()
becomesif_()
). - Constants are uppercased (i.g.
e
becomesE
).
Data types
The api is fully typed and defines following data types for expressions: Boolean
, Number
, String
, and Date
, allowing your formulas to be typed checked by mypy.
Examples
For a comprehensive example, refer to the code that generates a Taskwarrior style urgency score for a Notion task database in examples/urgency.py and the associated output examples/urgency.txt.
Contributing
Contributions to Notion Formulas are welcome and appreciated. If you'd like to contribute, please follow these steps:
- Fork the repository.
- Create a new branch for your changes.
- Make your changes and update the tests as needed.
- Submit a pull request with your changes.
For major changes, please open an issue first to discuss what you would like to change.
License
Notion Formulas is released under the MIT license, which allows for free and open use, modification, and distribution.
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 Distribution
Built Distribution
File details
Details for the file notion_formulas-1.1.0.tar.gz
.
File metadata
- Download URL: notion_formulas-1.1.0.tar.gz
- Upload date:
- Size: 15.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.23.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5fabf60afabaca76f8d45ad6fc285aff06a69c169ba31ce653306bb5d7f0578f |
|
MD5 | 7321f2d629cf20f82a3c51eb14134a9a |
|
BLAKE2b-256 | 47870db24e2ea95bc2c5606cc5e9ff20bb163532a84ec20bdc2593645d7d1eea |
Provenance
File details
Details for the file notion_formulas-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: notion_formulas-1.1.0-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.23.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86aade4097286a84236a0fe8bce9cf81305ef80dc85e4d14e1fc48fcb54c3372 |
|
MD5 | b6d7e9c85b9fc36e1a54ca1ef4a9c3b1 |
|
BLAKE2b-256 | f2cc6be92a4f02b99f503af2e0709542428c5e8cb6ac59ee6535e33b92f52826 |