Skip to content

Commit 15d4d01

Browse files
committed
wip
1 parent b304b99 commit 15d4d01

25 files changed

+817
-0
lines changed

.env.sample

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
TEMPLATELESS_API_KEY=<YOUR_API_KEY>
2+
TEMPLATELESS_EMAIL_ADDRESS=<YOUR_EMAIL_ADDRESS>

.github/workflows/tests.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Tests
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
branches:
8+
- main
9+
jobs:
10+
tests:
11+
runs-on: ubuntu-20.04
12+
strategy:
13+
matrix:
14+
python-version:
15+
- "3.6"
16+
- "3.7"
17+
- "3.8"
18+
- "3.9"
19+
- "3.10"
20+
- "3.11"
21+
steps:
22+
- uses: actions/checkout@v3
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v4
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
31+
- name: Lint with Ruff
32+
if: ${{ matrix.python-version != '3.6' }}
33+
run: |
34+
pip install ruff
35+
# stop the build if there are Python syntax errors or undefined names
36+
ruff --output-format=github --select=E9,F63,F7,F82 .
37+
# default set of ruff rules with GitHub Annotations
38+
ruff --output-format=github .
39+
- name: Test with pytest
40+
run: |
41+
pip install pytest
42+
python -m pytest

CODE_OF_CONDUCT.md

+133
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
2+
# Contributor Covenant Code of Conduct
3+
4+
## Our Pledge
5+
6+
We as members, contributors, and leaders pledge to make participation in our
7+
community a harassment-free experience for everyone, regardless of age, body
8+
size, visible or invisible disability, ethnicity, sex characteristics, gender
9+
identity and expression, level of experience, education, socio-economic status,
10+
nationality, personal appearance, race, caste, color, religion, or sexual
11+
identity and orientation.
12+
13+
We pledge to act and interact in ways that contribute to an open, welcoming,
14+
diverse, inclusive, and healthy community.
15+
16+
## Our Standards
17+
18+
Examples of behavior that contributes to a positive environment for our
19+
community include:
20+
21+
* Demonstrating empathy and kindness toward other people
22+
* Being respectful of differing opinions, viewpoints, and experiences
23+
* Giving and gracefully accepting constructive feedback
24+
* Accepting responsibility and apologizing to those affected by our mistakes,
25+
and learning from the experience
26+
* Focusing on what is best not just for us as individuals, but for the overall
27+
community
28+
29+
Examples of unacceptable behavior include:
30+
31+
* The use of sexualized language or imagery, and sexual attention or advances of
32+
any kind
33+
* Trolling, insulting or derogatory comments, and personal or political attacks
34+
* Public or private harassment
35+
* Publishing others' private information, such as a physical or email address,
36+
without their explicit permission
37+
* Other conduct which could reasonably be considered inappropriate in a
38+
professional setting
39+
40+
## Enforcement Responsibilities
41+
42+
Community leaders are responsible for clarifying and enforcing our standards of
43+
acceptable behavior and will take appropriate and fair corrective action in
44+
response to any behavior that they deem inappropriate, threatening, offensive,
45+
or harmful.
46+
47+
Community leaders have the right and responsibility to remove, edit, or reject
48+
comments, commits, code, wiki edits, issues, and other contributions that are
49+
not aligned to this Code of Conduct, and will communicate reasons for moderation
50+
decisions when appropriate.
51+
52+
## Scope
53+
54+
This Code of Conduct applies within all community spaces, and also applies when
55+
an individual is officially representing the community in public spaces.
56+
Examples of representing our community include using an official email address,
57+
posting via an official social media account, or acting as an appointed
58+
representative at an online or offline event.
59+
60+
## Enforcement
61+
62+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
63+
reported to the community leaders responsible for enforcement at
64+
65+
All complaints will be reviewed and investigated promptly and fairly.
66+
67+
All community leaders are obligated to respect the privacy and security of the
68+
reporter of any incident.
69+
70+
## Enforcement Guidelines
71+
72+
Community leaders will follow these Community Impact Guidelines in determining
73+
the consequences for any action they deem in violation of this Code of Conduct:
74+
75+
### 1. Correction
76+
77+
**Community Impact**: Use of inappropriate language or other behavior deemed
78+
unprofessional or unwelcome in the community.
79+
80+
**Consequence**: A private, written warning from community leaders, providing
81+
clarity around the nature of the violation and an explanation of why the
82+
behavior was inappropriate. A public apology may be requested.
83+
84+
### 2. Warning
85+
86+
**Community Impact**: A violation through a single incident or series of
87+
actions.
88+
89+
**Consequence**: A warning with consequences for continued behavior. No
90+
interaction with the people involved, including unsolicited interaction with
91+
those enforcing the Code of Conduct, for a specified period of time. This
92+
includes avoiding interactions in community spaces as well as external channels
93+
like social media. Violating these terms may lead to a temporary or permanent
94+
ban.
95+
96+
### 3. Temporary Ban
97+
98+
**Community Impact**: A serious violation of community standards, including
99+
sustained inappropriate behavior.
100+
101+
**Consequence**: A temporary ban from any sort of interaction or public
102+
communication with the community for a specified period of time. No public or
103+
private interaction with the people involved, including unsolicited interaction
104+
with those enforcing the Code of Conduct, is allowed during this period.
105+
Violating these terms may lead to a permanent ban.
106+
107+
### 4. Permanent Ban
108+
109+
**Community Impact**: Demonstrating a pattern of violation of community
110+
standards, including sustained inappropriate behavior, harassment of an
111+
individual, or aggression toward or disparagement of classes of individuals.
112+
113+
**Consequence**: A permanent ban from any sort of public interaction within the
114+
community.
115+
116+
## Attribution
117+
118+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119+
version 2.1, available at
120+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
121+
122+
Community Impact Guidelines were inspired by
123+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
124+
125+
For answers to common questions about this code of conduct, see the FAQ at
126+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
127+
[https://www.contributor-covenant.org/translations][translations].
128+
129+
[homepage]: https://www.contributor-covenant.org
130+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
131+
[Mozilla CoC]: https://github.com/mozilla/diversity
132+
[FAQ]: https://www.contributor-covenant.org/faq
133+
[translations]: https://www.contributor-covenant.org/translations

Pipfile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[[source]]
2+
url = "https://pypi.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[packages]
7+
python-dotenv = "*"
8+
9+
[dev-packages]
10+
11+
[requires]
12+
python_version = "3.9"

Pipfile.lock

+30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Templateless Python
2+
3+
[![PyPI package](https://badge.fury.io/py/templateless.svg)](https://pypi.org/project/templateless/)
4+
[![Github Actions](https://img.shields.io/github/actions/workflow/status/templateless/templateless-python/tests.yml)](https://github.com/templateless/templateless-python/actions)
5+
[![Downloads](https://img.shields.io/pypi/dm/templateless)](https://pypi.org/project/templateless/)
6+
7+
## What is Templateless?
8+
9+
[Templateless](https://templateless.com) lets you generate and send transactional emails quickly and easily so you can ship faster 🚀
10+
11+
## ✨ Features
12+
13+
- 👋 **Anti drag-and-drop by design** — emails are a part of your code
14+
-**Components as code** — function calls turn into email HTML components
15+
- 💻 **SDK for any language** — use your favorite [programming language](https://github.com/orgs/templateless/repositories)
16+
- 🔍 **Meticulously tested** — let us worry about email client compatibility
17+
- 💌 **Use your favorite ESP** — Amazon SES, SendGrid, Mailgun + more
18+
- 💪 **Email infrastructure** — rate-limiting, retries, scheduling + more
19+
-**Batch sending** — send 1 email or 1,000 with one API call
20+
21+
## 🚀 Getting started
22+
23+
Install the package from PyPI, e. g. with pip:
24+
25+
```bash
26+
pip install templateless
27+
```
28+
29+
Import the `Templateless` class from the `templateless` package:
30+
31+
```python
32+
from templateless import Templateless
33+
templateless = Templateless()
34+
```
35+
36+
## 👩‍💻 Quick example
37+
38+
This is all it takes to send a signup confirmation email:
39+
40+
```python
41+
from templateless import Content, Email, EmailAddress, Templateless
42+
43+
44+
def main():
45+
content = (
46+
Content()
47+
.text("Hi, please **confirm your email**:")
48+
.button("Confirm Email', 'https://your-company.com/signup/confirm?token=XYZ")
49+
.build()
50+
)
51+
52+
email = (
53+
Email()
54+
.to(EmailAddress("<YOUR_CUSTOMERS_EMAIL_ADDRESS>"))
55+
.subject("Confirm your signup 👋")
56+
.content(content)
57+
.build()
58+
)
59+
60+
templateless = Templateless("<YOUR_API_KEY>")
61+
result = templateless.send(email)
62+
63+
print(result)
64+
65+
66+
if __name__ == "__main__":
67+
main()
68+
```
69+
70+
Note:
71+
72+
1. Get your **free API key** here: <https://app.templateless.com>
73+
1. There are more Python examples in the [examples](examples) folder
74+
75+
## 🤝 Contributing
76+
77+
- Contributions are more than welcome <3
78+
- Please **star this repo** for more visibility ★
79+
80+
## 📫 Get in touch
81+
82+
- For customer support feel free to email us at [[email protected]](mailto:[email protected])
83+
84+
- Have suggestions or want to give feedback? Here's how to reach us:
85+
86+
- For feature requests, please [start a discussion](https://github.com/templateless/templateless-python/discussions)
87+
- Found a bug? [Open an issue!](https://github.com/templateless/templateless-python/issues)
88+
- We are also on Twitter: [@Templateless](https://twitter.com/templateless)
89+
90+
## 🍻 License
91+
92+
[MIT](LICENSE)

SECURITY.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Security Policy
2+
3+
## Reporting a Vulnerability
4+
5+
Please report (suspected) security vulnerabilities to
6+
7+
8+
You will receive a response within 72 hours. If the issue is confirmed,
9+
we will release a patch as soon as possible depending on complexity.

examples/simple.py

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import os, sys
2+
from dotenv import load_dotenv
3+
from templateless import Content, Email, EmailAddress, Templateless
4+
5+
6+
def main():
7+
load_dotenv()
8+
9+
api_key = os.getenv("TEMPLATELESS_API_KEY")
10+
if api_key is None:
11+
print("Set TEMPLATELESS_API_KEY to your Templateless API key")
12+
sys.exit(1)
13+
14+
email_address = os.getenv("TEMPLATELESS_EMAIL_ADDRESS")
15+
if email_address is None:
16+
print("Set TEMPLATELESS_EMAIL_ADDRESS to your own email address")
17+
sys.exit(1)
18+
19+
content = Content().text("Hello world").build()
20+
21+
email = (
22+
Email()
23+
.to(EmailAddress(email_address))
24+
.subject("Hello")
25+
.content(content)
26+
.build()
27+
)
28+
29+
templateless = Templateless(api_key)
30+
result = templateless.send(email)
31+
32+
print(result)
33+
34+
35+
if __name__ == "__main__":
36+
main()

pyproject.toml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[project]
2+
name = "templateless"
3+
description = "Ship faster by sending elegant emails using just code"
4+
version = "0.1.0-alpha.0"
5+
readme = "README.md"
6+
authors = []
7+
license = { file = "LICENSE" }
8+
classifiers = [
9+
"License :: OSI Approved :: MIT License",
10+
"Programming Language :: Python :: 3.6",
11+
"Programming Language :: Python :: 3.8",
12+
"Programming Language :: Python :: 3.9",
13+
"Programming Language :: Python :: 3.10",
14+
"Programming Language :: Python :: 3.11",
15+
]
16+
keywords = ["email", "templates"]
17+
requires-python = ">=3.6"
18+
19+
[project.urls]
20+
Homepage = "https://templateless.com/"
21+
22+
[build-system]
23+
requires = ["setuptools", "setuptools-scm"]
24+
build-backend = "setuptools.build_meta"
25+
26+
[tool.setuptools]
27+
packages = ["templateless"]
28+
29+
[tool.setuptools.package-data]
30+
templateless = ["py.typed"]

0 commit comments

Comments
 (0)