Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@ $ uvx --from 'libtmux' --prerelease allow python
_Notes on the upcoming release will go here._
<!-- END PLACEHOLDER - ADD NEW CHANGELOG ENTRIES BELOW THIS LINE -->

### Documentation

#### Cleaner `from_env` examples (#719)

The rendered examples for {meth}`Pane.from_env() <libtmux.Pane.from_env>` and
its {meth}`Server <libtmux.Server.from_env>`,
{meth}`Session <libtmux.Session.from_env>`, and
{meth}`Window <libtmux.Window.from_env>` siblings now hide the incidental
environment-setup plumbing, so each example leads with the constructor call it
demonstrates instead of the socket-path and `$TMUX` boilerplate needed to run
it.

## libtmux 0.62.0 (2026-07-12)

libtmux 0.62.0 teaches libtmux objects to locate themselves and to resolve
Expand Down
7 changes: 5 additions & 2 deletions src/libtmux/pane.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,13 @@ def from_env(cls, env: t.Mapping[str, str] | None = None) -> Pane:

Examples
--------
>>> socket_path = server.cmd(
>>> socket_path = server.cmd( # doctest: +HIDE
... "display-message", "-p", "-t", pane.pane_id, "#{socket_path}"
... ).stdout[0]
>>> env = {"TMUX": f"{socket_path},1,0", "TMUX_PANE": pane.pane_id}
>>> env = { # doctest: +HIDE
... "TMUX": f"{socket_path},1,0",
... "TMUX_PANE": pane.pane_id,
... }

>>> Pane.from_env(env)
Pane(%1 Window(@1 1:..., Session($1 ...)))
Expand Down
9 changes: 6 additions & 3 deletions src/libtmux/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,14 @@ def from_env(cls, env: t.Mapping[str, str] | None = None) -> Server:

Examples
--------
>>> from libtmux.server import Server as TmuxServer
>>> socket_path = server.cmd(
>>> from libtmux.server import Server as TmuxServer # doctest: +HIDE
>>> socket_path = server.cmd( # doctest: +HIDE
... "display-message", "-p", "-t", pane.pane_id, "#{socket_path}"
... ).stdout[0]
>>> env = {"TMUX": f"{socket_path},1,0", "TMUX_PANE": pane.pane_id}
>>> env = { # doctest: +HIDE
... "TMUX": f"{socket_path},1,0",
... "TMUX_PANE": pane.pane_id,
... }

>>> TmuxServer.from_env(env)
Server(socket_path=...)
Expand Down
2 changes: 1 addition & 1 deletion src/libtmux/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def from_env(cls, env: t.Mapping[str, str] | None = None) -> Session:

Examples
--------
>>> socket_path = server.cmd(
>>> socket_path = server.cmd( # doctest: +HIDE
... "display-message", "-p", "-t", pane.pane_id, "#{socket_path}"
... ).stdout[0]

Expand Down
7 changes: 5 additions & 2 deletions src/libtmux/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,13 @@ def from_env(cls, env: t.Mapping[str, str] | None = None) -> Window:

Examples
--------
>>> socket_path = server.cmd(
>>> socket_path = server.cmd( # doctest: +HIDE
... "display-message", "-p", "-t", pane.pane_id, "#{socket_path}"
... ).stdout[0]
>>> env = {"TMUX": f"{socket_path},1,0", "TMUX_PANE": pane.pane_id}
>>> env = { # doctest: +HIDE
... "TMUX": f"{socket_path},1,0",
... "TMUX_PANE": pane.pane_id,
... }

>>> Window.from_env(env)
Window(@1 1:..., Session($1 ...))
Expand Down
Loading