Skip to content

Commit

Permalink
Fix ecolab import error, release 1.5.2 (Fix #456)
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 576106287
  • Loading branch information
Conchylicultor authored and The etils Authors committed Oct 24, 2023
1 parent 3cf4317 commit b777dbf
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion etils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
8 changes: 6 additions & 2 deletions etils/ecolab/auto_display_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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."""
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ ecolab = [
"jupyter",
"numpy",
"mediapy",
"packaging",
"etils[enp]",
"etils[epy]",
]
Expand Down

0 comments on commit b777dbf

Please sign in to comment.