Install & Compatibility
Where this runs
tested against v0.1.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
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.056s · 18.9MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 1.7s · import 0.052s · 19MB
17MB installed
● package 17MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Ls
✓ from pygnuutils.ls import Ls
✗ from pygnuutils import ls
Utilities are exposed as classes within their respective modules (e.g., 'ls' utility is 'Ls' class in 'pygnuutils.ls').
Basename
✓ from pygnuutils.basename import Basename
Similar pattern for other utilities like 'Basename', 'Basenc', 'Yes', 'Filevercmp'.
This quickstart demonstrates how to initialize and use the `Ls` utility to emulate `ls` commands with Pythonic arguments. It also includes an advanced example of dependency injection, a core feature of `pygnuutils`, to customize behavior like symlink resolution.
from pygnuutils.ls import Ls
# Instantiate the Ls utility
ls = Ls()
# List contents of the current directory, similar to 'ls -a'
print("Current directory (ls -a):")
ls('.', all_=True) # Note: 'all_' for '-a' argument
# List contents of a specific directory in long format, similar to 'ls -l /tmp'
print("\n/tmp directory (ls -l):")
ls('/tmp', long=True)
# Example with dependency injection (a key feature mentioned in README)
import os
class ReadlinkWatch(Ls.stub):
def readlink(self, path, dir_fd=None):
print(f'Resolving symlink: {path}...')
return os.readlink(path, dir_fd=dir_fd)
ls_with_watch = Ls(stub=ReadlinkWatch())
print("\nListing with symlink watcher:")
# This might require creating a symlink in /tmp for demonstration
# Example: os.symlink('/etc/passwd', '/tmp/mylink')
# For safe execution, we won't create it here, but demonstrate the call.
try:
ls_with_watch('/tmp', long=True)
except OSError as e:
print(f"Could not complete symlink watch example: {e}")
print("To run, ensure you have symlinks in /tmp or create one, e.g., 'os.symlink('/etc/passwd', '/tmp/mylink')'")
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pygnuutils'
The `pygnuutils` package is not installed in the active Python environment.
fixRun `pip install pygnuutils` to install the library.
TypeError: Ls() got an unexpected keyword argument 'some_flag'
You are attempting to pass a command-line style flag (e.g., `-R`) directly as a keyword argument, but the Python wrapper expects a specific Pythonic argument name (e.g., `recursive=True`).
fixCheck the `pygnuutils` source code or documentation for the specific utility to find the correct Python keyword argument. For `Ls`, common arguments include `all_`, `long`, `recursive`, etc.
Upgrade
Version history
0.1.1latest on PyPI · released May 12, 2023
Audit
Dependencies
No dependency data recorded yet.