Skip to content

Commit 4c89d7e

Browse files
authored
Merge pull request #11 from posit-dev/refactor-docs
feat: add mjml authoring support.
2 parents d69a261 + 3530fb3 commit 4c89d7e

File tree

73 files changed

+2886
-816
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+2886
-816
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,31 +31,31 @@ jobs:
3131
run: uv sync --all-extras --dev
3232

3333
- name: Install emailer-lib
34-
run: uv pip install -e "./emailer-lib"
34+
run: uv pip install -e .
3535

3636
# quarto docs build ----
3737
- uses: quarto-dev/quarto-actions/setup@v2
38-
with:
39-
tinytex: true
38+
# with:
39+
# tinytex: true
4040

4141
- name: Build docs
4242
run: |
43-
uv run quartodoc build --verbose && uv run quarto render
43+
cd docs && uv run quartodoc build --verbose && uv run quarto render
4444
4545
- name: Deploy
4646
uses: JamesIves/github-pages-deploy-action@v4
4747
if: ${{ github.ref == 'refs/heads/main' }}
4848
with:
4949
force: false
50-
folder: _site
50+
folder: docs/_site
5151
clean-exclude: pr-preview
5252

5353
- name: Deploy (preview)
5454
uses: rossjrw/pr-preview-action@v1
5555
# if in a PR
5656
if: ${{ github.event_name == 'pull_request' }}
5757
with:
58-
source-dir: _site
58+
source-dir: docs/_site
5959

6060
test-emailer-lib:
6161
runs-on: ubuntu-latest
@@ -81,18 +81,18 @@ jobs:
8181
run: uv sync --all-extras --dev
8282

8383
- name: Install emailer-lib
84-
run: uv pip install -e "./emailer-lib"
84+
run: uv pip install -e .
8585

8686
- name: Install the project deps
87-
run: uv pip install -e "./emailer-lib[dev]"
87+
run: uv pip install -e .[dev]
8888

8989
- name: Test emailer-lib
9090
run: |
91-
uv run pytest emailer-lib/emailer_lib/tests/ --cov=emailer_lib --cov-report=xml --cov-report=term-missing
91+
uv run pytest emailer_lib/tests/ --cov=emailer_lib --cov-report=xml --cov-report=term-missing
9292
9393
- name: Upload coverage reports
9494
uses: codecov/codecov-action@v4
9595
if: ${{ matrix.python-version == '3.12' }}
9696
with:
9797
file: emailer-lib/coverage.xml
98-
flags: emailer-lib
98+
flags: emailer-lib

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,4 @@ _site
212212

213213
.DS_Store
214214

215-
.vscode
215+
.vscode

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
build-docs: generate-mjml-tags
2+
cd docs && uv run quartodoc build --verbose && quarto render
3+
4+
preview:
5+
cd docs && quarto preview
6+
7+
test:
8+
pytest emailer_lib/tests emailer_lib/mjml/tests --cov-report=xml
9+
10+
test-update:
11+
pytest emailer_lib/tests emailer_lib/mjml/tests --snapshot-update
12+
13+
generate-mjml-tags:
14+
python3 emailer_lib/mjml/scripts/generate_tags.py

README.md

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,84 @@
1-
# email-for-data-science
1+
# emailer-lib
2+
3+
<!-- [![Python Versions](https://img.shields.io/pypi/pyversions/gt_extras.svg)](https://pypi.python.org/pypi/gt-extras) -->
4+
<!-- [![PyPI](https://img.shields.io/pypi/v/gt-extras?logo=python&logoColor=white&color=orange)](https://pypi.org/project/gt-extras/) -->
5+
<!-- [![PyPI Downloads](https://static.pepy.tech/badge/gt-extras)](https://pepy.tech/projects/gt-extras) -->
6+
<!-- [![License](https://img.shields.io/github/license/posit-dev/email-for-data-science)](https://github.com/posit-dev/email-for-data-science/blob/main/LICENSE) -->
7+
8+
<!-- [![Tests](https://github.com/posit-dev/gt-extras/actions/workflows/ci_tests.yml/badge.svg)](https://github.com/posit-dev/gt-extras/actions/workflows/ci_tests.yml) -->
9+
[![Documentation](https://img.shields.io/badge/docs-project_website-blue.svg)](https://posit-dev.github.io/email-for-data-science/reference/)
10+
<!-- [![Repo Status](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip) -->
11+
<!-- [![Contributors](https://img.shields.io/github/contributors/posit-dev/gt-extras)](https://github.com/posit-dev/gt-extras/graphs/contributors) -->
12+
<!-- [![Codecov](https://codecov.io/gh/posit-dev/gt-extras/branch/main/graph/badge.svg)](https://codecov.io/gh/posit-dev/gt-extras) -->
13+
14+
> ⚠️ **emailer-lib is currently in development, expect breaking changes.**
15+
16+
17+
### What is [emailer-lib](https://posit-dev.github.io/email-for-data-science/reference/)?
18+
19+
**emailer-lib** is a Python package for serializing, previewing, and sending email messages in a consistent, simple structure. It provides utilities to convert emails from different sources (Redmail, Yagmail, MJML, Quarto JSON) into a unified intermediate format, and send them via multiple backends (Gmail, SMTP, Mailgun, etc.).
20+
21+
The package is designed for data science workflows and Quarto projects, making it easy to generate, preview, and deliver rich email content programmatically.
22+
23+
<!-- ## Installation
24+
Install the latest release from your local repo or PyPI:
25+
26+
```bash
27+
pip install -e ./emailer-lib
28+
```
29+
-->
30+
31+
## Example Usage
32+
33+
```python
34+
from emailer_lib import (
35+
quarto_json_to_intermediate_email,
36+
IntermediateEmail,
37+
send_intermediate_email_with_gmail,
38+
)
39+
40+
# Read a Quarto email JSON file
41+
email_struct = quarto_json_to_intermediate_email("email.json")
42+
43+
# Preview the email as HTML
44+
email_struct.write_preview_email("preview.html")
45+
46+
# Send the email via Gmail
47+
send_intermediate_email_with_gmail("[email protected]", "your_password", email_struct)
48+
```
49+
50+
## Features
51+
52+
- **Unified email structure** for serialization and conversion
53+
- **Convert** emails from Redmail, Yagmail, MJML, and Quarto JSON
54+
- **Send** emails via Gmail, SMTP, Mailgun, and more
55+
- **Preview** emails as HTML files
56+
- **Support for attachments** (inline and external)
57+
- **Simple API** for integration in data science and reporting workflows
58+
59+
## Contributing
60+
If you encounter a bug, have usage questions, or want to share ideas to make this package better, please feel free to file an [issue](https://github.com/posit-dev/email-for-data-science/issues).
61+
62+
<!--
63+
## Code of Conduct
64+
Please note that the **gt-extras** project is released with a [contributor code of conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct/).<br>By participating in this project you agree to abide by its terms. -->
65+
66+
<!-- ## 📄 License
67+
68+
**Great Tables** is licensed under the MIT license.
69+
70+
© Posit Software, PBC. -->
71+
72+
<!-- ## Citation
73+
If you use **gt-extras** in your work, please cite the package:
74+
75+
```bibtex
76+
@software{gt_extras,
77+
authors = {Jules Walzer-Goldfeld, Michael Chow, and Rich Iannone},
78+
license = {MIT},
79+
title = {{gt-extras: Extra helpers for great-tables in Python.}},
80+
url = {https://github.com/posit-dev/gt-extras}, version = {0.0.1}
81+
}
82+
``` -->
83+
84+
For more information, see the [docs](https://posit-dev.github.io/email-for-data-science/reference) or [open an issue](https://github.com/posit-dev/email-for-data-science/issues) with questions or suggestions!

cover.png

-50 KB
Binary file not shown.

docs/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/.quarto/
2+
/reference/
File renamed without changes.

_quarto.yml renamed to docs/_quarto.yml

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,52 @@ quartodoc:
7070
- send_intermediate_email_with_mailgun
7171
- send_quarto_email_with_gmail
7272

73-
7473
- title: Utilities
7574
desc: >
7675
Previews and more
7776
contents:
7877
- write_email_message_to_file
7978

79+
- title: MJML Authoring
80+
desc: >
81+
Write responsive emails with MJML
82+
package: emailer_lib
83+
contents:
84+
- mjml.mjml
85+
- mjml.head
86+
- mjml.body
87+
- mjml.mj_attributes
88+
- mjml.mj_all
89+
- mjml.mj_class
90+
- mjml.breakpoint
91+
- mjml.font
92+
- mjml.html_attributes
93+
- mjml.html_attribute
94+
- mjml.preview
95+
- mjml.style
96+
- mjml.title
97+
- mjml.accordion
98+
- mjml.accordion_element
99+
- mjml.accordion_text
100+
- mjml.accordion_title
101+
- mjml.button
102+
- mjml.carousel
103+
- mjml.carousel_image
104+
- mjml.column
105+
- mjml.divider
106+
- mjml.group
107+
- mjml.hero
108+
- mjml.image
109+
- mjml.navbar
110+
- mjml.navbar_link
111+
- mjml.raw
112+
- mjml.section
113+
- mjml.social
114+
- mjml.social_element
115+
- mjml.spacer
116+
- mjml.table
117+
- mjml.text
118+
- mjml.wrapper
80119

81120
format:
82121
html:
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)