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.
Files changed (94) hide show
  1. {xcomponent-0.12.2 → xcomponent-0.12.3}/CHANGELOG.md +4 -0
  2. {xcomponent-0.12.2 → xcomponent-0.12.3}/Cargo.lock +1 -1
  3. {xcomponent-0.12.2 → xcomponent-0.12.3}/Cargo.toml +1 -1
  4. {xcomponent-0.12.2 → xcomponent-0.12.3}/PKG-INFO +1 -1
  5. {xcomponent-0.12.2 → xcomponent-0.12.3}/pyproject.toml +2 -1
  6. {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/context.rs +6 -6
  7. {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/expression/ast/eval.rs +1 -0
  8. xcomponent-0.12.3/tests/unittests/test_render_subtypes.py +32 -0
  9. {xcomponent-0.12.2 → xcomponent-0.12.3}/uv.lock +3 -1
  10. {xcomponent-0.12.2 → xcomponent-0.12.3}/.github/workflows/build-sdist.yml +0 -0
  11. {xcomponent-0.12.2 → xcomponent-0.12.3}/.github/workflows/build-wheels.yml +0 -0
  12. {xcomponent-0.12.2 → xcomponent-0.12.3}/.github/workflows/publish-doc.yml +0 -0
  13. {xcomponent-0.12.2 → xcomponent-0.12.3}/.github/workflows/publish-pypi.yml +0 -0
  14. {xcomponent-0.12.2 → xcomponent-0.12.3}/.github/workflows/release.yml +0 -0
  15. {xcomponent-0.12.2 → xcomponent-0.12.3}/.github/workflows/tests-artifacts.yml +0 -0
  16. {xcomponent-0.12.2 → xcomponent-0.12.3}/.github/workflows/tests.yml +0 -0
  17. {xcomponent-0.12.2 → xcomponent-0.12.3}/.gitignore +0 -0
  18. {xcomponent-0.12.2 → xcomponent-0.12.3}/.python-version +0 -0
  19. {xcomponent-0.12.2 → xcomponent-0.12.3}/Justfile +0 -0
  20. {xcomponent-0.12.2 → xcomponent-0.12.3}/LICENSE +0 -0
  21. {xcomponent-0.12.2 → xcomponent-0.12.3}/README.md +0 -0
  22. {xcomponent-0.12.2 → xcomponent-0.12.3}/docs/Makefile +0 -0
  23. {xcomponent-0.12.2 → xcomponent-0.12.3}/docs/source/conf.py +0 -0
  24. {xcomponent-0.12.2 → xcomponent-0.12.3}/docs/source/develop/.gitkeep +0 -0
  25. {xcomponent-0.12.2 → xcomponent-0.12.3}/docs/source/index.md +0 -0
  26. {xcomponent-0.12.2 → xcomponent-0.12.3}/docs/source/user/changelog.md +0 -0
  27. {xcomponent-0.12.2 → xcomponent-0.12.3}/docs/source/user/getting_started.md +0 -0
  28. {xcomponent-0.12.2 → xcomponent-0.12.3}/scripts/get_version.py +0 -0
  29. {xcomponent-0.12.2 → xcomponent-0.12.3}/scripts/write_changelog.py +0 -0
  30. {xcomponent-0.12.2 → xcomponent-0.12.3}/src/python/xcomponent/__init__.py +0 -0
  31. {xcomponent-0.12.2 → xcomponent-0.12.3}/src/python/xcomponent/adapters/__init__.py +0 -0
  32. {xcomponent-0.12.2 → xcomponent-0.12.3}/src/python/xcomponent/adapters/babel.py +0 -0
  33. {xcomponent-0.12.2 → xcomponent-0.12.3}/src/python/xcomponent/py.typed +0 -0
  34. {xcomponent-0.12.2 → xcomponent-0.12.3}/src/python/xcomponent/service/__init__.py +0 -0
  35. {xcomponent-0.12.2 → xcomponent-0.12.3}/src/python/xcomponent/service/catalog.py +0 -0
  36. {xcomponent-0.12.2 → xcomponent-0.12.3}/src/python/xcomponent/xcore.pyi +0 -0
  37. {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/catalog/catalog.rs +0 -0
  38. {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/catalog/mod.rs +0 -0
  39. {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/expression/ast/mod.rs +0 -0
  40. {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/expression/ast/model.rs +0 -0
  41. {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/expression/ast/parse.rs +0 -0
  42. {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/expression/grammar.pest +0 -0
  43. {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/expression/i18n.rs +0 -0
  44. {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/expression/mod.rs +0 -0
  45. {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/expression/parser.rs +0 -0
  46. {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/expression/tokens.rs +0 -0
  47. {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/lib.rs +0 -0
  48. {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/markup/grammar.pest +0 -0
  49. {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/markup/mod.rs +0 -0
  50. {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/markup/parser.rs +0 -0
  51. {xcomponent-0.12.2 → xcomponent-0.12.3}/src/rust/markup/tokens.rs +0 -0
  52. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/__init__.py +0 -0
  53. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/functionals/__init__.py +0 -0
  54. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/functionals/i18n/__init__.py +0 -0
  55. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/functionals/i18n/babel.ini +0 -0
  56. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/functionals/i18n/fr.mo +0 -0
  57. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/functionals/i18n/fr.po +0 -0
  58. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/functionals/i18n/mydomain.pot +0 -0
  59. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/functionals/i18n/test_l10n.py +0 -0
  60. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/__init__.py +0 -0
  61. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/adapters/__init__.py +0 -0
  62. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/adapters/test_babel.py +0 -0
  63. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/conftest.py +0 -0
  64. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_binary_eq.py +0 -0
  65. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_binary_in.py +0 -0
  66. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_binary_op.py +0 -0
  67. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_binary_op_bool.py +0 -0
  68. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_default_values.py +0 -0
  69. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_field_access.py +0 -0
  70. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_for_expr.py +0 -0
  71. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_func.py +0 -0
  72. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_if_expr.py +0 -0
  73. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_let.py +0 -0
  74. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_match_expr.py +0 -0
  75. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_nested.py +0 -0
  76. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_render_comment.py +0 -0
  77. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_script.py +0 -0
  78. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_str_dedent.py +0 -0
  79. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_str_method.py +0 -0
  80. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_types.py +0 -0
  81. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/expression/test_unary.py +0 -0
  82. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/test_core.py +0 -0
  83. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/test_import_namespace.py +0 -0
  84. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/test_named_component.py +0 -0
  85. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/test_render_attributes.py +0 -0
  86. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/test_render_context.py +0 -0
  87. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/test_render_globals.py +0 -0
  88. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/test_render_globals_obj.py +0 -0
  89. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/test_render_globals_obj2.py +0 -0
  90. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/test_render_nested_dict.py +0 -0
  91. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/test_render_nested_node.py +0 -0
  92. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/test_render_node.py +0 -0
  93. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/test_render_properties.py +0 -0
  94. {xcomponent-0.12.2 → xcomponent-0.12.3}/tests/unittests/test_render_script.py +0 -0
@@ -1,3 +1,7 @@
1
+ ## 0.12.3 - 2026-12-05
2
+
3
+ * Hotfix rendering of python simple types subtypes such as ByteSize from pydantic.
4
+
1
5
  ## 0.12.2 - 2026-12-05
2
6
 
3
7
  * Introduce a `match` keyword for pattern matching inside templates.
@@ -568,7 +568,7 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
568
568
 
569
569
  [[package]]
570
570
  name = "xcore"
571
- version = "0.12.2"
571
+ version = "0.12.3"
572
572
  dependencies = [
573
573
  "env_logger",
574
574
  "html-escape",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "xcore"
3
- version = "0.12.2"
3
+ version = "0.12.3"
4
4
  authors = ["Guillaume Gauvrit <guillaume@gauvr.it>"]
5
5
  edition = "2024"
6
6
  description = "JSX-like for python using maturin/pyo3 and pest."
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xcomponent
3
- Version: 0.12.2
3
+ Version: 0.12.3
4
4
  Classifier: Intended Audience :: Developers
5
5
  Classifier: License :: OSI Approved :: MIT License
6
6
  Classifier: Programming Language :: Python :: 3
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "xcomponent"
3
- version = "0.12.2"
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 let Ok(v) = value.cast::<PyString>() {
114
- return Ok(Literal::Str(v.to_string()));
115
- } else if let Ok(v) = value.cast::<PyBool>() {
116
- return Ok(Literal::Bool(v.extract::<bool>()?));
117
- } else if let Ok(v) = value.cast::<PyInt>() {
118
- return Ok(Literal::Int(v.extract::<isize>()?));
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>() {
@@ -357,6 +357,7 @@ pub fn eval_ast<'py>(
357
357
  Literal::Object(o) => {
358
358
  // only string here. maybe callable
359
359
  let item = o.obj().getattr(py, field)?.into_bound(py);
360
+
360
361
  Literal::downcast(py, item)
361
362
  }
362
363
  _ => {
@@ -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="&nbsp;")}</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&nbsp;KiB</dd></dl>"
32
+ )
@@ -1418,7 +1418,7 @@ wheels = [
1418
1418
 
1419
1419
  [[package]]
1420
1420
  name = "xcomponent"
1421
- version = "0.12.2"
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