Skip to content

Commit

Permalink
add utz.proc.aio alias, README example
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-williams committed Feb 19, 2025
1 parent 9d2bd7d commit 4aba6cb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- [Python REPL](#repl)
- [Modules](#modules)
- [`utz.proc`: `subprocess` wrappers; shell out commands, parse output](#utz.proc)
- [`utz.proc.aio`: async `subprocess` wrappers](#utz.proc.aio)
- [`utz.collections`: collection/list helpers](#utz.collections)
- [`utz.env`: `os.environ` wrapper + `contextmanager`](#utz.env)
- [`utz.fn`: decorator/function utilities](#utz.fn)
Expand Down Expand Up @@ -96,6 +97,27 @@ pipeline(['seq 10', 'head -n5']) # '1\n2\n3\n4\n5\n'

See also: [`test_proc.py`].

#### [`utz.proc.aio`]: async [`subprocess`] wrappers <a id="utz.proc.aio"></a>
Async versions of most [`utz.proc`] helpers are also available:

```python
from utz.proc.aio import *
import asyncio
from asyncio import gather

async def test():
_1, _2, _3, nums = await gather(*[
run('sleep', '1'),
run('sleep', '2'),
run('sleep', '3'),
lines('seq', '10'),
])
return nums

asyncio.run(test())
# ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
```

### [`utz.collections`]: collection/list helpers <a id="utz.collections"></a>

```python
Expand Down Expand Up @@ -554,6 +576,7 @@ Some repos that use `utz`:
[`utz.plot`]: src/utz/plots.py
[`utz.pnds`]: src/utz/pnds.py
[`utz.proc`]: src/utz/proc/__init__.py
[`utz.proc.aio`]: src/utz/proc/aio.py
[`utz.process`]: src/utz/process/__init__.py
[`utz.setup`]: src/utz/setup.py
[`utz.size`]: src/utz/size.py
Expand Down
1 change: 1 addition & 0 deletions src/utz/proc/aio.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from utz.process.aio import *

0 comments on commit 4aba6cb

Please sign in to comment.