diff --git a/docs/about.md b/docs/about.md index 0f5557c81..3a5c91bba 100644 --- a/docs/about.md +++ b/docs/about.md @@ -17,7 +17,7 @@ libtmux is a [typed](https://docs.python.org/3/library/typing.html) [abstraction layer] for tmux. It builds upon the concept of targets `-t`, to direct commands against -individual session, windows and panes and `FORMATS`, template variables +individual sessions, windows and panes and `FORMATS`, template variables exposed by tmux to describe their properties. Think of `-t` analogously to [scope]. @@ -32,18 +32,18 @@ relations of {class}`Server`, {class}`Session`, {class}`Window` and | {class}`Window` | {class}`Pane` | {class}`Session` | | {class}`Pane` | None | {class}`Window` | -Internally, tmux allows multiple servers to be ran on a system. Each one +Internally, tmux allows multiple servers to be run on a system. Each one uses a socket. The server-client architecture is executed so cleanly, many users don't think about it. tmux automatically connects to a default socket name and location for you if none (`-L`, `-S`) is specified. A server will be created automatically upon starting if none exists. -A server can have multiple sessions. `Ctrl-a s` can be used to switch +A server can have multiple sessions. `Ctrl+a s` can be used to switch between sessions running on the server. -Sessions, Windows and Panes all have their own unique identifier for +Sessions, windows and panes all have their own unique identifier for internal purposes. {class}`common.TmuxMappingObject` will make use of the -unique identifiers (`session_id`, `window_id`, `pane_id` ) to look +unique identifiers (`session_id`, `window_id`, `pane_id`) to look up the data stored in the {class}`Server` object. | Object | Prefix | Example | @@ -56,7 +56,7 @@ up the data stored in the {class}`Server` object. ## Similarities to tmux and Pythonics libtmux was built in the spirit of understanding how tmux operates -and how python objects and tools can abstract the API's in a pleasant way. +and how python objects and tools can abstract the APIs in a pleasant way. libtmux uses `FORMATTERS` in tmux to give identity attributes to {class}`Session`, {class}`Window` and {class}`Pane` objects. See @@ -66,13 +66,13 @@ libtmux uses `FORMATTERS` in tmux to give identity attributes to How is libtmux able to keep references to panes, windows and sessions? -> Tmux has unique ID's for sessions, windows and panes. +> Tmux has unique IDs for sessions, windows and panes. > > panes use `%`, such as `%1234` > > windows use `@`, such as `@2345` > -> sessions use `$`, for money, such as `$` +> sessions use `$`, such as `$13` > > How is libtmux able to handle windows with no names? @@ -82,7 +82,7 @@ How is libtmux able to keep references to panes, windows and sessions? > Pane index refers to the order of a pane on the screen. > -> Window index refers to the # of the window in the session. +> Window index refers to the number of the window in the session. > > To assert pane, window and session data, libtmux will use > {meth}`Server.sessions()`, {meth}`Session.windows()`, diff --git a/docs/developing.md b/docs/developing.md index 149f5df19..dcafc1f16 100644 --- a/docs/developing.md +++ b/docs/developing.md @@ -1,6 +1,6 @@ # Development -Install and [git] and [uv] +Install [git] and [uv] Clone: @@ -20,15 +20,29 @@ $ uv sync --all-extras --dev [installation documentation]: https://docs.astral.sh/uv/getting-started/installation/ [git]: https://git-scm.com/ +[uv]: https://github.com/astral-sh/uv Makefile commands prefixed with `watch_` will watch files and rerun. ## Tests -`uv run py.test` +```console +$ uv run py.test +``` -Helpers: `make test` -Rerun tests on file change: `make watch_test` (requires [entr(1)]) +### Helpers + +```console +$ make test +``` + +Rerun tests on file change: + +```console +$ make watch_test +``` + +(requires [entr(1)]) ### Pytest plugin @@ -44,19 +58,50 @@ Default preview server: http://localhost:8023 [sphinx-autobuild] will automatically build the docs, watch for file changes and launch a server. -From home directory: `make start_docs` From inside `docs/`: `make start` +From home directory: +```console +$ make start_docs +``` + +From inside `docs/`: +```console +$ make start +``` [sphinx-autobuild]: https://github.com/executablebooks/sphinx-autobuild ### Manual documentation (the hard way) -`cd docs/` and `make html` to build. `make serve` to start http server. +```console +$ cd docs/ +$ make html +``` + +to build. + +```console +$ make serve +``` + +to start http server. -Helpers: `make build_docs`, `make serve_docs` +Helpers: +```console +$ make build_docs +$ make serve_docs +``` -Rebuild docs on file change: `make watch_docs` (requires [entr(1)]) +Rebuild docs on file change: +```console +$ make watch_docs +``` +(requires [entr(1)]) -Rebuild docs and run server via one terminal: `make dev_docs` (requires above, and a `make(1)` with +Rebuild docs and run server via one terminal: +```console +$ make dev_docs +``` +(requires above, and {command}`make(1)` with `-J` support, e.g. GNU Make) ## Linting @@ -95,7 +140,7 @@ $ make ruff $ make watch_ruff ``` -requires [`entr(1)`]. +requires [entr(1)]. ```` @@ -177,7 +222,7 @@ $ make mypy $ make watch_mypy ``` -requires [`entr(1)`]. +requires [entr(1)]. ```` ## Releasing @@ -197,15 +242,17 @@ Let's assume we pick 0.9.1 `CHANGES`: Assure any PRs merged since last release are mentioned. Give a thank you to the contributor. Set the header with the new version and the date. Leave the "current" header and _Insert changes/features/fixes for next release here_ at -the top:: +the top: - current - ------- - - *Insert changes/features/fixes for next release here* +``` +current +------- +- *Insert changes/features/fixes for next release here* - libtmux 0.9.1 (2020-10-12) - -------------------------- - - :issue:`1`: Fix bug +libtmux 0.9.1 (2020-10-12) +-------------------------- +- :issue:`1`: Fix bug +``` `libtmux/__init__.py` and `__about__.py` - Set version @@ -225,20 +272,21 @@ to PyPI. This isn't used yet since package maintainers may want setup.py in the source. See https://github.com/tmux-python/tmuxp/issues/625. -As of 0.10, [uv] handles virtualenv creation, package requirements, versioning, +As of v0.10, [uv] handles virtualenv creation, package requirements, versioning, building, and publishing. Therefore there is no setup.py or requirements files. -Update `__version__` in `__about__.py` and `pyproject.toml`:: +Update `__version__` in `__about__.py` and `pyproject.toml`: - git commit -m 'build(libtmux): Tag v0.1.1' - git tag v0.1.1 - git push - git push --tags +```console +git commit -m 'build(libtmux): Tag v0.1.1' +git tag v0.1.1 +git push +git push --tags +``` [twine]: https://twine.readthedocs.io/ [uv]: https://github.com/astral-sh/uv [entr(1)]: http://eradman.com/entrproject/ -[`entr(1)`]: http://eradman.com/entrproject/ [ruff format]: https://docs.astral.sh/ruff/formatter/ [ruff]: https://ruff.rs [mypy]: http://mypy-lang.org/ diff --git a/docs/pytest-plugin/index.md b/docs/pytest-plugin/index.md index 7c3eed133..cdcdf5a82 100644 --- a/docs/pytest-plugin/index.md +++ b/docs/pytest-plugin/index.md @@ -33,7 +33,7 @@ The pytest plugin will be automatically detected via pytest, and the fixtures wi View libtmux's own [tests/](https://github.com/tmux-python/libtmux/tree/master/tests) as well as tmuxp's [tests/](https://github.com/tmux-python/tmuxp/tree/master/tests). -libtmux's tests `autouse` the {ref}`recommended-fixtures` above to ensure stable, assertions and +libtmux's tests `autouse` the {ref}`recommended-fixtures` above to ensure stable test execution, assertions and object lookups in the test grid. ## pytest-tmux @@ -41,14 +41,14 @@ object lookups in the test grid. `pytest-tmux` works through providing {ref}`pytest fixtures ` - so read up on those! -The plugin's fixtures guarantee a fresh, headless `tmux(1)` server, session, window, or pane is +The plugin's fixtures guarantee a fresh, headless {command}`tmux(1)` server, session, window, or pane is passed into your test. (recommended-fixtures)= ## Recommended fixtures -These are fixtures are automatically used when the plugin is enabled and `pytest` is run. +These fixtures are automatically used when the plugin is enabled and `pytest` is run. - Creating temporary, test directories for: - `/home/` ({func}`home_path`) @@ -67,14 +67,14 @@ options: - Pass a `config_file` into {class}`~libtmux.Server` - Set the `HOME` directory to a local or temporary pytest path with a configuration file -You could also read the code and override {func}`server fixtures `'s in your own doctest. doctest. +You could also read the code and override {func}`server fixture ` in your own doctest. (custom_session_params)= ### Custom session parameters -You can override `session_params` to custom the `session` fixture. The -dictionary will directly pass into :meth:`Server.new_session` keyword arguments. +You can override `session_params` to customize the `session` fixture. The +dictionary will directly pass into {meth}`Server.new_session` keyword arguments. ```python import pytest diff --git a/docs/quickstart.md b/docs/quickstart.md index 1c17fa87c..bb94c5c70 100644 --- a/docs/quickstart.md +++ b/docs/quickstart.md @@ -50,15 +50,14 @@ via trunk (can break easily): ``` [pip]: https://pip.pypa.io/en/stable/ +[ptpython]: https://github.com/prompt-toolkit/ptpython ## Start a tmux session Now, let's open a tmux session. ```console - $ tmux new-session -n bar -s foo - ``` This tutorial will be using the session and window name in the example. @@ -177,7 +176,7 @@ Session($1 ...) However, this isn't guaranteed, libtmux works against current tmux information, the session's name could be changed, or another tmux session may be created, -so {meth}`Server.sessions` and {meth}`Server.windows` exists as a lookup. +so {meth}`Server.sessions` and {meth}`Server.windows` exist as a lookup. ## Get session by ID