makejinja 2.6.2__tar.gz → 2.7.1__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.
- {makejinja-2.6.2 → makejinja-2.7.1}/PKG-INFO +17 -16
- {makejinja-2.6.2 → makejinja-2.7.1}/pyproject.toml +32 -29
- makejinja-2.7.1/setup.cfg +4 -0
- makejinja-2.7.1/src/makejinja.egg-info/PKG-INFO +113 -0
- makejinja-2.7.1/src/makejinja.egg-info/SOURCES.txt +17 -0
- makejinja-2.7.1/src/makejinja.egg-info/dependency_links.txt +1 -0
- makejinja-2.7.1/src/makejinja.egg-info/entry_points.txt +2 -0
- makejinja-2.7.1/src/makejinja.egg-info/requires.txt +5 -0
- makejinja-2.7.1/src/makejinja.egg-info/top_level.txt +1 -0
- makejinja-2.7.1/tests/test_makejinja.py +66 -0
- {makejinja-2.6.2 → makejinja-2.7.1}/LICENSE +0 -0
- {makejinja-2.6.2 → makejinja-2.7.1}/README.md +0 -0
- {makejinja-2.6.2 → makejinja-2.7.1/src}/makejinja/__init__.py +0 -0
- {makejinja-2.6.2 → makejinja-2.7.1/src}/makejinja/__main__.py +0 -0
- {makejinja-2.6.2 → makejinja-2.7.1/src}/makejinja/app.py +0 -0
- {makejinja-2.6.2 → makejinja-2.7.1/src}/makejinja/cli.py +0 -0
- {makejinja-2.6.2 → makejinja-2.7.1/src}/makejinja/config.py +0 -0
- {makejinja-2.6.2 → makejinja-2.7.1/src}/makejinja/plugin.py +0 -0
- {makejinja-2.6.2 → makejinja-2.7.1/src}/makejinja/py.typed +0 -0
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: makejinja
|
|
3
|
-
Version: 2.
|
|
4
|
-
Summary: Generate entire directory structures using Jinja templates with support for external data and custom plugins
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
Version: 2.7.1
|
|
4
|
+
Summary: Generate entire directory structures using Jinja templates with support for external data and custom plugins
|
|
5
|
+
Author-email: Mirko Lenz <mirko@mirkolenz.com>
|
|
6
|
+
Project-URL: Repository, https://github.com/mirkolenz/makejinja
|
|
7
|
+
Project-URL: Homepage, https://mirkolenz.github.io/makejinja/
|
|
8
|
+
Project-URL: Documentation, https://mirkolenz.github.io/makejinja/makejinja/cli.html
|
|
9
|
+
Project-URL: Issues, https://github.com/mirkolenz/makejinja/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/mirkolenz/makejinja/releases
|
|
7
11
|
Keywords: jinja2,home-assistant,hassio,dashboard,lovelace,template,generator,cli,tool,library
|
|
8
|
-
Author: Mirko Lenz
|
|
9
|
-
Author-email: mirko@mirkolenz.com
|
|
10
|
-
Requires-Python: >=3.11,<4.0
|
|
11
12
|
Classifier: Development Status :: 5 - Production/Stable
|
|
12
13
|
Classifier: Environment :: Console
|
|
13
14
|
Classifier: Framework :: Pytest
|
|
@@ -17,9 +18,10 @@ Classifier: Intended Audience :: System Administrators
|
|
|
17
18
|
Classifier: License :: OSI Approved :: MIT License
|
|
18
19
|
Classifier: Natural Language :: English
|
|
19
20
|
Classifier: Operating System :: OS Independent
|
|
20
|
-
Classifier: Programming Language :: Python :: 3
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.11
|
|
22
22
|
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Programming Language :: Python :: 3
|
|
23
25
|
Classifier: Topic :: File Formats
|
|
24
26
|
Classifier: Topic :: Home Automation
|
|
25
27
|
Classifier: Topic :: Software Development :: Code Generators
|
|
@@ -29,14 +31,14 @@ Classifier: Topic :: System :: Systems Administration
|
|
|
29
31
|
Classifier: Topic :: Text Processing :: Markup
|
|
30
32
|
Classifier: Topic :: Utilities
|
|
31
33
|
Classifier: Typing :: Typed
|
|
32
|
-
Requires-
|
|
33
|
-
Requires-Dist: jinja2 (>=3.1,<4.0)
|
|
34
|
-
Requires-Dist: pyyaml (>=6.0,<7.0)
|
|
35
|
-
Requires-Dist: rich-click (>=1.7,<2.0)
|
|
36
|
-
Requires-Dist: typed-settings[attrs,cattrs,click] (>=23.1,<25)
|
|
37
|
-
Project-URL: Documentation, https://mirkolenz.github.io/makejinja/makejinja/cli.html
|
|
38
|
-
Project-URL: Repository, https://github.com/mirkolenz/makejinja
|
|
34
|
+
Requires-Python: >=3.11
|
|
39
35
|
Description-Content-Type: text/markdown
|
|
36
|
+
License-File: LICENSE
|
|
37
|
+
Requires-Dist: jinja2<4,>=3
|
|
38
|
+
Requires-Dist: pyyaml<7,>=6
|
|
39
|
+
Requires-Dist: rich-click<2,>=1
|
|
40
|
+
Requires-Dist: typed-settings[attrs,cattrs,click]<25,>=23
|
|
41
|
+
Requires-Dist: immutables<1,>=0.20
|
|
40
42
|
|
|
41
43
|
<!-- markdownlint-disable MD033 MD041 -->
|
|
42
44
|
<h2><p align="center">makejinja</p></h2>
|
|
@@ -109,4 +111,3 @@ docker run --rm -v $(pwd)/data:/data ghcr.io/mirkolenz/makejinja:latest -i /data
|
|
|
109
111
|
In its default configuration, makejinja searches the input directory recursively for files ending in `.jinja`.
|
|
110
112
|
It then renders these files and writes them to the output directory, preserving the directory structure.
|
|
111
113
|
Our [documentation](https://mirkolenz.github.io/makejinja/makejinja/cli.html) contains a detailed description of all options and can also be accessed via `makejinja --help`.
|
|
112
|
-
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
[
|
|
1
|
+
[project]
|
|
2
2
|
name = "makejinja"
|
|
3
|
-
version = "2.
|
|
4
|
-
description = "Generate entire directory structures using Jinja templates with support for external data and custom plugins
|
|
5
|
-
authors = ["Mirko Lenz
|
|
6
|
-
license = "MIT"
|
|
3
|
+
version = "2.7.1"
|
|
4
|
+
description = "Generate entire directory structures using Jinja templates with support for external data and custom plugins"
|
|
5
|
+
authors = [{ name = "Mirko Lenz", email = "mirko@mirkolenz.com" }]
|
|
7
6
|
readme = "README.md"
|
|
8
|
-
repository = "https://github.com/mirkolenz/makejinja"
|
|
9
|
-
homepage = "https://mirkolenz.github.io/makejinja/"
|
|
10
|
-
documentation = "https://mirkolenz.github.io/makejinja/makejinja/cli.html"
|
|
11
7
|
keywords = [
|
|
12
8
|
"jinja2",
|
|
13
9
|
"home-assistant",
|
|
@@ -30,6 +26,10 @@ classifiers = [
|
|
|
30
26
|
"License :: OSI Approved :: MIT License",
|
|
31
27
|
"Natural Language :: English",
|
|
32
28
|
"Operating System :: OS Independent",
|
|
29
|
+
"Programming Language :: Python :: 3.11",
|
|
30
|
+
"Programming Language :: Python :: 3.12",
|
|
31
|
+
"Programming Language :: Python :: 3.13",
|
|
32
|
+
"Programming Language :: Python :: 3",
|
|
33
33
|
"Topic :: File Formats",
|
|
34
34
|
"Topic :: Home Automation",
|
|
35
35
|
"Topic :: Software Development :: Code Generators",
|
|
@@ -40,28 +40,35 @@ classifiers = [
|
|
|
40
40
|
"Topic :: Utilities",
|
|
41
41
|
"Typing :: Typed",
|
|
42
42
|
]
|
|
43
|
+
requires-python = ">=3.11"
|
|
44
|
+
dependencies = [
|
|
45
|
+
"jinja2>=3,<4",
|
|
46
|
+
"pyyaml>=6,<7",
|
|
47
|
+
"rich-click>=1,<2",
|
|
48
|
+
"typed-settings[attrs,cattrs,click]>=23,<25",
|
|
49
|
+
"immutables>=0.20,<1",
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
[project.urls]
|
|
53
|
+
Repository = "https://github.com/mirkolenz/makejinja"
|
|
54
|
+
Homepage = "https://mirkolenz.github.io/makejinja/"
|
|
55
|
+
Documentation = "https://mirkolenz.github.io/makejinja/makejinja/cli.html"
|
|
56
|
+
Issues = "https://github.com/mirkolenz/makejinja/issues"
|
|
57
|
+
Changelog = "https://github.com/mirkolenz/makejinja/releases"
|
|
43
58
|
|
|
44
|
-
[
|
|
59
|
+
[project.scripts]
|
|
45
60
|
makejinja = "makejinja.cli:makejinja_cli"
|
|
46
61
|
|
|
47
|
-
[
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
pyyaml = "^6.0"
|
|
51
|
-
rich-click = "^1.7"
|
|
52
|
-
typed-settings = { version = ">=23.1, <25", extras = [
|
|
53
|
-
"attrs",
|
|
54
|
-
"cattrs",
|
|
55
|
-
"click",
|
|
56
|
-
] }
|
|
57
|
-
immutables = "^0.20"
|
|
62
|
+
[dependency-groups]
|
|
63
|
+
test = ["pytest>=8,<9", "pytest-cov>=6,<7"]
|
|
64
|
+
docs = ["pdoc>=15,<16"]
|
|
58
65
|
|
|
59
|
-
[
|
|
60
|
-
|
|
61
|
-
|
|
66
|
+
[build-system]
|
|
67
|
+
requires = ["setuptools>=61"]
|
|
68
|
+
build-backend = "setuptools.build_meta"
|
|
62
69
|
|
|
63
|
-
[tool.
|
|
64
|
-
|
|
70
|
+
[tool.uv]
|
|
71
|
+
default-groups = ["test", "docs"]
|
|
65
72
|
|
|
66
73
|
[tool.pytest.ini_options]
|
|
67
74
|
addopts = "--cov makejinja --cov-report term-missing"
|
|
@@ -73,7 +80,3 @@ ignore = ["E501"]
|
|
|
73
80
|
|
|
74
81
|
[tool.ruff.pydocstyle]
|
|
75
82
|
convention = "google"
|
|
76
|
-
|
|
77
|
-
[build-system]
|
|
78
|
-
requires = ["poetry-core"]
|
|
79
|
-
build-backend = "poetry.core.masonry.api"
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: makejinja
|
|
3
|
+
Version: 2.7.1
|
|
4
|
+
Summary: Generate entire directory structures using Jinja templates with support for external data and custom plugins
|
|
5
|
+
Author-email: Mirko Lenz <mirko@mirkolenz.com>
|
|
6
|
+
Project-URL: Repository, https://github.com/mirkolenz/makejinja
|
|
7
|
+
Project-URL: Homepage, https://mirkolenz.github.io/makejinja/
|
|
8
|
+
Project-URL: Documentation, https://mirkolenz.github.io/makejinja/makejinja/cli.html
|
|
9
|
+
Project-URL: Issues, https://github.com/mirkolenz/makejinja/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/mirkolenz/makejinja/releases
|
|
11
|
+
Keywords: jinja2,home-assistant,hassio,dashboard,lovelace,template,generator,cli,tool,library
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Framework :: Pytest
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
17
|
+
Classifier: Intended Audience :: System Administrators
|
|
18
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
19
|
+
Classifier: Natural Language :: English
|
|
20
|
+
Classifier: Operating System :: OS Independent
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Programming Language :: Python :: 3
|
|
25
|
+
Classifier: Topic :: File Formats
|
|
26
|
+
Classifier: Topic :: Home Automation
|
|
27
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
28
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
29
|
+
Classifier: Topic :: System :: Software Distribution
|
|
30
|
+
Classifier: Topic :: System :: Systems Administration
|
|
31
|
+
Classifier: Topic :: Text Processing :: Markup
|
|
32
|
+
Classifier: Topic :: Utilities
|
|
33
|
+
Classifier: Typing :: Typed
|
|
34
|
+
Requires-Python: >=3.11
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
36
|
+
License-File: LICENSE
|
|
37
|
+
Requires-Dist: jinja2<4,>=3
|
|
38
|
+
Requires-Dist: pyyaml<7,>=6
|
|
39
|
+
Requires-Dist: rich-click<2,>=1
|
|
40
|
+
Requires-Dist: typed-settings[attrs,cattrs,click]<25,>=23
|
|
41
|
+
Requires-Dist: immutables<1,>=0.20
|
|
42
|
+
|
|
43
|
+
<!-- markdownlint-disable MD033 MD041 -->
|
|
44
|
+
<h2><p align="center">makejinja</p></h2>
|
|
45
|
+
<p align="center">
|
|
46
|
+
<img width="256px" alt="makejinja logo" src="https://raw.githubusercontent.com/mirkolenz/makejinja/main/assets/logo.png" />
|
|
47
|
+
</p>
|
|
48
|
+
<p align="center">
|
|
49
|
+
<a href="https://pypi.org/project/makejinja/">PyPI</a> |
|
|
50
|
+
<a href="https://github.com/users/mirkolenz/packages/container/package/makejinja">Docker</a> |
|
|
51
|
+
<a href="https://mirkolenz.github.io/makejinja">Docs</a> |
|
|
52
|
+
<a href="https://github.com/mirkolenz/makejinja/tree/main/tests/data">Example</a> |
|
|
53
|
+
<a href="https://jinja.palletsprojects.com/en/3.1.x/templates">Jinja reference</a>
|
|
54
|
+
</p>
|
|
55
|
+
<p align="center">
|
|
56
|
+
Generate entire directory structures using Jinja templates with support for external data and custom plugins.
|
|
57
|
+
</p>
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
# makejinja
|
|
62
|
+
|
|
63
|
+
makejinja can be used to automatically generate files from [Jinja templates](https://jinja.palletsprojects.com/en/3.1.x/templates).
|
|
64
|
+
It is conceptually similar to [Ansible templates](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/template_module.html) since both are built on top of Jinja.
|
|
65
|
+
However, makejinja is a standalone tool that can be used without Ansible and offers some advanced features like custom plugins.
|
|
66
|
+
A use case for this tool is generating config files for [Home Assistant](https://www.home-assistant.io/):
|
|
67
|
+
Using the same language that the built-in templates use, you can greatly simplify your configuration.
|
|
68
|
+
An [example for Home Assistant](https://github.com/mirkolenz/makejinja/tree/main/tests/data) can be found in the tests directory.
|
|
69
|
+
|
|
70
|
+
## Highlights
|
|
71
|
+
|
|
72
|
+
- Recursively render nested directories containing template files to a common output directory.
|
|
73
|
+
- Load data files containing variables to use in your Jinja templates from YAML, TOML, and Python files.
|
|
74
|
+
- Write custom [plugins](https://mirkolenz.github.io/makejinja/makejinja/plugin.html#Plugin) to extend the functionality of makejinja.
|
|
75
|
+
- Adjust all Jinja options (e.g., whitespace behavior and delimiters) to your needs via CLI flags or a config file.
|
|
76
|
+
|
|
77
|
+
## Installation
|
|
78
|
+
|
|
79
|
+
The tool is written in Python and can be installed via pip, nix, and docker.
|
|
80
|
+
It can be used as a CLI tool or as a Python library.
|
|
81
|
+
|
|
82
|
+
### PIP
|
|
83
|
+
|
|
84
|
+
makejinja is available on [PyPI](https://pypi.org/project/makejinja/) and can be installed via `pip`:
|
|
85
|
+
|
|
86
|
+
```shell
|
|
87
|
+
pip install makejinja
|
|
88
|
+
makejinja -i ./input -o ./output
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Nix
|
|
92
|
+
|
|
93
|
+
If you use the `nix` package manager, you can add this repository as an input to your flake and use `makejinja.packages.${system}.default` or apply the overlay `makejinja.overlays.default`.
|
|
94
|
+
You can also run it directly as follows:
|
|
95
|
+
|
|
96
|
+
```shell
|
|
97
|
+
nix run github:mirkolenz/makejinja -- -i ./input -o ./output
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Docker
|
|
101
|
+
|
|
102
|
+
We automatically publish an image to the [GitHub Container Registry](https://ghcr.io/mirkolenz/makejinja).
|
|
103
|
+
To use it, mount a directory to the container and pass the options as the command:
|
|
104
|
+
|
|
105
|
+
```shell
|
|
106
|
+
docker run --rm -v $(pwd)/data:/data ghcr.io/mirkolenz/makejinja:latest -i /data/input -o /data/output
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Usage in Terminal / Command Line
|
|
110
|
+
|
|
111
|
+
In its default configuration, makejinja searches the input directory recursively for files ending in `.jinja`.
|
|
112
|
+
It then renders these files and writes them to the output directory, preserving the directory structure.
|
|
113
|
+
Our [documentation](https://mirkolenz.github.io/makejinja/makejinja/cli.html) contains a detailed description of all options and can also be accessed via `makejinja --help`.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/makejinja/__init__.py
|
|
5
|
+
src/makejinja/__main__.py
|
|
6
|
+
src/makejinja/app.py
|
|
7
|
+
src/makejinja/cli.py
|
|
8
|
+
src/makejinja/config.py
|
|
9
|
+
src/makejinja/plugin.py
|
|
10
|
+
src/makejinja/py.typed
|
|
11
|
+
src/makejinja.egg-info/PKG-INFO
|
|
12
|
+
src/makejinja.egg-info/SOURCES.txt
|
|
13
|
+
src/makejinja.egg-info/dependency_links.txt
|
|
14
|
+
src/makejinja.egg-info/entry_points.txt
|
|
15
|
+
src/makejinja.egg-info/requires.txt
|
|
16
|
+
src/makejinja.egg-info/top_level.txt
|
|
17
|
+
tests/test_makejinja.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
makejinja
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
import pytest
|
|
5
|
+
from click.testing import CliRunner
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass
|
|
9
|
+
class Paths:
|
|
10
|
+
input: Path
|
|
11
|
+
baseline: Path
|
|
12
|
+
output: Path
|
|
13
|
+
|
|
14
|
+
def __repr__(self) -> str:
|
|
15
|
+
return "makejinja"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@pytest.fixture(scope="session")
|
|
19
|
+
def exec(tmp_path_factory: pytest.TempPathFactory) -> Paths:
|
|
20
|
+
assert __package__ is not None
|
|
21
|
+
data_path = Path(__package__, "data")
|
|
22
|
+
input_path = data_path / "input"
|
|
23
|
+
baseline_path = data_path / "output"
|
|
24
|
+
output_path = tmp_path_factory.mktemp("data")
|
|
25
|
+
|
|
26
|
+
with pytest.MonkeyPatch.context() as m:
|
|
27
|
+
m.chdir(data_path)
|
|
28
|
+
runner = CliRunner()
|
|
29
|
+
|
|
30
|
+
# Need to import it AFTER chdir
|
|
31
|
+
from makejinja.cli import makejinja_cli
|
|
32
|
+
|
|
33
|
+
runner.invoke(
|
|
34
|
+
makejinja_cli,
|
|
35
|
+
[
|
|
36
|
+
# Override it here to use our tmp_path
|
|
37
|
+
"--output",
|
|
38
|
+
str(output_path),
|
|
39
|
+
],
|
|
40
|
+
catch_exceptions=False,
|
|
41
|
+
color=True,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
return Paths(input_path, baseline_path, output_path)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def _dir_content(path: Path) -> set[Path]:
|
|
48
|
+
return {item.relative_to(path) for item in path.rglob("*")}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def test_dir_content(exec: Paths):
|
|
52
|
+
assert _dir_content(exec.baseline) == _dir_content(exec.output)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def test_file_content(exec: Paths):
|
|
56
|
+
paths = _dir_content(exec.baseline)
|
|
57
|
+
|
|
58
|
+
for item in paths:
|
|
59
|
+
baseline_path = exec.baseline / item
|
|
60
|
+
output_path = exec.output / item
|
|
61
|
+
|
|
62
|
+
if baseline_path.is_file() and output_path.is_file():
|
|
63
|
+
baseline = baseline_path.read_text()
|
|
64
|
+
output = output_path.read_text()
|
|
65
|
+
|
|
66
|
+
assert baseline.strip() == output.strip(), str(item)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|