Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tui: avoid deprecated import #5858

Merged
merged 1 commit into from
Dec 4, 2023

Conversation

oliver-sanders
Copy link
Member

  • Respond to deprecation warning:

    DeprecationWarning: 'urwid.wimp' is not expected to be imported
    directly. Please use public access from "urwid" package. Module
    'urwid.wimp' is deprecated and will be removed in the future.
    from cylc.flow.tui.app import TuiApp

Check List

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Applied any dependency changes to both setup.cfg (and conda-environment.yml if present).
  • Tests are included (or explain why tests are not needed).
  • CHANGES.md entry included if this is a change that can affect users
  • Cylc-Doc pull request opened if required at cylc/cylc-doc/pull/XXXX.
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

* Respond to deprecation warning:

  > DeprecationWarning: 'urwid.wimp' is not expected to be imported
  > directly. Please use public access from "urwid" package. Module
  > 'urwid.wimp' is deprecated and will be removed in the future.
  > from cylc.flow.tui.app import TuiApp
@oliver-sanders oliver-sanders added this to the cylc-8.3.0 milestone Dec 4, 2023
@oliver-sanders oliver-sanders self-assigned this Dec 4, 2023
@oliver-sanders oliver-sanders requested a review from wxtim December 4, 2023 12:35
Copy link
Member

@wxtim wxtim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Copy link
Member

@MetRonnie MetRonnie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got some other deprecation warnings too, don't know if you want to tackle them now or not

tests/integration/tui/test_app.py: 6 warnings
tests/integration/tui/test_mutations.py: 2 warnings
tests/integration/tui/test_show.py: 1 warning
tests/integration/tui/test_logs.py: 4 warnings
  ~/cylc-flow/cylc/flow/tui/app.py:279: PendingDeprecationWarning: AttrWrap is maintained for backwards compatibility only, new code should use AttrMap instead.
    footer = urwid.AttrWrap(urwid.Text(list_bindings()), 'foot')

tests/integration/tui/test_app.py: 6 warnings
tests/integration/tui/test_mutations.py: 2 warnings
tests/integration/tui/test_show.py: 1 warning
tests/integration/tui/test_logs.py: 4 warnings
  ~/cylc-flow/cylc/flow/tui/app.py:281: PendingDeprecationWarning: AttrWrap is maintained for backwards compatibility only, new code should use AttrMap instead.
    urwid.AttrWrap(self.listbox, 'body'),

tests/integration/tui/test_app.py: 6 warnings
tests/integration/tui/test_mutations.py: 2 warnings
tests/integration/tui/test_show.py: 1 warning
tests/integration/tui/test_logs.py: 4 warnings
  ~/cylc-flow/cylc/flow/tui/app.py:282: PendingDeprecationWarning: AttrWrap is maintained for backwards compatibility only, new code should use AttrMap instead.
    header=urwid.AttrWrap(header, 'head'),

tests/integration/tui/test_app.py: 211 warnings
tests/integration/tui/test_mutations.py: 41 warnings
tests/integration/tui/test_show.py: 19 warnings
tests/integration/tui/test_logs.py: 126 warnings
  ~/cylc-flow/cylc/flow/tui/app.py:94: DeprecationWarning: `TuiWidget.__super` was a deprecated feature for old python versions.Please use `super()` call instead.
    widget = self.get_indented_widget()

tests/integration/tui/test_app.py: 16 warnings
tests/integration/tui/test_mutations.py: 5 warnings
tests/integration/tui/test_show.py: 3 warnings
tests/integration/tui/test_logs.py: 15 warnings
  ~/cylc-flow/cylc/flow/tui/app.py:382: DeprecationWarning: Method `TreeListBox._set_body` is deprecated, please use property `TreeListBox.body`
    if self.update():

tests/integration/tui/test_app.py: 185 warnings
tests/integration/tui/test_mutations.py: 36 warnings
tests/integration/tui/test_show.py: 22 warnings
tests/integration/tui/test_logs.py: 101 warnings
  ~/.conda/envs/cylc8/lib/python3.10/site-packages/urwid/treetools.py:74: PendingDeprecationWarning: only for backwards compatibility. You should use the new standard container `contents`
    self._w.base_widget.widget_list[0] = [self.unexpanded_icon, self.expanded_icon][self.expanded]

tests/integration/tui/test_app.py: 185 warnings
tests/integration/tui/test_mutations.py: 36 warnings
tests/integration/tui/test_show.py: 22 warnings
tests/integration/tui/test_logs.py: 101 warnings
  ~/.conda/envs/cylc8/lib/python3.10/site-packages/urwid/widget/columns.py:150: PendingDeprecationWarning: only for backwards compatibility. You should use the new standard container `contents`
    self.widget_list = ml

tests/integration/tui/test_app.py: 31 warnings
tests/integration/tui/test_mutations.py: 7 warnings
tests/integration/tui/test_show.py: 2 warnings
tests/integration/tui/test_logs.py: 9 warnings
  ~/cylc-flow/tests/integration/tui/conftest.py:191: DeprecationWarning: Method `TreeListBox._set_body` is deprecated, please use property `TreeListBox.body`
    while not self.app.update():

tests/integration/tui/test_app.py: 22 warnings
tests/integration/tui/test_mutations.py: 11 warnings
tests/integration/tui/test_show.py: 6 warnings
tests/integration/tui/test_logs.py: 19 warnings
  ~/.conda/envs/cylc8/lib/python3.10/site-packages/urwid/listbox.py:1062: DeprecationWarning: `TuiWidget.__super` was a deprecated feature for old python versions.Please use `super()` call instead.
    key = focus_widget.keypress((maxcol,), key)

@oliver-sanders
Copy link
Member Author

Wasn't planning on doing that right now.

@MetRonnie MetRonnie merged commit 64417e5 into cylc:master Dec 4, 2023
@oliver-sanders oliver-sanders deleted the tui-deprecation-warning branch December 4, 2023 15:45
wxtim added a commit to wxtim/cylc that referenced this pull request Dec 5, 2023
…at_runtime

* upstream/master:
  tui: avoid deprecated import (cylc#5858)
  Exclude broken pytest-asyncio version
  remove lint (cylc#5856)
  Async pipe decorator: preserve wrapped func signature
  Maintain order for CYLC_PYTHONPATH (cylc#5853)
  Update tests/integration/tui/conftest.py
  tests/i: fix flaky tui/test_updater tests (cylc#5849)
  tests/i: tui - attempt to stabilise tests
  Bump pypa/gh-action-pypi-publish from 1.8.10 to 1.8.11 (cylc#5851)
  tests/i: fix flaky tui/test_updater tests
  Improve changelog entries
  Fix bad TOML example in `cylc lint` docstring (cylc#5843)
  lint - S011 no longer warns against 0{{a}} (cylc#5841)
  `cylc lint`: add rule to catch `rose date`
  tui: show view
  tui: log view
  tui: tidy dangling interfaces
  tui: fix an obscure freezing issue
  tui: update screenshots
  Tui 1.0
@penguinolog
Copy link

Small too late comment (found this PR while looked up for deprecated imports usage):
from urwid import SelectableIcon should work the same for urwid versions released since 2010.
Technically from urwid import <Class> and from urwid import <CONSTANT> for 99% of API are stable (except totally deprecated hacks, which are planned to delete)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants