xcomponent 0.12.2__tar.gz → 0.12.3__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.
- {xcomponent-0.12.2 → xcomponent-0.12.3}/CHANGELOG.md +4 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/Cargo.lock +1 -1
- {xcomponent-0.12.2 → xcomponent-0.12.3}/Cargo.toml +1 -1
- {xcomponent-0.12.2 → xcomponent-0.12.3}/PKG-INFO +1 -1
- {xcomponent-0.12.2 → xcomponent-0.12.3}/pyproject.toml +2 -1
- {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/context.rs +6 -6
- {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/expression/ast/eval.rs +1 -0
- xcomponent-0.12.3/tests/unittests/test_render_subtypes.py +32 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/uv.lock +3 -1
- {xcomponent-0.12.2 → xcomponent-0.12.3}/.github/workflows/build-sdist.yml +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/.github/workflows/build-wheels.yml +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/.github/workflows/publish-doc.yml +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/.github/workflows/publish-pypi.yml +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/.github/workflows/release.yml +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/.github/workflows/tests-artifacts.yml +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/.github/workflows/tests.yml +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/.gitignore +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/.python-version +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/Justfile +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/LICENSE +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/README.md +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/docs/Makefile +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/docs/source/conf.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/docs/source/develop/.gitkeep +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/docs/source/index.md +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/docs/source/user/changelog.md +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/docs/source/user/getting_started.md +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/scripts/get_version.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/scripts/write_changelog.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/src/python/xcomponent/__init__.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/src/python/xcomponent/adapters/__init__.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/src/python/xcomponent/adapters/babel.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/src/python/xcomponent/py.typed +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/src/python/xcomponent/service/__init__.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/src/python/xcomponent/service/catalog.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/src/python/xcomponent/xcore.pyi +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/catalog/catalog.rs +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/catalog/mod.rs +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/expression/ast/mod.rs +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/expression/ast/model.rs +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/expression/ast/parse.rs +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/expression/grammar.pest +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/expression/i18n.rs +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/expression/mod.rs +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/expression/parser.rs +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/expression/tokens.rs +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/lib.rs +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/markup/grammar.pest +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/markup/mod.rs +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/markup/parser.rs +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/markup/tokens.rs +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/__init__.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/functionals/__init__.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/functionals/i18n/__init__.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/functionals/i18n/babel.ini +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/functionals/i18n/fr.mo +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/functionals/i18n/fr.po +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/functionals/i18n/mydomain.pot +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/functionals/i18n/test_l10n.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/__init__.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/adapters/__init__.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/adapters/test_babel.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/conftest.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_binary_eq.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_binary_in.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_binary_op.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_binary_op_bool.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_default_values.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_field_access.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_for_expr.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_func.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_if_expr.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_let.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_match_expr.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_nested.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_render_comment.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_script.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_str_dedent.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_str_method.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_types.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_unary.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/test_core.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/test_import_namespace.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/test_named_component.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/test_render_attributes.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/test_render_context.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/test_render_globals.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/test_render_globals_obj.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/test_render_globals_obj2.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/test_render_nested_dict.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/test_render_nested_node.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/test_render_node.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/test_render_properties.py +0 -0
- {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/test_render_script.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "xcomponent"
|
|
3
|
-
version = "0.12.
|
|
3
|
+
version = "0.12.3"
|
|
4
4
|
description = "An embeded component base template engine - inspired by JSX"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [{ name = "Guillaume Gauvrit", email = "guillaume@gauvr.it" }]
|
|
@@ -45,6 +45,7 @@ dev = [
|
|
|
45
45
|
"bs4>=0.0.2",
|
|
46
46
|
"fastlifeweb >=0.37,<1",
|
|
47
47
|
"mypy >=1.16.0,<2",
|
|
48
|
+
"pydantic>=2.11.10,<3",
|
|
48
49
|
"pytest >=8.3.5,<9",
|
|
49
50
|
]
|
|
50
51
|
docs = [
|
|
@@ -110,12 +110,12 @@ pub enum Literal {
|
|
|
110
110
|
|
|
111
111
|
impl Literal {
|
|
112
112
|
pub fn downcast<'py>(py: Python<'py>, value: Bound<'py, PyAny>) -> Result<Self, PyErr> {
|
|
113
|
-
if
|
|
114
|
-
return Ok(Literal::Str(
|
|
115
|
-
} else if
|
|
116
|
-
return Ok(Literal::Bool(
|
|
117
|
-
} else if
|
|
118
|
-
return Ok(Literal::Int(
|
|
113
|
+
if value.cast::<PyAny>()?.get_type().name()? == "str" {
|
|
114
|
+
return Ok(Literal::Str(value.to_string()));
|
|
115
|
+
} else if value.cast::<PyAny>()?.get_type().name()? == "bool" {
|
|
116
|
+
return Ok(Literal::Bool(value.extract::<bool>()?));
|
|
117
|
+
} else if value.cast::<PyAny>()?.get_type().name()? == "int" {
|
|
118
|
+
return Ok(Literal::Int(value.extract::<isize>()?));
|
|
119
119
|
} else if let Ok(_) = value.cast::<PyNone>() {
|
|
120
120
|
return Ok(Literal::None(()));
|
|
121
121
|
} else if let Ok(v) = value.extract::<XNode>() {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from pydantic import BaseModel, ByteSize, Field
|
|
3
|
+
from xcomponent import Catalog, Component
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Storage(BaseModel):
|
|
7
|
+
name: str = Field()
|
|
8
|
+
size: ByteSize = Field(...)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@pytest.fixture()
|
|
12
|
+
def StoragePage(catalog: Catalog):
|
|
13
|
+
|
|
14
|
+
@catalog.component()
|
|
15
|
+
def StoragePage(storage: Storage) -> str:
|
|
16
|
+
return """
|
|
17
|
+
<dl>
|
|
18
|
+
<dt>name</dt>
|
|
19
|
+
<dd>{storage.name}</dd>
|
|
20
|
+
|
|
21
|
+
<dt>size</dt>
|
|
22
|
+
<dd>{storage.size.human_readable(separator=" ")}</dd>
|
|
23
|
+
</dl>
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
return StoragePage
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def test_catalog_render(StoragePage: Component):
|
|
30
|
+
assert StoragePage(Storage(name="disk", size=ByteSize(2**16))) == (
|
|
31
|
+
"<dl><dt>name</dt><dd>disk</dd><dt>size</dt><dd>64.0 KiB</dd></dl>"
|
|
32
|
+
)
|
|
@@ -1418,7 +1418,7 @@ wheels = [
|
|
|
1418
1418
|
|
|
1419
1419
|
[[package]]
|
|
1420
1420
|
name = "xcomponent"
|
|
1421
|
-
version = "0.12.
|
|
1421
|
+
version = "0.12.3"
|
|
1422
1422
|
source = { editable = "." }
|
|
1423
1423
|
|
|
1424
1424
|
[package.optional-dependencies]
|
|
@@ -1436,6 +1436,7 @@ dev = [
|
|
|
1436
1436
|
{ name = "bs4" },
|
|
1437
1437
|
{ name = "fastlifeweb" },
|
|
1438
1438
|
{ name = "mypy" },
|
|
1439
|
+
{ name = "pydantic" },
|
|
1439
1440
|
{ name = "pytest" },
|
|
1440
1441
|
]
|
|
1441
1442
|
docs = [
|
|
@@ -1462,6 +1463,7 @@ dev = [
|
|
|
1462
1463
|
{ name = "bs4", specifier = ">=0.0.2" },
|
|
1463
1464
|
{ name = "fastlifeweb", specifier = ">=0.37,<1" },
|
|
1464
1465
|
{ name = "mypy", specifier = ">=1.16.0,<2" },
|
|
1466
|
+
{ name = "pydantic", specifier = ">=2.11.10,<3" },
|
|
1465
1467
|
{ name = "pytest", specifier = ">=8.3.5,<9" },
|
|
1466
1468
|
]
|
|
1467
1469
|
docs = [
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|