Skip to content

Conversation

@tony
Copy link
Member

@tony tony commented Dec 6, 2025

Convert deprecated APIs to raise DeprecatedError instead of DeprecationWarning
for legacy session/window/pane helpers, dict-style access, and old method/property
names deprecated in versions 0.16-0.33.

Breaking Changes

  • Legacy APIs now raise DeprecatedError (hard error) instead of emitting warnings
  • Affected: kill_server(), attach_session(), kill_session(), split_window(),
    select_window(), kill_window(), resize_pane(), select_pane(), dict access,
    where(), find_where(), get_by_id(), attached_window, attached_pane,
    children property, and more

Soft Warnings (Continuing)

  • g parameter on options/hooks methods (use global_ instead)
  • set_window_option(), show_window_option(), show_window_options() (0.50.0)

Changes

  • exc.py: Add DeprecatedError exception class with structured messages
  • server.py: Convert server-level deprecated methods to raise errors
  • session.py: Convert session-level deprecated methods to raise errors
  • window.py: Convert window-level deprecated methods to raise errors
  • pane.py: Convert pane-level deprecated methods to raise errors
  • options.py: Keep g parameter as soft warning, update internal calls
  • CHANGES: Document breaking changes with deprecation table
  • MIGRATION: Add comprehensive deprecation reference tables
  • tests/: Update all tests to expect DeprecatedError or use new APIs

@codecov
Copy link

codecov bot commented Dec 6, 2025

Codecov Report

❌ Patch coverage is 92.45283% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 45.34%. Comparing base (d6a8838) to head (d87f185).

Files with missing lines Patch % Lines
src/libtmux/exc.py 50.00% 2 Missing ⚠️
src/libtmux/options.py 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #611      +/-   ##
==========================================
+ Coverage   44.46%   45.34%   +0.88%     
==========================================
  Files          22       22              
  Lines        2305     2236      -69     
  Branches      362      354       -8     
==========================================
- Hits         1025     1014      -11     
+ Misses       1133     1079      -54     
+ Partials      147      143       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

tony added a commit that referenced this pull request Dec 6, 2025
why: collapse multiple CHANGES edits into a single entry with correct Sphinx links.
what:
- keep future release placeholder visible
- provide api-linked table for deprecated items now raising DeprecatedError
- reference migration doc for details
tony added a commit that referenced this pull request Dec 6, 2025
why: collapse multiple CHANGES edits into a single entry with correct Sphinx links.
what:
- keep future release placeholder visible
- provide api-linked table for deprecated items now raising DeprecatedError
- reference migration doc for details
@tony tony marked this pull request as ready for review December 6, 2025 10:28
@tony
Copy link
Member Author

tony commented Dec 6, 2025

Code review

Found 1 issue:

  1. Version inconsistency for get_by_id() deprecation in MIGRATION file

The MIGRATION file documents three different versions for the same deprecation:

  • "Parameter Changes" table (lines 60-62): 0.26.0 for Server.get_by_id(), Session.get_by_id(), Window.get_by_id()
  • "Query/Filter API Changes" table (lines 71, 75, 79): 0.17.0 for the same methods
  • Actual code and docstrings: 0.16.0 (e.g., .. deprecated:: 0.16 in docstrings)

The code version 0.16.0 appears to be correct based on docstrings. The MIGRATION tables should be updated for consistency.

libtmux/MIGRATION

Lines 60 to 62 in 2a4771c

| `Server.get_by_id()` | `id` | `session_id` | 0.26.0 (2024-02-06) |
| `Session.get_by_id()` | `id` | `window_id` | 0.26.0 (2024-02-06) |
| `Window.get_by_id()` | `id` | `pane_id` | 0.26.0 (2024-02-06) |

libtmux/MIGRATION

Lines 71 to 79 in 2a4771c

| Server | `get_by_id(id)` | `sessions.get(session_id=..., default=None)` | 0.17.0 (2022-12-26) |
| Session | `list_windows()` / `_list_windows()` | `windows` property | 0.17.0 (2022-12-26) |
| Session | `where({...})` | `windows.filter(**kwargs)` | 0.17.0 (2022-12-26) |
| Session | `find_where({...})` | `windows.get(default=None, **kwargs)` | 0.17.0 (2022-12-26) |
| Session | `get_by_id(id)` | `windows.get(window_id=..., default=None)` | 0.17.0 (2022-12-26) |
| Window | `list_panes()` / `_list_panes()` | `panes` property | 0.17.0 (2022-12-26) |
| Window | `where({...})` | `panes.filter(**kwargs)` | 0.17.0 (2022-12-26) |
| Window | `find_where({...})` | `panes.get(default=None, **kwargs)` | 0.17.0 (2022-12-26) |
| Window | `get_by_id(id)` | `panes.get(pane_id=..., default=None)` | 0.17.0 (2022-12-26) |


Generated with Claude Code

- If this code review was useful, please react with a thumbs up. Otherwise, react with a thumbs down.

tony added a commit that referenced this pull request Dec 6, 2025
why: collapse multiple CHANGES edits into a single entry with correct Sphinx links.
what:
- keep future release placeholder visible
- provide api-linked table for deprecated items now raising DeprecatedError
- reference migration doc for details
tony added a commit that referenced this pull request Dec 6, 2025
why: collapse multiple CHANGES edits into a single entry with correct Sphinx links.
what:
- keep future release placeholder visible
- provide api-linked table for deprecated items now raising DeprecatedError
- reference migration doc for details
tony added a commit that referenced this pull request Dec 6, 2025
why: collapse multiple CHANGES edits into a single entry with correct Sphinx links.
what:
- keep future release placeholder visible
- provide api-linked table for deprecated items now raising DeprecatedError
- reference migration doc for details
@tony tony force-pushed the deprecations branch 3 times, most recently from 28349a8 to babc0e8 Compare December 6, 2025 18:12
tony added a commit that referenced this pull request Dec 6, 2025
…or (#611)

why: Legacy APIs deprecated in 0.16-0.33 should now raise hard errors instead
of soft warnings to encourage migration to new APIs.
what:
- Add DeprecatedError exception class in exc.py
- Server: kill_server, get_by_id, where, find_where, list_sessions, etc.
- Session: attach_session, kill_session, attached_window/pane, etc.
- Window: split_window, select_window, kill_window, attached_pane, etc.
- Pane: resize_pane, select_pane, split_window, dict access
- Keep 0.50 deprecations (g param, window options) as soft warnings
tony added a commit that referenced this pull request Dec 6, 2025
why: Tests need to verify DeprecatedError is raised for legacy APIs.
what:
- Update legacy_api tests to use pytest.raises(DeprecatedError)
- Update other tests to use new APIs instead of deprecated ones
- Use namespace imports for exception classes
tony added a commit that referenced this pull request Dec 6, 2025
why: Users need a single reference for all deprecated APIs.
what:
- Add method renamings table with Since/Raises columns
- Add property renamings table
- Add parameter changes table
- Add query/filter API changes table
- Add attribute access changes table
- Add removed items table
- Add default behavior changes table
tony added a commit that referenced this pull request Dec 6, 2025
why: Changelog needs to document breaking changes.
what:
- Add APIs deprecated section listing all affected methods
- Reference MIGRATION for full context
- Note 0.50 deprecations remain as soft warnings
@tony tony force-pushed the deprecations branch 2 times, most recently from 67a5109 to e791819 Compare December 6, 2025 20:03
tony added a commit that referenced this pull request Dec 6, 2025
…or (#611)

why: Legacy APIs deprecated in 0.16-0.33 should now raise hard errors instead
of soft warnings to encourage migration to new APIs.
what:
- Add DeprecatedError exception class in exc.py
- Server: kill_server, get_by_id, where, find_where, list_sessions, etc.
- Session: attach_session, kill_session, attached_window/pane, etc.
- Window: split_window, select_window, kill_window, attached_pane, etc.
- Pane: resize_pane, select_pane, split_window, dict access
- Keep 0.50 deprecations (g param, window options) as soft warnings
tony added a commit that referenced this pull request Dec 6, 2025
why: Tests need to verify DeprecatedError is raised for legacy APIs.
what:
- Update legacy_api tests to use pytest.raises(DeprecatedError)
- Update other tests to use new APIs instead of deprecated ones
- Use namespace imports for exception classes
tony added a commit that referenced this pull request Dec 6, 2025
why: Users need a single reference for all deprecated APIs.
what:
- Add method renamings table with Since/Raises columns
- Add property renamings table
- Add parameter changes table
- Add query/filter API changes table
- Add attribute access changes table
- Add removed items table
- Add default behavior changes table
tony added a commit that referenced this pull request Dec 6, 2025
why: Changelog needs to document breaking changes.
what:
- Add APIs deprecated section listing all affected methods
- Reference MIGRATION for full context
- Note 0.50 deprecations remain as soft warnings
@tony
Copy link
Member Author

tony commented Dec 6, 2025

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

why: Legacy APIs deprecated in 0.16-0.33 should now raise hard errors instead
of soft warnings to encourage migration to new APIs.
what:
- Add DeprecatedError exception class in exc.py
- Server: kill_server, get_by_id, where, find_where, list_sessions, etc.
- Session: attach_session, kill_session, attached_window/pane, etc.
- Window: split_window, select_window, kill_window, attached_pane, etc.
- Pane: resize_pane, select_pane, split_window, dict access
- Keep 0.50 deprecations (g param, window options) as soft warnings
tony added 3 commits December 6, 2025 14:39
why: Tests need to verify DeprecatedError is raised for legacy APIs.
what:
- Update legacy_api tests to use pytest.raises(DeprecatedError)
- Update other tests to use new APIs instead of deprecated ones
- Use namespace imports for exception classes
why: Users need a single reference for all deprecated APIs.
what:
- Add method renamings table with Since/Raises columns
- Add property renamings table
- Add parameter changes table
- Add query/filter API changes table
- Add attribute access changes table
- Add removed items table
- Add default behavior changes table
why: Changelog needs to document breaking changes.
what:
- Add APIs deprecated section listing all affected methods
- Reference MIGRATION for full context
- Note 0.50 deprecations remain as soft warnings
@tony
Copy link
Member Author

tony commented Dec 6, 2025

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

@tony tony merged commit 4cad449 into master Dec 6, 2025
14 checks passed
@tony tony deleted the deprecations branch December 6, 2025 20:55
@tony tony changed the title Deprecations Deprecate legacy APIs (raise DeprecatedError ) Dec 6, 2025
@tony tony changed the title Deprecate legacy APIs (raise DeprecatedError ) Deprecate legacy APIs (raise DeprecatedError) Dec 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants