validating 0.0.4__tar.gz → 0.0.5__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: validating
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: Provides a lightweight `attr()` descriptor factory that adds runtime validation to dataclass fields.
5
5
  Project-URL: Documentation, https://github.com/Chitaoji/validating/blob/main/README.md
6
6
  Project-URL: Repository, https://github.com/Chitaoji/validating/
@@ -181,6 +181,9 @@ class EvenNumber:
181
181
  This project falls under the BSD 3-Clause License.
182
182
 
183
183
  ## History
184
+ ### v0.0.5
185
+ * Added `typing.dataclass_transform` metadata to `validating.dataclass` (with `attr` and `dataclasses.Field` specifiers) to improve IDE/static-analysis support, including better Pylance hints.
186
+
184
187
  ### v0.0.4
185
188
  * Updated error messages when validating typed dicts.
186
189
 
@@ -165,6 +165,9 @@ class EvenNumber:
165
165
  This project falls under the BSD 3-Clause License.
166
166
 
167
167
  ## History
168
+ ### v0.0.5
169
+ * Added `typing.dataclass_transform` metadata to `validating.dataclass` (with `attr` and `dataclasses.Field` specifiers) to improve IDE/static-analysis support, including better Pylance hints.
170
+
168
171
  ### v0.0.4
169
172
  * Updated error messages when validating typed dicts.
170
173
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "validating"
7
- version = "0.0.4"
7
+ version = "0.0.5"
8
8
  dependencies = []
9
9
  requires-python = ">=3.13"
10
10
  authors = [
@@ -10,7 +10,7 @@ from dataclasses import Field
10
10
  from dataclasses import dataclass as _stdlib_dataclass
11
11
  from functools import partial
12
12
  from inspect import signature
13
- from typing import Any, Callable, overload
13
+ from typing import Any, Callable, dataclass_transform, overload
14
14
 
15
15
  from .valid_attr import AttrValidator, attr
16
16
  from .valid_func import validate
@@ -52,6 +52,7 @@ def dataclass[T](
52
52
  weakref_slot: bool = False,
53
53
  validate_methods: bool = False,
54
54
  ) -> Callable[[type[T]], type[T]]: ...
55
+ @dataclass_transform(field_specifiers=(attr, Field))
55
56
  def dataclass(
56
57
  cls: type | None = None,
57
58
  /,
@@ -22,6 +22,12 @@ from src.validating import (
22
22
 
23
23
 
24
24
  class TestAttrWithDataclasses(unittest.TestCase):
25
+ def test_validating_dataclass_exposes_dataclass_transform_metadata(self):
26
+ metadata = getattr(validating_dataclass, "__dataclass_transform__", None)
27
+ self.assertIsNotNone(metadata)
28
+ self.assertIn("field_specifiers", metadata)
29
+ self.assertIn(attr, metadata["field_specifiers"])
30
+
25
31
  def test_validating_dataclass_can_validate_public_methods(self):
26
32
  @validating_dataclass(validate_methods=True)
27
33
  class Config:
File without changes
File without changes
File without changes