jx 0.5.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.
jx-0.5.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Juan-Pablo Scaletti
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.
jx-0.5.1/PKG-INFO ADDED
@@ -0,0 +1,74 @@
1
+ Metadata-Version: 2.4
2
+ Name: jx
3
+ Version: 0.5.1
4
+ Summary: Replace your HTML templates with Python server-Side components
5
+ Author-email: Juan Pablo Scaletti <juanpablo@jpscaletti.com>
6
+ Project-URL: Code, https://github.com/jpsca/jx
7
+ Project-URL: Documentation, https://jx.scaletti.dev/
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Environment :: Web Environment
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3 :: Only
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
16
+ Classifier: Topic :: Software Development :: Libraries
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Classifier: Topic :: Software Development :: User Interfaces
19
+ Classifier: Topic :: Text Processing :: Markup :: HTML
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: <4,>=3.12
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: jinja2>=3.0
25
+ Dynamic: license-file
26
+
27
+ <div align="center">
28
+ <h1><img alt="Jx" src="https://raw.githubusercontent.com/jpsca/jx/main/docs/assets/images/logo-jx.png" height="100" align="top"></h1>
29
+ </div>
30
+ <p align="center">
31
+ <img alt="python: 3.12, 3.13, 3.14" src="https://raw.githubusercontent.com/jpsca/jx/main/docs/python.svg">
32
+ <img alt="license: MIT" src="https://raw.githubusercontent.com/jpsca/jx/main/docs/license.svg">
33
+ </p>
34
+
35
+ ### Python server-side components
36
+
37
+ From chaos to clarity: The power of components in your server-side-rendered Python web app.
38
+
39
+ <!-- Documentation: https://jx.scaletti.dev/ -->
40
+
41
+ ## How It Works
42
+
43
+ Jx is a Python library for creating reusable template components with Jinja2. It works by pre-parsing the template source and replacing TitleCased HTML tags with Jinja calls that render the component.
44
+
45
+ ### Component Definition
46
+
47
+ Components are defined as regular Jinja2 templates (.jinja files) with special metadata comments:
48
+
49
+ - `{# def parameter1 parameter2=default_value #}` - Defines required and optional parameters
50
+ - `{# import "path/to/component.jinja" as ComponentName #}` - Imports other components
51
+ - `{# css "/path/to/style.css" #}` - Includes CSS files
52
+ - `{# js "/path/to/script.js" #}` - Includes JavaScript files
53
+
54
+ Example component:
55
+
56
+ ```jinja
57
+ {# def message #}
58
+ {# import "button.jinja" as Button #}
59
+
60
+ <div class="greeting">{{ message }}</div>
61
+ <Button text="OK" />
62
+ ```
63
+
64
+ ### Usage Example
65
+
66
+ ```python
67
+ from jx import Catalog
68
+
69
+ # Create a catalog and add a components folder
70
+ catalog = Catalog("templates/components")
71
+
72
+ # Render a component with parameters
73
+ html = catalog.render("card.jinja", title="Hello", content="This is a card")
74
+ ```
jx-0.5.1/README.md ADDED
@@ -0,0 +1,48 @@
1
+ <div align="center">
2
+ <h1><img alt="Jx" src="https://raw.githubusercontent.com/jpsca/jx/main/docs/assets/images/logo-jx.png" height="100" align="top"></h1>
3
+ </div>
4
+ <p align="center">
5
+ <img alt="python: 3.12, 3.13, 3.14" src="https://raw.githubusercontent.com/jpsca/jx/main/docs/python.svg">
6
+ <img alt="license: MIT" src="https://raw.githubusercontent.com/jpsca/jx/main/docs/license.svg">
7
+ </p>
8
+
9
+ ### Python server-side components
10
+
11
+ From chaos to clarity: The power of components in your server-side-rendered Python web app.
12
+
13
+ <!-- Documentation: https://jx.scaletti.dev/ -->
14
+
15
+ ## How It Works
16
+
17
+ Jx is a Python library for creating reusable template components with Jinja2. It works by pre-parsing the template source and replacing TitleCased HTML tags with Jinja calls that render the component.
18
+
19
+ ### Component Definition
20
+
21
+ Components are defined as regular Jinja2 templates (.jinja files) with special metadata comments:
22
+
23
+ - `{# def parameter1 parameter2=default_value #}` - Defines required and optional parameters
24
+ - `{# import "path/to/component.jinja" as ComponentName #}` - Imports other components
25
+ - `{# css "/path/to/style.css" #}` - Includes CSS files
26
+ - `{# js "/path/to/script.js" #}` - Includes JavaScript files
27
+
28
+ Example component:
29
+
30
+ ```jinja
31
+ {# def message #}
32
+ {# import "button.jinja" as Button #}
33
+
34
+ <div class="greeting">{{ message }}</div>
35
+ <Button text="OK" />
36
+ ```
37
+
38
+ ### Usage Example
39
+
40
+ ```python
41
+ from jx import Catalog
42
+
43
+ # Create a catalog and add a components folder
44
+ catalog = Catalog("templates/components")
45
+
46
+ # Render a component with parameters
47
+ html = catalog.render("card.jinja", title="Hello", content="This is a card")
48
+ ```
@@ -0,0 +1,185 @@
1
+ [build-system]
2
+ requires = ["setuptools"]
3
+
4
+
5
+ [project]
6
+ name = "jx"
7
+ version = "0.5.1"
8
+ description = "Replace your HTML templates with Python server-Side components"
9
+ authors = [
10
+ {name = "Juan Pablo Scaletti", email = "juanpablo@jpscaletti.com"},
11
+ ]
12
+ license = { "file" = "MIT-LICENSE" }
13
+ readme = "README.md"
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Environment :: Web Environment",
17
+ "Intended Audience :: Developers",
18
+ "Programming Language :: Python :: 3 :: Only",
19
+ "Programming Language :: Python :: 3.11",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Programming Language :: Python :: 3.13",
22
+ "Topic :: Internet :: WWW/HTTP :: Dynamic Content",
23
+ "Topic :: Software Development :: Libraries",
24
+ "Topic :: Software Development :: Libraries :: Python Modules",
25
+ "Topic :: Software Development :: User Interfaces",
26
+ "Topic :: Text Processing :: Markup :: HTML",
27
+ "Typing :: Typed",
28
+ ]
29
+ requires-python = ">=3.12,<4"
30
+ dependencies = [
31
+ "jinja2 >= 3.0",
32
+ ]
33
+
34
+ [project.urls]
35
+ Code = "https://github.com/jpsca/jx"
36
+ Documentation = "https://jx.scaletti.dev/"
37
+
38
+ [dependency-groups]
39
+ dev = [
40
+ "ipdb",
41
+ "pre-commit",
42
+ "tox-uv",
43
+ "ty",
44
+ ]
45
+ docs = [
46
+ "writeadoc>=0.7.0",
47
+ ]
48
+ test = [
49
+ "pytest >= 7.2",
50
+ "pytest-cov",
51
+ "ruff > 0.3",
52
+ ]
53
+
54
+
55
+ [tool.setuptools.packages.find]
56
+ where = ["src"]
57
+
58
+
59
+ [tool.ty.src]
60
+ exclude = [
61
+ "docs",
62
+ ]
63
+
64
+
65
+ [tool.coverage.run]
66
+ branch = true
67
+
68
+ [tool.coverage.report]
69
+ exclude_lines = [
70
+ "pragma: no cover",
71
+ "TYPE_CHECKING",
72
+ "def __repr__",
73
+ "def __str__",
74
+ "raise AssertionError",
75
+ "raise NotImplementedError",
76
+ "if __name__ == .__main__.:"
77
+ ]
78
+
79
+ [tool.coverage.html]
80
+ directory = "covreport"
81
+
82
+
83
+ [tool.pytest.ini_options]
84
+ addopts = "--doctest-modules"
85
+
86
+
87
+ [tool.tox]
88
+ legacy_tox_ini = """
89
+ [tox]
90
+ env_list =
91
+ 3.12
92
+ 3.13
93
+ 3.14
94
+
95
+ [testenv]
96
+ runner = uv-venv-lock-runner
97
+ dependency_groups =
98
+ dev
99
+ test
100
+ commands =
101
+ pytest -x src/jx tests
102
+ """
103
+
104
+
105
+ [tool.ruff]
106
+ line-length = 90
107
+ indent-width = 4
108
+ target-version = "py312"
109
+ exclude = [
110
+ ".*",
111
+ "_build",
112
+ "build",
113
+ "covreport",
114
+ "dist",
115
+ "benchmark",
116
+ ]
117
+ include = ["*.py"]
118
+
119
+ [tool.ruff.format]
120
+ # Like Black, use double quotes for strings.
121
+ quote-style = "double"
122
+
123
+ # Like Black, indent with spaces, rather than tabs.
124
+ indent-style = "space"
125
+
126
+ # Like Black, respect magic trailing commas.
127
+ skip-magic-trailing-comma = false
128
+
129
+ # Like Black, automatically detect the appropriate line ending.
130
+ line-ending = "auto"
131
+
132
+ # Enable auto-formatting of code examples in docstrings. Markdown,
133
+ # reStructuredText code/literal blocks and doctests are all supported.
134
+ #
135
+ # This is currently disabled by default, but it is planned for this
136
+ # to be opt-out in the future.
137
+ docstring-code-format = false
138
+
139
+ # Set the line length limit used when formatting code snippets in
140
+ # docstrings.
141
+ #
142
+ # This only has an effect when the `docstring-code-format` setting is
143
+ # enabled.
144
+ docstring-code-line-length = "dynamic"
145
+
146
+ [tool.ruff.lint]
147
+ fixable = ["ALL"]
148
+
149
+ ignore = [
150
+ # x is too complex
151
+ "C901",
152
+ # whitespace before ':'
153
+ "E203",
154
+ "E501",
155
+ # x defined from star imports
156
+ "F405",
157
+ # line break before binary operator
158
+ "W505",
159
+ "W605",
160
+ ]
161
+ select = [
162
+ # bugbear
163
+ "B",
164
+ # mccabe"", comprehensions, commas
165
+ "C",
166
+ # pycodestyle errors
167
+ "E",
168
+ # pyflakes
169
+ "F",
170
+ # logging format
171
+ "G",
172
+ # imports
173
+ "I",
174
+ # quotes
175
+ "Q",
176
+ # pycodestyle warnings
177
+ "W",
178
+ ]
179
+
180
+ [tool.ruff.lint.isort]
181
+ known-first-party = ["jx"]
182
+ known-local-folder = ["src/jx"]
183
+
184
+ # Use two line after imports.
185
+ lines-after-imports = 2
jx-0.5.1/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,6 @@
1
+ """
2
+ Jx | Copyright (c) Juan-Pablo Scaletti
3
+ """
4
+
5
+ from .catalog import CData, Catalog # noqa
6
+ from .exceptions import * # noqa