A Python library for generating beautiful HTML emails
Project description
Mayil
A Python library for generating beautiful, structured HTML emails with a simple and intuitive interface.
Installation
pip install mayil
Quick Start
from mayil import Mayil
# Create a new email builder instance
my = Mayil()
# Add components to your email
my.header("Welcome to Our Newsletter")
my.text("This is a sample text paragraph.")
my.text("This is another paragraph.")
# Get the complete HTML body
html_content = my.body
Features
- 🎨 Beautiful, modern email templates
- 📊 Rich components for data visualization
- 📱 Responsive design that works on all devices
- 🎯 Chainable methods for easy composition
- 🛠️ Built-in styling and formatting
- 📦 Easy to install and use
Components
Basic Components
Header
my.header("Your Header Text")
Subheader
my.subheader("Your Subheader Text")
Text
my.text("Your paragraph text")
Divider
my.divider()
Data Components
Metric
my.metric("Total Users", 1000, "10% increase")
Sticky Note
my.sticky_note("Important message here")
DataFrame
import pandas as pd
df = pd.DataFrame({
'Name': ['Alice', 'Bob', 'Charlie'],
'Score': [85, 92, 78]
})
my.dataframe(df)
Formatted Table
data = [
['Name', 'Age', 'Score'],
['Alice', 25, 85],
['Bob', 30, 92],
['Charlie', 28, 78]
]
my.ftable(data, rules=[(1, '>', 80, 'green')])
Layout Components
Columns
my.columns([
my.metric("Users", 1000),
my.metric("Revenue", "$10,000"),
my.metric("Growth", "15%")
])
Hyperlink
my.hyperlink("Click here", "https://example.com")
Advanced Usage
Custom Styling
my = Mayil(style={
'primary_color': '#88C0D0',
'accent_color': '#A3BE8C',
'text_color': '#2E3440'
})
Template Customization
my = Mayil(template='custom_template.html')
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Publishing to PyPI
To publish Mayil to PyPI, follow these steps:
-
First, make sure you have the latest version of
twineandbuild:pip install --upgrade twine build
-
Build the distribution packages:
python -m build
This will create a
distdirectory with.tar.gzand.whlfiles. -
Test the package locally before publishing:
pip install dist/mayil-*.whl
-
Create an account on PyPI if you don't have one.
-
Create a
.pypircfile in your home directory with your PyPI credentials:[pypi] username = your_username password = your_password
-
Upload the package to PyPI (use one of these commands):
# Option 1: Using quotes to escape the wildcard python -m twine upload "dist/*" # Option 2: Explicitly listing the files python -m twine upload dist/mayil-*.whl dist/mayil-*.tar.gz
-
For test releases, you can use TestPyPI:
python -m twine upload --repository testpypi "dist/*"
After publishing, users can install your package using:
pip install mayil
Note: Make sure to update the version number in setup.py before each new release.
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
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 mayil-0.1.0.tar.gz.
File metadata
- Download URL: mayil-0.1.0.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81fa14481c989a082ce9efdbc7be0f961e14bec2c0de569547218c1fd9e42977
|
|
| MD5 |
c878d793a49579424cf536cb14875edf
|
|
| BLAKE2b-256 |
e22e8d98e331cb39b4481495f1eafe1951f27b96c9a438aff32cb6ec76c3a373
|
File details
Details for the file mayil-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mayil-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f5d57e28964f23cb3484f6f6f5e60df699f7bab712b6710b663faff0ea45a70
|
|
| MD5 |
86c420ca246d567d2c9d2214347a233b
|
|
| BLAKE2b-256 |
de391f876fd2afdcf172c8bc2ca25ac557716daea882a9fe5db727deba1d0b69
|