Skip to content

Commit

Permalink
Merge pull request #765 from mit-ll-responsible-ai/release
Browse files Browse the repository at this point in the history
Release notes for v0.14
  • Loading branch information
rsokl authored Jan 2, 2025
2 parents f3f584d + 210f2e8 commit 8d7cfd2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
10 changes: 8 additions & 2 deletions docs/source/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,22 @@ Changelog
This is a record of all past hydra-zen releases and what went into them, in reverse
chronological order. All previous releases should still be available on pip.

.. _v0.13.0:
.. _v0.14.0:

----------------------
0.13.1rc1 - 2024-07-13
0.14.0rc1 - 2025-01-02
----------------------

.. note:: This is documentation for an pre-release version of hydra-zen. You can install this pre-release via `pip install --pre hydra-zen`

- Drops support for Python 3.8
- Adds support for Python 3.13
- Minimum supported version of omegaconf is increased from 2.2.1 to 2.2.3
- Adds compatibility with NumPy 2.0.0.
- Adds compatibility with jax 0.4.32+
- :func:`~hydra_zen.builds` and `~hydra_zen.just` now support classes defined within classes as targets. See :pull:`708`.
- The `hydrated_dataclass` decorator now respects the docstring of the class that it decorates. See :issue:`750`.
- Fixes a bug where `pydantic_parser` cannot be passed a `pydantic.BaseModel` as a target. See :issue:`723`.

.. _v0.13.0:

Expand Down
3 changes: 2 additions & 1 deletion src/hydra_zen/structured_configs/_implementations.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,8 @@ def wrapper(decorated_obj: Any) -> Any:
},
zen_convert=zen_convert,
)

if decorated_obj.__doc__ is not None: # pragma: no cover
out.__doc__ = decorated_obj.__doc__
return out

return wrapper
Expand Down
8 changes: 6 additions & 2 deletions src/hydra_zen/third_party/pydantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,14 @@ def f(x: PositiveInt): return x
(1, 2, 3)
"""
if inspect.isbuiltin(target):
return target
return cast(_T, target)

if isinstance(target, type) and issubclass(target, _pyd.BaseModel):
# this already applies pydantic parsing
return cast(_T, target)

if not (_get_signature(target)):
return target
return cast(_T, target)

if inspect.isclass(target):
return cast(_T, parser(_constructor_as_fn(target)))
Expand Down
7 changes: 6 additions & 1 deletion tests/test_third_party/test_using_all_pydantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import pydantic
import pytest
from hydra.errors import InstantiationException
from pydantic import PositiveInt
from pydantic import BaseModel, PositiveInt

from hydra_zen import BuildsFn, instantiate, zen
from hydra_zen.third_party.pydantic import pydantic_parser
Expand Down Expand Up @@ -108,6 +108,10 @@ class ADataClass:
zaa: bool


class PydanticModel(BaseModel):
xoo: int


@pytest.mark.parametrize(
"obj",
[
Expand All @@ -124,6 +128,7 @@ class ADataClass:
p(ADataClass, yee="yee", zaa=True),
p(len, [1, 2, 3]), # func, no signature
p(dict, a=1, b=2), # class, no signature
p(PydanticModel, xoo=1),
],
)
@pytest.mark.parametrize("use_meta_feature", [True, False])
Expand Down

0 comments on commit 8d7cfd2

Please sign in to comment.