diff --git a/docs/conf.py b/docs/conf.py index 3a8abd835..8a1985cae 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -102,6 +102,9 @@ autodoc_member_order = "bysource" autosummary_generate = True +# sphinx_autodoc_typehints +always_document_param_types = True + # sphinx-copybutton copybutton_prompt_text = ( r">>> |\.\.\. |> |\$ |\# | In \[\d*\]: | {2,5}\.\.\.: | {5,8}: " diff --git a/docs/pytest-plugin.md b/docs/pytest-plugin.md index 4c2ab3dad..7389c8833 100644 --- a/docs/pytest-plugin.md +++ b/docs/pytest-plugin.md @@ -55,7 +55,7 @@ These are fixtures are automatically used when the plugin is enabled and `pytest If you would like {func}`session fixture ` to automatically use a configuration, you have a few options: -- Pass a `config_file` into {class}`~libtmux.Server` +- Pass a `config_file` into {class}`~libtmux.server.Server` - Set the `HOME` directory to a local or temporary pytest path with a configurat configuration file You could also read the code and override {func}`server fixtures `'s in your own doctest. doctest. diff --git a/docs/reference/panes.md b/docs/reference/panes.md index 383b4286f..0cbb48067 100644 --- a/docs/reference/panes.md +++ b/docs/reference/panes.md @@ -10,7 +10,7 @@ [pty(4)]: https://www.freebsd.org/cgi/man.cgi?query=pty&sektion=4 ```{eval-rst} -.. autoclass:: libtmux.Pane +.. autoclass:: libtmux.pane.Pane :members: :inherited-members: :private-members: diff --git a/docs/reference/properties.md b/docs/reference/properties.md index 085361f3f..5a54d3dd8 100644 --- a/docs/reference/properties.md +++ b/docs/reference/properties.md @@ -27,7 +27,7 @@ Import libtmux: >>> import libtmux ``` -Attach default tmux {class}`~libtmux.Server` to `t`: +Attach default tmux {class}`~libtmux.server.Server` to `t`: ```python >>> import libtmux @@ -73,7 +73,7 @@ of sessions in a window: ## Windows -The same concepts apply for {class}`~libtmux.Window`: +The same concepts apply for {class}`~libtmux.window.Window`: ```python >>> window = session.attached_window @@ -114,7 +114,7 @@ Use `get()` for details not accessible via properties: ## Panes -Get the {class}`~libtmux.Pane`: +Get the {class}`~libtmux.pane.Pane`: ```python >>> pane = window.attached_pane diff --git a/docs/reference/servers.md b/docs/reference/servers.md index b87687842..a630de829 100644 --- a/docs/reference/servers.md +++ b/docs/reference/servers.md @@ -10,7 +10,7 @@ tmux initializes a server on automatically on first running (e.g. executing `tmux`) ```{eval-rst} -.. autoclass:: libtmux.Server +.. autoclass:: libtmux.server.Server :members: :inherited-members: :private-members: diff --git a/docs/reference/sessions.md b/docs/reference/sessions.md index 008d64df9..18b4524c2 100644 --- a/docs/reference/sessions.md +++ b/docs/reference/sessions.md @@ -7,7 +7,7 @@ - Identified by `$`, e.g. `$313` ```{eval-rst} -.. autoclass:: libtmux.Session +.. autoclass:: libtmux.session.Session :members: :inherited-members: :private-members: diff --git a/docs/reference/windows.md b/docs/reference/windows.md index 728554b0d..3e2861a0d 100644 --- a/docs/reference/windows.md +++ b/docs/reference/windows.md @@ -6,12 +6,8 @@ - Contain {ref}`Panes` - Identified by `@`, e.g. `@313` -```{module} libtmux - -``` - ```{eval-rst} -.. autoclass:: Window +.. autoclass:: libtmux.window.Window :members: :inherited-members: :private-members: diff --git a/docs/topics/traversal.md b/docs/topics/traversal.md index 02b537306..a33784578 100644 --- a/docs/topics/traversal.md +++ b/docs/topics/traversal.md @@ -28,7 +28,7 @@ Import `libtmux`: import libtmux ``` -Attach default tmux {class}`~libtmux.Server` to `t`: +Attach default tmux {class}`~libtmux.server.Server` to `t`: ```python >>> import libtmux @@ -61,7 +61,7 @@ Session($1 ...) Session($0 ...) ``` -Grab a {class}`~libtmux.Window` from a session: +Grab a {class}`~libtmux.window.Window` from a session: ```python >>> session.windows[0] @@ -82,7 +82,7 @@ Grab the currently focused {class}`Pane` from session: Pane(%1 Window(@1 ...:..., Session($1 ...))) ``` -Assign the attached {class}`~libtmux.Pane` to `p`: +Assign the attached {class}`~libtmux.pane.Pane` to `p`: ```python >>> p = session.attached_pane diff --git a/libtmux/pane.py b/libtmux/pane.py index 469a0d9b3..e987d1550 100644 --- a/libtmux/pane.py +++ b/libtmux/pane.py @@ -71,11 +71,11 @@ class Pane(TmuxMappingObject): formatter_prefix = "pane_" """Namespace used for :class:`~libtmux.common.TmuxMappingObject`""" window: "Window" - """:class:`libtmux.Window` pane is linked to""" + """:class:`~libtmux.window.Window` pane is linked to""" session: "Session" - """:class:`libtmux.Session` pane is linked to""" + """:class:`~libtmux.session.Session` pane is linked to""" server: "Server" - """:class:`libtmux.Server` pane is linked to""" + """:class:`~libtmux.server.Server` pane is linked to""" def __init__( self, diff --git a/libtmux/pytest_plugin.py b/libtmux/pytest_plugin.py index 863e9e44f..55cc9acb0 100644 --- a/libtmux/pytest_plugin.py +++ b/libtmux/pytest_plugin.py @@ -108,7 +108,7 @@ def server( monkeypatch: pytest.MonkeyPatch, config_file: pathlib.Path, ) -> Server: - """Returns a new, temporary :class:`libtmux.Server`""" + """Returns a new, temporary :class:`libtmux.server.Server`""" t = Server() t.socket_name = "libtmux_test%s" % next(namer) diff --git a/libtmux/server.py b/libtmux/server.py index a049f3b9e..1a9d05ba3 100644 --- a/libtmux/server.py +++ b/libtmux/server.py @@ -30,13 +30,15 @@ class Server(TmuxRelationalObject["Session", "SessionDict"], EnvironmentMixin): """ The :term:`tmux(1)` :term:`Server` [server_manual]_. - - :attr:`Server._sessions` [:class:`Session`, ...] + - :attr:`Server._sessions` [:class:`Session `, ...] - - :attr:`Session._windows` [:class:`Window`, ...] + - :attr:`Session._windows ` + [:class:`~libtmux.window.Window`, ...] - - :attr:`Window._panes` [:class:`Pane`, ...] + - :attr:`Window._panes ` + [:class:`~libtmux.pane.Pane`, ...] - - :class:`Pane` + - :class:`~libtmux.pane.Pane` When instantiated stores information on live, running tmux server. diff --git a/libtmux/test.py b/libtmux/test.py index 19e9a8b29..695dfb0b7 100644 --- a/libtmux/test.py +++ b/libtmux/test.py @@ -100,7 +100,7 @@ def get_test_session_name(server: "Server", prefix: str = TEST_SESSION_PREFIX) - Parameters ---------- - server : :class:`libtmux.Server` + server : :class:`libtmux.server.Server` libtmux server prefix : str prefix for sessions (e.g. ``libtmux_``). Defaults to @@ -162,14 +162,14 @@ def temp_session( Parameters ---------- - server : :class:`libtmux.Server` + server : :class:`libtmux.server.Server` Other Parameters ---------------- args : list - Arguments passed into :meth:`Server.new_session` + Arguments passed into :meth:`libtmux.server.Server.new_session` kwargs : dict - Keyword arguments passed into :meth:`Server.new_session` + Keyword arguments passed into :meth:`libtmux.server.Server.new_session` Yields ------ @@ -225,7 +225,7 @@ def temp_window( Yields ------ - :class:`libtmux.Window` + :class:`libtmux.window.Window` temporary window Examples diff --git a/libtmux/window.py b/libtmux/window.py index 434dca17c..bb9a2559b 100644 --- a/libtmux/window.py +++ b/libtmux/window.py @@ -80,9 +80,9 @@ class Window(TmuxMappingObject, TmuxRelationalObject["Pane", "PaneDict"]): formatter_prefix = "window_" """Namespace used for :class:`~libtmux.common.TmuxMappingObject`""" server: "Server" - """:class:`libtmux.Server` window is linked to""" + """:class:`libtmux.server.Server` window is linked to""" session: "Session" - """:class:`libtmux.Session` window is linked to""" + """:class:`libtmux.session.Session` window is linked to""" def __init__( self, session: "Session", window_id: t.Union[int, str], **kwargs: t.Any