diff --git a/CHANGELOG.md b/CHANGELOG.md index 87938824..0d3ae355 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ Changelog follow https://keepachangelog.com/ format. ## [Unreleased] +## [1.5.2] - 2023-10-24 + +* `ecolab`: + * Fix import error in IPython when 7.0 <= version < 8 * `epath`: * Fix resource_path when used on a adhoc-imported module. @@ -322,8 +326,9 @@ Changelog follow https://keepachangelog.com/ format. * Automated github release -[Unreleased]: https://github.com/google/etils/compare/v1.5.1...HEAD -[1.5.0]: https://github.com/google/etils/compare/v1.5.0...v1.5.1 +[Unreleased]: https://github.com/google/etils/compare/v1.5.2...HEAD +[1.5.2]: https://github.com/google/etils/compare/v1.5.1...v1.5.2 +[1.5.1]: https://github.com/google/etils/compare/v1.5.0...v1.5.1 [1.5.0]: https://github.com/google/etils/compare/v1.4.1...v1.5.0 [1.4.1]: https://github.com/google/etils/compare/v1.4.0...v1.4.1 [1.4.0]: https://github.com/google/etils/compare/v1.3.0...v1.4.0 diff --git a/etils/__init__.py b/etils/__init__.py index 3b738ede..2b14377e 100644 --- a/etils/__init__.py +++ b/etils/__init__.py @@ -16,7 +16,7 @@ # A new PyPI release will be pushed everytime `__version__` is increased # When changing this, also update the CHANGELOG.md -__version__ = '1.5.1' +__version__ = '1.5.2' # Do NOT add anything to this file. This is left empty on purpose. # Users should import subprojects directly. diff --git a/etils/ecolab/auto_display_utils.py b/etils/ecolab/auto_display_utils.py index 9495029f..b99acd37 100644 --- a/etils/ecolab/auto_display_utils.py +++ b/etils/ecolab/auto_display_utils.py @@ -18,15 +18,19 @@ import ast import traceback +import typing from typing import TypeVar from etils import epy import IPython +import packaging _T = TypeVar('_T') # Old API (before IPython 7.0) -_IS_LEGACY_API = hasattr(IPython.core, 'inputtransformer') +_IS_LEGACY_API = packaging.version.parse( + IPython.__version__ +) < packaging.version.parse('7') def auto_display(activate: bool = True) -> None: @@ -104,7 +108,7 @@ def _append_transform(list_, transform): list_.append(transform) -if _IS_LEGACY_API: +if _IS_LEGACY_API and not typing.TYPE_CHECKING: class _RecordLines(IPython.core.inputtransformer.InputTransformer): """Record lines.""" diff --git a/pyproject.toml b/pyproject.toml index da70a9f2..1a83ce32 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,6 +44,7 @@ ecolab = [ "jupyter", "numpy", "mediapy", + "packaging", "etils[enp]", "etils[epy]", ]