Skip to content

Commit 432d914

Browse files
committed
docs: Add comprehensive async documentation
Add first-class async documentation across README, quickstart, and API reference to match sync documentation standards. Created docs/api/async.md (comprehensive async API reference): - Overview and when to use async methods - Complete method documentation with usage examples - Concurrent operations patterns - Integration with async frameworks (FastAPI, aiohttp) - Error handling patterns - Performance characteristics and benchmarks - Comparison table: sync vs async - Implementation details (a' prefix convention) - Roadmap positioning as foundation of async support Updated README.md: - Added "Async Support" section before "Python support" - Practical example showing concurrent window creation - List of all 5 async methods with descriptions - Link to full async API documentation Updated docs/quickstart.md: - Added "Async Support" section before "Final notes" - Basic async usage example - Concurrent operations example with asyncio.gather() - List of available async methods with cross-references - When to use async guidance Updated docs/api/index.md: - Added 'async' to toctree after 'panes' Updated API reference files: - docs/api/servers.md: Added async methods section - docs/api/sessions.md: Added async methods section - docs/api/windows.md: Added async methods section - All include cross-references to comprehensive async docs Sphinx build: Succeeds with 62 warnings (pre-existing, not from changes) This completes essential async documentation (Option B), providing: ✅ All source code docstrings enhanced ✅ README shows async exists and how to use it ✅ Quickstart teaches async patterns ✅ Comprehensive async API reference ✅ Navigation and discoverability ✅ First-class documentation parity with sync methods
1 parent 5ba2e3d commit 432d914

File tree

7 files changed

+544
-0
lines changed

7 files changed

+544
-0
lines changed

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,46 @@ Window(@1 1:..., Session($1 ...))
246246
Session($1 ...)
247247
```
248248

249+
# Async support
250+
251+
libtmux provides async versions of key methods for use in async applications:
252+
253+
```python
254+
import asyncio
255+
from libtmux import Server
256+
257+
async def main():
258+
server = Server()
259+
260+
# Create session asynchronously
261+
session = await server.anew_session(
262+
session_name="async_session",
263+
start_directory="~/"
264+
)
265+
266+
# Create windows concurrently
267+
windows = await asyncio.gather(
268+
session.anew_window(window_name="editor"),
269+
session.anew_window(window_name="terminal"),
270+
session.anew_window(window_name="logs"),
271+
)
272+
273+
# Check session exists
274+
exists = await server.ahas_session("async_session")
275+
print(f"Session exists: {exists}") # True
276+
277+
asyncio.run(main())
278+
```
279+
280+
Available async methods (using 'a' prefix convention):
281+
- `Server.ahas_session()` - Check if session exists
282+
- `Server.anew_session()` - Create new session
283+
- `Session.anew_window()` - Create new window
284+
- `Session.arename_session()` - Rename session
285+
- `Window.akill()` - Kill window
286+
287+
See the [async API documentation](https://libtmux.git-pull.com/api/async.html) for details.
288+
249289
# Python support
250290

251291
Unsupported / no security releases or bug fixes:

0 commit comments

Comments
 (0)