Quipus, data retrieval, template manager and delivery all in one!
Documentation: TBD
Source Code: https://github.com/Monkey-Market/quipus
Quipus is a Python package that allows you to retrieve data from different sources, manage templates and deliver them in a single package. It is designed to be simple and easy to use, with a focus on performance and reliability.
Key features:
- Data retrieval: Retrieve data from different sources such as databases, APIs, and files.
- Template manager: Manage templates for different types of documents.
- Delivery: Deliver the generated documents to different destinations such as email, file system, cloud storage and more.
- Easy to use: Simple and easy to use package with a focus on developer experience.
Quipus is empowered by the foundational work of industry giants. The following are the key dependencies:
- Pandas for data manipulation.
- WeasyPrint for document generation.
- Boto3 for AWS cloud storage.
You can install Quipus using pip
:
pip install quipus
Or with poetry
:
poetry add quipus
import quipus as qp
template_manager = (
qp.TemplateManager()
.from_csv("data/data_source.csv")
.with_template(qp.Template("templates/pdf_template.html"))
.decide_filename_with(lambda data: f"{data['name']}")
.to_pdf(output_path="output", create_dir=True)
)
Note: These can be set up as environment variables for security reasons.
smtp_config = qp.SMTPConfig(
server="smtp.server.com",
port=587,
username="username",
password="password",
use_tls=True,
)
email_sender = qp.EmailSender(smtp_config)
for item in template_manager.data:
smtp_message = (
qp.EmailMessageBuilder(
from_address="[email protected]",
to_addresses=[item["email"], "[email protected]"]
)
.with_body_path("templates/email_body_template.html", "html", item)
.with_subject("Your email subject")
.add_attachment_from_path(f"output/{item['name']}.pdf")
.build()
)
email_sender.send(smtp_message)
This is a simple example of how you can use Quipus to fetch data from a CSV file, generate PDFs using a template, and send emails with the generated PDFs as attachments.
Contributions are welcome! Please read our contributing guidelines for more information.
You can always open an issue or submit a pull request if you have any suggestions or improvements.
Jorge U. Alarcón |
Fernando Nicolás |
The name "Quipus" comes from the Quechua word "khipu" which refers to a method used by the Incas to keep records and communicate information through a system of knots and strings.
We thought it was a fitting name for a package that helps you manage and deliver data in a structured and organized way.
You can read more about it in this wikipedia page.
This project is licensed under the terms of the GNU General Public License v3.0.