Skip to content
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

Improved option management, add hook management #516

Open
wants to merge 65 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
2d40e6c
docs(test-helpers) Update to existing modules
tony Feb 27, 2025
e8b5d7a
docs(test-helpers) Add retry page
tony Feb 27, 2025
76326f3
py(deps[dev]) Bump dev packages
tony Feb 27, 2025
1668b45
chore: Add `__init__.py` for tests/examples
tony Feb 27, 2025
fc3dec2
chore: Add `__init__.py` for tests/examples/test
tony Feb 26, 2025
a438f2d
chore: Add `__init__.py` for tests/examples/_internal/waiter
tony Feb 27, 2025
aa260f2
fix(retry): Improve retry_until_extended function with better error m…
tony Feb 26, 2025
10a37e5
feat(waiter): Enhance terminal content waiting utility with fluent AP…
tony Feb 26, 2025
0c74d33
test(waiter): Fix test cases and improve type safety
tony Feb 26, 2025
a10493a
docs(waiter): Add comprehensive documentation for terminal content wa…
tony Feb 26, 2025
6bdbb5c
pyproject(mypy[exceptions]): examples to ignore `no-untyped-def`
tony Feb 26, 2025
d436d75
test: add conftest.py to register example marker
tony Feb 26, 2025
17d2967
refactor(tests[waiter]): Add waiter test examples into individual files
tony Feb 26, 2025
50081b5
docs(CHANGES) Note `Waiter`
tony Feb 27, 2025
db47652
feat(waiter): Add terminal content waiting utility for testing (#582)
tony Feb 27, 2025
9661039
cursor(rules[git-commits]) Use component name first
tony Feb 28, 2025
677aa96
cursor(rules[git-commits]) Standardize further
tony Feb 28, 2025
60d1386
cursor(rules[dev-loop]) Use `--show-fixes` in `ruff check`
tony Feb 28, 2025
b5b4a8c
feat!(Window): Set option flags
tony Feb 5, 2024
84bfbc1
refactor!(Window): Deprecate set_window_option -> set_option
tony Feb 5, 2024
5cf3321
tests(Window): Rename test for show_window_options()
tony Feb 6, 2024
4a314ce
tests(Window): set_option
tony Feb 6, 2024
1e00ae6
Window: Add show_option(), deprecate show_window_option()
tony Feb 6, 2024
4596b56
chore(Window): {set,show}-window-option -> {set,show}-option -w
tony Feb 6, 2024
486cdce
libtmux.constants: Add OptionScope and OPTION_SCOPE_FLAG_MAP
tony Feb 6, 2024
7e9a6e6
feat(Window): scope param for Window.{set,show}_option
tony Feb 6, 2024
ae6da1c
tests(Window): show_options w/ scope
tony Feb 6, 2024
c5aa606
tests: show_window_option() -> show_option()
tony Feb 6, 2024
16a1396
feat(common): Add CmdMixin, CmdProtocol
tony Feb 8, 2024
7c11e71
refactor!(options): Move handle_options_error -> options
tony Feb 8, 2024
40b529c
feat(internal[sparse_array]): Add SparseArray
tony Jun 20, 2024
df0656f
feat(options): Add OptionsMixin
tony Feb 8, 2024
77ca697
feat(Window): Use OptionsMixin for Window.set_option, Window.show_opt…
tony Feb 7, 2024
7cd87f2
feat(Pane): Use OptionsMixin for Pane.set_option, Pane.show_option(s)
tony Feb 5, 2024
c34a6b4
feat(Session): Use OptionsMixin for Session.set_option, Session.show_…
tony Feb 7, 2024
f2bc27a
feat(Server): Use OptionsMixin for Server.set_option, Server.show_opt…
tony Feb 8, 2024
9b9c399
tests: Handle Window.show_options scope mismatch
tony Feb 7, 2024
3fd8319
tests(window): Version guard to scope
tony Feb 6, 2024
9696b16
tests(Window): For Window.default_option_scope
tony Feb 8, 2024
3360993
docs(options): Add page for option helpers
tony Feb 8, 2024
f92a835
internal(constants[options]): GPT generated dataclasses
tony Feb 9, 2024
2d9e2b7
tests(test_options): Test OptionsMixin
tony Feb 8, 2024
f96093b
docs(CHANGES): Note updates for options
tony Feb 6, 2024
1756f9c
constants: Add HOOK_SCOPE_FLAG_MAP
tony Feb 16, 2024
e62484d
docs(API): Document internal constants
tony Feb 15, 2024
ce8fbac
feat(internal[constants]): Add Hooks data structure
tony Feb 15, 2024
a03f1cc
feat!(hooks): HooksMixin
tony Feb 15, 2024
39b5caa
feat(Pane): Add HooksMixin
tony Feb 15, 2024
0ccc4f4
feat(Window): Add HooksMixin
tony Feb 15, 2024
873f29d
feat(Session): Add HooksMixin
tony Feb 15, 2024
9773e84
feat(Server): Add HooksMixin
tony Feb 15, 2024
5f80216
docs(API): Add Hooks
tony Feb 16, 2024
68a09bd
tests(test_hooks): Test HooksMixin
tony Feb 15, 2024
7c92836
!squash tests(test_options): Tests for OptionsMixin
tony Apr 13, 2024
dee251c
!squash test_options: renamings
tony May 5, 2024
bc3b759
!squash tmux set options. I want to be able to pass in high-level, "…
tony May 5, 2024
e855ff7
Revert "!squash tmux set options. I want to be able to pass in high-…
tony Jun 20, 2024
efe6884
!squash test_options: Stable baseline
tony Jun 20, 2024
fa47cdb
!squash to feat(Window): scope param for Window.{set,show}_option
tony Jul 20, 2024
66abda8
fix(options): improve type safety for SparseArray handling
tony Feb 23, 2025
73dd13c
test(options): update terminal-features test for tmux 3.4
tony Feb 23, 2025
57383bf
test(options): improve test coverage and type safety
tony Feb 23, 2025
1616798
fix(tests): improve type safety in style option tests
tony Feb 23, 2025
d78af39
fix(tests): handle status-format version compatibility
tony Feb 23, 2025
7bff126
fix(tests): handle update-environment version compatibility
tony Feb 23, 2025
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
2 changes: 1 addition & 1 deletion .cursor/rules/dev-loop.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ uv run mypy
Lint:

```
uv run ruff check . --fix; uv run ruff format .;
uv run ruff check . --fix --show-fixes; uv run ruff format .;
```

Check tests:
Expand Down
132 changes: 72 additions & 60 deletions .cursor/rules/git-commits.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -2,81 +2,93 @@
description: git-commits: Git commit message standards and AI assistance
globs: git-commits: Git commit message standards and AI assistance | *.git/* .gitignore .github/* CHANGELOG.md CHANGES.md
---
# Git Commit Standards
# Optimized Git Commit Standards

## Format
## Commit Message Format
```
type(scope[component]): concise description
Component/File(commit-type[Subcomponent/method]): Concise description

why: explanation of necessity/impact
what:
- technical changes made
- keep focused on single topic
why: Explanation of necessity or impact.
what:
- Specific technical changes made
- Focused on a single topic

refs: #issue-number, breaking changes, links
refs: #issue-number, breaking changes, or relevant links
```

## Commit Types
- `feat`: New features/enhancements
- `fix`: Bug fixes
- `refactor`: Code restructuring
- `docs`: Documentation changes
- `chore`: Maintenance tasks (deps, tooling)
- `test`: Test-related changes
- `style`: Code style/formatting

## Guidelines
- Subject line: max 50 chars
- Body lines: max 72 chars
- Use imperative mood ("Add" not "Added")
- Single topic per commit
- Blank line between subject and body
- Mark breaking changes with "BREAKING:"
- Use "See also:" for external links

## AI Assistance in Cursor
- Stage changes with `git add`
- Use `@commit` to generate initial message
- Review and adjust the generated message
- Ensure it follows format above

## Examples

Good commit:
## Component Patterns
### General Code Changes
```
Component/File(feat[method]): Add feature
Component/File(fix[method]): Fix bug
Component/File(refactor[method]): Code restructure
```
feat(subprocess[run]): Switch to unicode-only text handling

why: Improve consistency and type safety in subprocess handling
what:
- BREAKING: Changed run() to use text=True by default
- Removed console_to_str() helper and encoding logic
- Simplified output handling
- Updated type hints for better safety
### Packages and Dependencies
| Language | Standard Packages | Dev Packages | Extras / Sub-packages |
|------------|------------------------------------|-------------------------------|-----------------------------------------------|
| General | `lang(deps):` | `lang(deps[dev]):` | |
| Python | `py(deps):` | `py(deps[dev]):` | `py(deps[extra]):` |
| JavaScript | `js(deps):` | `js(deps[dev]):` | `js(deps[subpackage]):`, `js(deps[dev{subpackage}]):` |

refs: #485
See also: https://docs.python.org/3/library/subprocess.html
#### Examples
- `py(deps[dev]): Update pytest to v8.1`
- `js(deps[ui-components]): Upgrade Button component package`
- `js(deps[dev{linting}]): Add ESLint plugin`

### Documentation Changes
Prefix with `docs:`
```
docs(Component/File[Subcomponent/method]): Update API usage guide
```

Bad commit:
### Test Changes
Prefix with `tests:`
```
updated some stuff and fixed bugs
tests(Component/File[Subcomponent/method]): Add edge case tests
```

Cursor Rules: Add development QA and git commit standards (#cursor-rules)
## Commit Types Summary
- **feat**: New features or enhancements
- **fix**: Bug fixes
- **refactor**: Code restructuring without functional change
- **docs**: Documentation updates
- **chore**: Maintenance (dependencies, tooling, config)
- **test**: Test-related updates
- **style**: Code style and formatting

## General Guidelines
- Subject line: Maximum 50 characters
- Body lines: Maximum 72 characters
- Use imperative mood (e.g., "Add", "Fix", not "Added", "Fixed")
- Limit to one topic per commit
- Separate subject from body with a blank line
- Mark breaking changes clearly: `BREAKING:`
- Use `See also:` to provide external references

## AI Assistance Workflow in Cursor
- Stage changes with `git add`
- Use `@commit` to generate initial commit message
- Review and refine generated message
- Ensure adherence to these standards

## Good Commit Example
```
Pane(feat[capture_pane]): Add screenshot capture support

- Add dev-loop.mdc: QA process for code edits
- Type checking with mypy
- Linting with ruff
- Test validation with pytest
- Ensures edits are validated before commits
why: Provide visual debugging capability
what:
- Implement capturePane method with image export
- Integrate with existing Pane component logic
- Document usage in Pane README

- Add git-commits.mdc: Commit message standards
- Structured format with why/what sections
- Defined commit types and guidelines
- Examples of good/bad commits
- AI assistance instructions
refs: #485
See also: https://example.com/docs/pane-capture
```

Note: These rules help maintain code quality and commit history
consistency across the project.
## Bad Commit Example
```
fixed stuff and improved some functions
```

See also: https://docs.cursor.com/context/rules-for-ai
These guidelines ensure clear, consistent commit histories, facilitating easier code review and maintenance.
60 changes: 49 additions & 11 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ $ pip install --user --upgrade --pre libtmux

- _Future release notes will be placed here_

### New features

#### Waiting (#582)

Added experimental `waiter.py` module for polling for terminal content in tmux panes:

- Fluent API inspired by Playwright for better readability and chainable options
- Support for multiple pattern types (exact text, contains, regex, custom predicates)
- Composable waiting conditions with `wait_for_any_content` and `wait_for_all_content`
- Enhanced error handling with detailed timeouts and match information
- Robust shell prompt detection

## libtmux 0.46.0 (2025-02-25)

### Breaking
Expand Down Expand Up @@ -196,6 +208,43 @@ Add `TestServer` pytest fixture for creating temporary tmux servers (#565):
- dev dependencies: Include `typing-extensions` for Python version < 3.11 via
the `testing` and `lint` groups, via #564.

### Renamed commands

- Renamed `Window.set_window_option()` to {meth}`Window.set_option()` (#516)

Deprecated `Window.set_window_option()`

- Renamed `Window.show_window_option()` to {meth}`Window.show_option()` (#516)

Deprecated `Window.show_window_option()`

- Renamed `Window.show_window_options()` to {meth}`Window.show_options()` (#516)

Deprecated `Window.show_window_options()`

### Improved options

- Option support expanded to server, session, window, and pane
- Option support enhanced and streamlined via {class}`options.OptionsMixin`.

- `set_option`
- `show_option`
- `show_options`
- `unset_option`

- {meth}`Window.set_option()` (#516)

Added arguments:

- `format` -> `-F`
- `unset` -> `-u`
- `global` -> `-g`
- `unset_panes` -> `-U`: Also unset other panse in windows
- `prevent_overwrite`: `-o`
- `suppress_warnings`: `-q`
- `append`: `-a`


## libtmux 0.42.0 (2025-02-02)

### Bug fixes
Expand All @@ -222,17 +271,6 @@ Add `TestServer` pytest fixture for creating temporary tmux servers (#565):
- `Server`: Fix `colors` docstring to note it accepts `88` or `256`, Thank you
@TravisDart! (via #544)

### Development

#### chore: Implement PEP 563 deferred annotation resolution (#555)

- Add `from __future__ import annotations` to defer annotation resolution and reduce unnecessary runtime computations during type checking.
- Enable Ruff checks for PEP-compliant annotations:
- [non-pep585-annotation (UP006)](https://docs.astral.sh/ruff/rules/non-pep585-annotation/)
- [non-pep604-annotation (UP007)](https://docs.astral.sh/ruff/rules/non-pep604-annotation/)

For more details on PEP 563, see: https://peps.python.org/pep-0563/

## libtmux 0.40.1 (2024-12-24)

### Bug fix
Expand Down
6 changes: 6 additions & 0 deletions docs/api/hooks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Hooks

```{eval-rst}
.. automodule:: libtmux.hooks
:members:
```
2 changes: 2 additions & 0 deletions docs/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ servers
sessions
windows
panes
options
hooks
constants
common
exceptions
Expand Down
6 changes: 6 additions & 0 deletions docs/api/options.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Options

```{eval-rst}
.. automodule:: libtmux.options
:members:
```
15 changes: 15 additions & 0 deletions docs/internals/constants.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Internal Constants - `libtmux._internal.constants`

:::{warning}
Be careful with these! These constants are private, internal as they're **not** covered by version policies. They can break or be removed between minor versions!

If you need a data structure here made public or stabilized please [file an issue](https://github.com/tmux-python/libtmux/issues).
:::

```{eval-rst}
.. automodule:: libtmux._internal.constants
:members:
:undoc-members:
:inherited-members:
:show-inheritance:
```
2 changes: 2 additions & 0 deletions docs/internals/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ If you need an internal API stabilized please [file an issue](https://github.com
```{toctree}
dataclasses
query_list
waiter
constants
```

## Environmental variables
Expand Down
Loading
Loading