Skip to main content

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:

  1. First, make sure you have the latest version of twine and build:

    pip install --upgrade twine build
    
  2. Build the distribution packages:

    python -m build
    

    This will create a dist directory with .tar.gz and .whl files.

  3. Test the package locally before publishing:

    pip install dist/mayil-*.whl
    
  4. Create an account on PyPI if you don't have one.

  5. Create a .pypirc file in your home directory with your PyPI credentials:

    [pypi]
    username = your_username
    password = your_password
    
  6. 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
    
  7. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mayil-0.1.0.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mayil-0.1.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

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

Hashes for mayil-0.1.0.tar.gz
Algorithm Hash digest
SHA256 81fa14481c989a082ce9efdbc7be0f961e14bec2c0de569547218c1fd9e42977
MD5 c878d793a49579424cf536cb14875edf
BLAKE2b-256 e22e8d98e331cb39b4481495f1eafe1951f27b96c9a438aff32cb6ec76c3a373

See more details on using hashes here.

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

Hashes for mayil-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4f5d57e28964f23cb3484f6f6f5e60df699f7bab712b6710b663faff0ea45a70
MD5 86c420ca246d567d2c9d2214347a233b
BLAKE2b-256 de391f876fd2afdcf172c8bc2ca25ac557716daea882a9fe5db727deba1d0b69

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page