goatnotify-jinja 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- goatnotify_jinja-0.1.0/LICENSE +21 -0
- goatnotify_jinja-0.1.0/PKG-INFO +31 -0
- goatnotify_jinja-0.1.0/README.md +9 -0
- goatnotify_jinja-0.1.0/pyproject.toml +46 -0
- goatnotify_jinja-0.1.0/pyproject.toml.orig +36 -0
- goatnotify_jinja-0.1.0/src/goatnotify/jinja/__init__.py +32 -0
- goatnotify_jinja-0.1.0/src/goatnotify/jinja/py.typed +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Louis Midson LAJEANTY <midsonlajeanty@proton.me>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: goatnotify-jinja
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Jinja2 template renderer for GoatNotify.
|
|
5
|
+
Keywords: notifications,email,smtp,webhooks,asyncio,typed
|
|
6
|
+
Author: Louis Midson LAJEANTY
|
|
7
|
+
Author-email: Louis Midson LAJEANTY <midsonlajeanty@proton.me>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
14
|
+
Classifier: Typing :: Typed
|
|
15
|
+
Requires-Dist: goatnotify-core==0.1.0
|
|
16
|
+
Requires-Dist: jinja2>=3.1
|
|
17
|
+
Requires-Python: >=3.14
|
|
18
|
+
Project-URL: Homepage, https://github.com/goatlabshq/goatnotify
|
|
19
|
+
Project-URL: Documentation, https://goatlabshq.github.io/goatnotify/
|
|
20
|
+
Project-URL: Issues, https://github.com/goatlabshq/goatnotify/issues
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# goatnotify-jinja
|
|
24
|
+
|
|
25
|
+
Jinja2 template renderer for GoatNotify.
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install goatnotify-jinja
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Documentation: <https://goatlabshq.github.io/goatnotify/>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "goatnotify-jinja"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Jinja2 template renderer for GoatNotify."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
requires-python = ">=3.14"
|
|
9
|
+
keywords = [
|
|
10
|
+
"notifications",
|
|
11
|
+
"email",
|
|
12
|
+
"smtp",
|
|
13
|
+
"webhooks",
|
|
14
|
+
"asyncio",
|
|
15
|
+
"typed",
|
|
16
|
+
]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 3 - Alpha",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.14",
|
|
22
|
+
"Typing :: Typed",
|
|
23
|
+
]
|
|
24
|
+
dependencies = [
|
|
25
|
+
"goatnotify-core==0.1.0",
|
|
26
|
+
"jinja2>=3.1",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[[project.authors]]
|
|
30
|
+
name = "Louis Midson LAJEANTY"
|
|
31
|
+
email = "midsonlajeanty@proton.me"
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Homepage = "https://github.com/goatlabshq/goatnotify"
|
|
35
|
+
Documentation = "https://goatlabshq.github.io/goatnotify/"
|
|
36
|
+
Issues = "https://github.com/goatlabshq/goatnotify/issues"
|
|
37
|
+
|
|
38
|
+
[build-system]
|
|
39
|
+
requires = ["uv_build>=0.12,<0.14"]
|
|
40
|
+
build-backend = "uv_build"
|
|
41
|
+
|
|
42
|
+
[tool.uv.build-backend]
|
|
43
|
+
module-name = "goatnotify.jinja"
|
|
44
|
+
|
|
45
|
+
[tool.uv.sources.goatnotify-core]
|
|
46
|
+
workspace = true
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "goatnotify-jinja"
|
|
3
|
+
version = "0.1.0" # x-release-please-version
|
|
4
|
+
description = "Jinja2 template renderer for GoatNotify."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
authors = [{ name = "Louis Midson LAJEANTY", email = "midsonlajeanty@proton.me" }]
|
|
9
|
+
requires-python = ">=3.14"
|
|
10
|
+
keywords = ["notifications", "email", "smtp", "webhooks", "asyncio", "typed"]
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 3 - Alpha",
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Programming Language :: Python :: 3.14",
|
|
16
|
+
"Typing :: Typed",
|
|
17
|
+
]
|
|
18
|
+
dependencies = [
|
|
19
|
+
"goatnotify-core==0.1.0", # x-release-please-version
|
|
20
|
+
"jinja2>=3.1",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[project.urls]
|
|
24
|
+
Homepage = "https://github.com/goatlabshq/goatnotify"
|
|
25
|
+
Documentation = "https://goatlabshq.github.io/goatnotify/"
|
|
26
|
+
Issues = "https://github.com/goatlabshq/goatnotify/issues"
|
|
27
|
+
|
|
28
|
+
[build-system]
|
|
29
|
+
requires = ["uv_build>=0.12,<0.14"]
|
|
30
|
+
build-backend = "uv_build"
|
|
31
|
+
|
|
32
|
+
[tool.uv.build-backend]
|
|
33
|
+
module-name = "goatnotify.jinja"
|
|
34
|
+
|
|
35
|
+
[tool.uv.sources]
|
|
36
|
+
goatnotify-core = { workspace = true }
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
from collections.abc import Mapping
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Self
|
|
5
|
+
|
|
6
|
+
from jinja2 import Environment, FileSystemLoader, StrictUndefined, select_autoescape
|
|
7
|
+
|
|
8
|
+
__all__ = ["JinjaRenderer"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class JinjaRenderer:
|
|
12
|
+
def __init__(self, environment: Environment) -> None:
|
|
13
|
+
self._environment = environment
|
|
14
|
+
|
|
15
|
+
@classmethod
|
|
16
|
+
def from_directory(cls, directory: str | Path, *, enable_async: bool = True) -> Self:
|
|
17
|
+
return cls(
|
|
18
|
+
# A Flask-oriented rule; HTML autoescaping is enabled right below.
|
|
19
|
+
Environment( # nosemgrep
|
|
20
|
+
loader=FileSystemLoader(directory),
|
|
21
|
+
autoescape=select_autoescape(("html", "htm", "xml")),
|
|
22
|
+
undefined=StrictUndefined,
|
|
23
|
+
enable_async=enable_async,
|
|
24
|
+
)
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
async def render(self, template: str, context: Mapping[str, object]) -> str:
|
|
28
|
+
# Loading reads the file system synchronously, even in async environments.
|
|
29
|
+
compiled = await asyncio.to_thread(self._environment.get_template, template)
|
|
30
|
+
if self._environment.is_async:
|
|
31
|
+
return await compiled.render_async(dict(context))
|
|
32
|
+
return await asyncio.to_thread(compiled.render, dict(context))
|
|
File without changes
|