params-proto 3.0.0rc25__py3-none-any.whl → 3.0.0rc26__py3-none-any.whl
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.
- params_proto/proto.py +24 -0
- {params_proto-3.0.0rc25.dist-info → params_proto-3.0.0rc26.dist-info}/METADATA +2 -2
- {params_proto-3.0.0rc25.dist-info → params_proto-3.0.0rc26.dist-info}/RECORD +5 -5
- {params_proto-3.0.0rc25.dist-info → params_proto-3.0.0rc26.dist-info}/WHEEL +0 -0
- {params_proto-3.0.0rc25.dist-info → params_proto-3.0.0rc26.dist-info}/licenses/LICENSE.md +0 -0
params_proto/proto.py
CHANGED
|
@@ -755,6 +755,30 @@ def proto(
|
|
|
755
755
|
klass_annotations = getattr(klass, "__annotations__", {})
|
|
756
756
|
annotations.update(klass_annotations)
|
|
757
757
|
|
|
758
|
+
# Infer types for untyped class attributes from their default values
|
|
759
|
+
# This allows `untyped_attr = "hello"` to be treated as `untyped_attr: str = "hello"`
|
|
760
|
+
# For None defaults, use Any since NoneType isn't useful as a type hint
|
|
761
|
+
from typing import Any
|
|
762
|
+
|
|
763
|
+
for klass in reversed(obj.__mro__):
|
|
764
|
+
if klass is object:
|
|
765
|
+
continue
|
|
766
|
+
for name, value in vars(klass).items():
|
|
767
|
+
# Skip if already annotated, private/dunder, or is a method/descriptor
|
|
768
|
+
if name in annotations:
|
|
769
|
+
continue
|
|
770
|
+
if name.startswith("_"):
|
|
771
|
+
continue
|
|
772
|
+
if callable(value) and not (hasattr(value, "__class__") and value.__class__.__name__ == "_EnvVar"):
|
|
773
|
+
continue
|
|
774
|
+
if isinstance(value, (classmethod, staticmethod, property)):
|
|
775
|
+
continue
|
|
776
|
+
# Infer type from the default value, use Any for None
|
|
777
|
+
if value is None:
|
|
778
|
+
annotations[name] = Any
|
|
779
|
+
else:
|
|
780
|
+
annotations[name] = type(value)
|
|
781
|
+
|
|
758
782
|
for name in annotations.keys():
|
|
759
783
|
if hasattr(obj, name):
|
|
760
784
|
value = getattr(obj, name)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: params-proto
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.0rc26
|
|
4
4
|
Summary: Modern Hyper Parameter Management for Machine Learning
|
|
5
5
|
Project-URL: Homepage, https://github.com/geyang/params-proto
|
|
6
6
|
Project-URL: Documentation, https://params-proto.readthedocs.io
|
|
@@ -119,7 +119,7 @@ uv run python scratch/demo_v3.py 42
|
|
|
119
119
|
## Installation
|
|
120
120
|
|
|
121
121
|
```bash
|
|
122
|
-
pip install params-proto==3.0.0-
|
|
122
|
+
pip install params-proto==3.0.0-rc25
|
|
123
123
|
```
|
|
124
124
|
|
|
125
125
|
## Key Features
|
|
@@ -3,7 +3,7 @@ params_proto/app.py,sha256=UySpd1op3M44Szk6Ekyn0fJcnZsQvMTMPdaEybwWsLE,19
|
|
|
3
3
|
params_proto/documentation.py,sha256=mIqmcwGWo8tM1BuNzLIwVTzdbQ3qyPus7yWTaOce4dM,8091
|
|
4
4
|
params_proto/envvar.py,sha256=Gui4AJGPiBSDSyIC3KjmXGmewFmgihAF0QEOm-ufFVo,4323
|
|
5
5
|
params_proto/parse_env_template.py,sha256=mXTvKpNhT2jGr3HpwKw42shd18O0QACmSJn6yWMDdKA,1298
|
|
6
|
-
params_proto/proto.py,sha256=
|
|
6
|
+
params_proto/proto.py,sha256=Q3NSmjxKZC7yKGref5F3o7KJEnALaaHWjwd1kDJRDXQ,41914
|
|
7
7
|
params_proto/type_utils.py,sha256=x68rL5m76ZFRKsCRgH_i_4vLpt6ldWEsEAalgacFIH8,7364
|
|
8
8
|
params_proto/cli/__init__.py,sha256=sLpN3GmaBqd_d0J0nvUNOeGlV74_-jQGW0nDUU34tjA,493
|
|
9
9
|
params_proto/cli/ansi_help.py,sha256=-1gzbvOpi9GjPlqgiINOYQAfIstzg0-ukv1se88TYCQ,10967
|
|
@@ -20,7 +20,7 @@ params_proto/v2/hyper.py,sha256=onBAkT8Ja8IkeHEOq1AwCdTuBzAnthIe766ZE0lAy-M,1146
|
|
|
20
20
|
params_proto/v2/partial.py,sha256=_ovi4NY8goYgHurfYt1OV0E9DSMXGYucjMVIyG1Q_xc,983
|
|
21
21
|
params_proto/v2/proto.py,sha256=KvinzgzwRQr2bHDNtrU7App2kgAyB-SEfBe4SNYceh0,18995
|
|
22
22
|
params_proto/v2/utils.py,sha256=5EWvwboZDTsCYfzSED_J6RVFyNLIlf95nIu4p_ZSVxA,3540
|
|
23
|
-
params_proto-3.0.
|
|
24
|
-
params_proto-3.0.
|
|
25
|
-
params_proto-3.0.
|
|
26
|
-
params_proto-3.0.
|
|
23
|
+
params_proto-3.0.0rc26.dist-info/METADATA,sha256=8k3wrzgdJnM0Oh_8lw9sBJmlmKusAVZgjg3kx_WhYIw,8995
|
|
24
|
+
params_proto-3.0.0rc26.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
25
|
+
params_proto-3.0.0rc26.dist-info/licenses/LICENSE.md,sha256=c2qSYi9tUMZtzj9SEsMeKhub5LJUmHwBtDLiIMM5b6U,1526
|
|
26
|
+
params_proto-3.0.0rc26.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|