📝 PyAct Builder
PyAct Builder is a lightweight yet powerful Markdown template engine that allows you to dynamically generate documents using Python scripts.
Thanks to recursive processing, you can build complex documents from small, independent blocks ("nodes"), inject data (dates, API results, calculations), and automate the creation of reports or static pages.
🚀 Key Features
- Python Integration: Each text fragment can have a corresponding
.pyscript that supplies data. - Recursion: Nest templates within templates without limits (e.g.,
Main -> Section -> Component). - Simple Syntax: Use
{[component]}to insert blocks and{{variable}}to insert data. - CLI Tool: A built-in command-line tool for quick setup and building.
📦 Installation
Install the package directly from PyPI:
pip install pyact
⚡ Quick Start
-
Initialize a new project: The tool automatically generates the directory structure and example files.
pyact make -
Build the document: Processes
main.mdand saves the result in theoutput/folder.pyact run
📂 Project Structure
After running the make command, your project will look like this:
.
├── main.md # Main input file
├── output/ # Destination for the final file (output.md)
└── nodes/ # Folder containing your components
├── header.md # Component template
└── header.py # Component logic (optional)
📖 How It Works
The system relies on two types of tags:
1. Component Tags: {[name]}
These insert content from the nodes/name.md file. If a corresponding nodes/name.py file exists, it will be executed first to provide data to the template.
Example in main.md:
# Daily Report
Below are the sales figures.
{[sales_table]}
2. Variable Tags: {{key}}
Inside .md files located in the nodes/ folder, you can use variables that will be replaced by the Python script.
Example in nodes/sales_table.py:
def sales_table():
# Return a dictionary (dict) with data
return {
"date": "2023-10-27",
"total": 1500
}
Example in nodes/sales_table.md:
### Sales for {{date}}
Total revenue was: **{{total}} USD**.
Final Result (output.md):
# Daily Report
Below are the sales figures.
### Sales for 2023-10-27
Total revenue was: **1500 USD**.
🛠️ Advanced
Returning JSON
If your Python script is complex, instead of a dictionary (dict), it can return a JSON formatted string. The engine will parse it automatically.
Error Handling
If you forget to create an .md file or if a .py script returns an error, the builder will notify you in the console. In the final output file, it will simply skip the faulty fragment instead of breaking the entire document.
Release files for pyact-engine 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyact_engine-0.1.0.tar.gz | 5.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyact_engine-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.7 kB
Release files / pyact_engine-0.1.0.tar.gz
| Download URL | pyact_engine-0.1.0.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e558c1aa89a139ea58efa5de7e021eec906ab1495d95008a3f18d66a29e68063
|
|
BLAKE2b-256 checksum How to use checksums |
ae8e9d5044d79719ee2c94a71b6c6a16950f9db275b5b341f1818c60747120a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / pyact_engine-0.1.0-py3-none-any.whl
| Download URL | pyact_engine-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9dccf785ce9ed58e82515eaf9fba030caee2b246be7bea8291c127b23b0b89d0
|
|
BLAKE2b-256 checksum How to use checksums |
bf2591839c5900ce72f640762b0d5f1110f58aa3208f527d4fcfa8816f77fef8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|