fh-pydantic-form 0.3.5__tar.gz → 0.3.6__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.

Potentially problematic release.


This version of fh-pydantic-form might be problematic. Click here for more details.

Files changed (22) hide show
  1. {fh_pydantic_form-0.3.5 → fh_pydantic_form-0.3.6}/PKG-INFO +1 -1
  2. {fh_pydantic_form-0.3.5 → fh_pydantic_form-0.3.6}/RELEASE_NOTES.md +5 -0
  3. {fh_pydantic_form-0.3.5 → fh_pydantic_form-0.3.6}/pyproject.toml +1 -1
  4. {fh_pydantic_form-0.3.5 → fh_pydantic_form-0.3.6}/src/fh_pydantic_form/form_renderer.py +14 -2
  5. {fh_pydantic_form-0.3.5 → fh_pydantic_form-0.3.6}/.github/workflows/build.yaml +0 -0
  6. {fh_pydantic_form-0.3.5 → fh_pydantic_form-0.3.6}/.github/workflows/publish.yaml +0 -0
  7. {fh_pydantic_form-0.3.5 → fh_pydantic_form-0.3.6}/.gitignore +0 -0
  8. {fh_pydantic_form-0.3.5 → fh_pydantic_form-0.3.6}/.pre-commit-config.yaml +0 -0
  9. {fh_pydantic_form-0.3.5 → fh_pydantic_form-0.3.6}/LICENSE +0 -0
  10. {fh_pydantic_form-0.3.5 → fh_pydantic_form-0.3.6}/README.md +0 -0
  11. {fh_pydantic_form-0.3.5 → fh_pydantic_form-0.3.6}/src/fh_pydantic_form/__init__.py +0 -0
  12. {fh_pydantic_form-0.3.5 → fh_pydantic_form-0.3.6}/src/fh_pydantic_form/color_utils.py +0 -0
  13. {fh_pydantic_form-0.3.5 → fh_pydantic_form-0.3.6}/src/fh_pydantic_form/comparison_form.py +0 -0
  14. {fh_pydantic_form-0.3.5 → fh_pydantic_form-0.3.6}/src/fh_pydantic_form/constants.py +0 -0
  15. {fh_pydantic_form-0.3.5 → fh_pydantic_form-0.3.6}/src/fh_pydantic_form/defaults.py +0 -0
  16. {fh_pydantic_form-0.3.5 → fh_pydantic_form-0.3.6}/src/fh_pydantic_form/field_renderers.py +0 -0
  17. {fh_pydantic_form-0.3.5 → fh_pydantic_form-0.3.6}/src/fh_pydantic_form/form_parser.py +0 -0
  18. {fh_pydantic_form-0.3.5 → fh_pydantic_form-0.3.6}/src/fh_pydantic_form/list_path.py +0 -0
  19. {fh_pydantic_form-0.3.5 → fh_pydantic_form-0.3.6}/src/fh_pydantic_form/py.typed +0 -0
  20. {fh_pydantic_form-0.3.5 → fh_pydantic_form-0.3.6}/src/fh_pydantic_form/registry.py +0 -0
  21. {fh_pydantic_form-0.3.5 → fh_pydantic_form-0.3.6}/src/fh_pydantic_form/type_helpers.py +0 -0
  22. {fh_pydantic_form-0.3.5 → fh_pydantic_form-0.3.6}/src/fh_pydantic_form/ui_style.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fh-pydantic-form
3
- Version: 0.3.5
3
+ Version: 0.3.6
4
4
  Summary: a library to turn any pydantic BaseModel object into a fasthtml/monsterui input form
5
5
  Project-URL: Homepage, https://github.com/Marcura/fh-pydantic-form
6
6
  Project-URL: Repository, https://github.com/Marcura/fh-pydantic-form
@@ -1,5 +1,10 @@
1
1
  # Release Notes
2
2
 
3
+ ## Version 0.3.6 (2025-07-21)
4
+
5
+ - **NEW**: can now pass new metrics_dict to `.with_initial_values()` helper method.
6
+
7
+ ---
3
8
  ## Version 0.3.5 (2025-07-17)
4
9
 
5
10
  - **NEW**: Added support for `decimal.Decimal` fields with dedicated field renderer
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fh-pydantic-form"
3
- version = "0.3.5"
3
+ version = "0.3.6"
4
4
  description = "a library to turn any pydantic BaseModel object into a fasthtml/monsterui input form"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -349,6 +349,13 @@ class PydanticForm(Generic[ModelType]):
349
349
  for field_type, renderer_cls in custom_renderers:
350
350
  registry.register_type_renderer(field_type, renderer_cls)
351
351
 
352
+ @property
353
+ def form_name(self) -> str:
354
+ """
355
+ LLMs like to hallucinate this property, so might as well make it real.
356
+ """
357
+ return self.name
358
+
352
359
  def _compact_wrapper(self, inner: FT) -> FT:
353
360
  """
354
361
  Wrap inner markup in a wrapper div.
@@ -364,7 +371,9 @@ class PydanticForm(Generic[ModelType]):
364
371
  self.values_dict = self.initial_values_dict.copy()
365
372
 
366
373
  def with_initial_values(
367
- self, initial_values: Optional[Union[ModelType, Dict[str, Any]]] = None
374
+ self,
375
+ initial_values: Optional[Union[ModelType, Dict[str, Any]]] = None,
376
+ metrics_dict: Optional[Dict[str, Any]] = None,
368
377
  ) -> "PydanticForm":
369
378
  """
370
379
  Create a new PydanticForm instance with the same configuration but different initial values.
@@ -376,6 +385,7 @@ class PydanticForm(Generic[ModelType]):
376
385
  Args:
377
386
  initial_values: New initial values as BaseModel instance or dict.
378
387
  Same format as the constructor accepts.
388
+ metrics_dict: Optional metrics dictionary for field-level visual feedback
379
389
 
380
390
  Returns:
381
391
  A new PydanticForm instance with identical configuration but updated initial values
@@ -391,7 +401,9 @@ class PydanticForm(Generic[ModelType]):
391
401
  label_colors=self.label_colors,
392
402
  exclude_fields=self.exclude_fields,
393
403
  spacing=self.spacing,
394
- metrics_dict=self.metrics_dict,
404
+ metrics_dict=metrics_dict
405
+ if metrics_dict is not None
406
+ else self.metrics_dict,
395
407
  )
396
408
 
397
409
  return clone