Registry / devops / runez
library5.9.1pypypi✓ verified 87d ago

Runez is a friendly, pure Python convenience library offering utilities for common operations such as file manipulation, process execution, and logging that developers often find themselves rewriting. It stands alone without external dependencies, focusing on robust handling of edge cases and providing clear error reporting. The current version is 5.7.1, with a regular release cadence.

pip install runez
INSTALL
IMPORT
SIG · RUNEZ
R
runez
devopspythonv5.9.1
Install
1.7s avg
Import
168ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v5.9.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.173s · 18.7MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.7s · import 0.164s · 19MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

runez
import runez

This quickstart demonstrates how to execute shell commands and perform basic file operations using `runez`. It shows handling both successful and potentially failing commands, as well as writing to and reading from a file.

import runez import os # Example 1: Running a command print("--- Running a command ---") try: output = runez.run("echo", "Hello from runez!", capture_output=True) print(f"Command output: {output.strip()}") # Example of a command that might fail gracefully print("\n--- Running a command that might fail (fatal=False) ---") result = runez.run("this-command-does-not-exist", fatal=False, capture_output=True) if result is False: print("Command failed gracefully as expected.") else: print("Unexpected success or output:", result) except Exception as e: print(f"Error running command: {e}") # Example 2: File operations print("\n--- File operations ---") filename = "my_runez_file.txt" if os.path.exists(filename): runez.delete(filename) runez.write(filename, "First line\nSecond line\n") print(f"Content written to {filename}") content = runez.readlines(filename) print(f"Content read from {filename}: {content}") runez.delete(filename) print(f"Deleted {filename}")
Debug
Known issues
gotchaMany `runez` functions are 'fatal by default.' They will raise an exception on failure, logging a meaningful error. To prevent this and instead return a status or default value, use `fatal=False` for process-related functions (e.g., `runez.run`) or provide a `default` parameter for IO-related functions (e.g., `runez.readlines`).
fix
Pass `fatal=False` or `default=None` (or another default value) to functions where you want to explicitly handle potential failures without an exception.
affects: All versions
gotchaThe `logger` parameter in `runez` functions (and global `runez.log.setup()`) offers granular control over logging. Its default (`UNSET`) typically logs at debug level, `logger=None` disables all logging (including errors), and `logger=False` logs only errors. Ensure you understand its impact on your application's logging verbosity.
fix
Review the `logger` parameter's documentation for specific functions and configure `runez.log.setup()` to match your desired logging behavior and verbosity.
affects: All versions
gotchaRunez provides a powerful `dryrun` mode, which, when enabled, simulates actions without performing them. While useful for testing, ensure that `runez.DRYRUN` is `False` or that you explicitly pass `dryrun=False` to functions in production environments where actual operations are intended.
fix
Explicitly manage `runez.DRYRUN` or pass `dryrun=False` to functions to ensure actions are performed when not in a testing context.
affects: All versions
Upgrade
Version history
5.9.1latest on PyPI · released May 5, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
runez — pip install runez · libregistry