Skip to content

Docs: Use full paths to objects #413

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -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}: "
2 changes: 1 addition & 1 deletion docs/pytest-plugin.md
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ These are fixtures are automatically used when the plugin is enabled and `pytest
If you would like {func}`session fixture <libtmux.pytest_plugin.session>` 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 <libtmux.pytest_plugin.server>`'s in your own doctest. doctest.
2 changes: 1 addition & 1 deletion docs/reference/panes.md
Original file line number Diff line number Diff line change
@@ -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:
6 changes: 3 additions & 3 deletions docs/reference/properties.md
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion docs/reference/servers.md
Original file line number Diff line number Diff line change
@@ -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:
2 changes: 1 addition & 1 deletion docs/reference/sessions.md
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
- Identified by `$`, e.g. `$313`

```{eval-rst}
.. autoclass:: libtmux.Session
.. autoclass:: libtmux.session.Session
:members:
:inherited-members:
:private-members:
6 changes: 1 addition & 5 deletions docs/reference/windows.md
Original file line number Diff line number Diff line change
@@ -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:
6 changes: 3 additions & 3 deletions docs/topics/traversal.md
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions libtmux/pane.py
Original file line number Diff line number Diff line change
@@ -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,
2 changes: 1 addition & 1 deletion libtmux/pytest_plugin.py
Original file line number Diff line number Diff line change
@@ -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)

10 changes: 6 additions & 4 deletions libtmux/server.py
Original file line number Diff line number Diff line change
@@ -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 <libtmux.session.Session>`, ...]

- :attr:`Session._windows` [:class:`Window`, ...]
- :attr:`Session._windows <libtmux.session.Session._windows>`
[:class:`~libtmux.window.Window`, ...]

- :attr:`Window._panes` [:class:`Pane`, ...]
- :attr:`Window._panes <libtmux.window.Window._panes>`
[:class:`~libtmux.pane.Pane`, ...]

- :class:`Pane`
- :class:`~libtmux.pane.Pane`

When instantiated stores information on live, running tmux server.

10 changes: 5 additions & 5 deletions libtmux/test.py
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions libtmux/window.py
Original file line number Diff line number Diff line change
@@ -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