Registry / wimpy
library0.6pypypi✓ verified 87d ago

Wimpy is a Python utility library (anti-copy-pasta) containing commonly used helper functions that the author extracted to avoid repeatedly copying them into new projects. It provides a collection of small, general-purpose utilities for everyday Python programming tasks. The library is currently at version 0.6 and is actively maintained, with releases focusing on adding new features and improving existing ones.

pip install wimpy
INSTALL
IMPORT
SIG · WIMPY
W
wimpy
pythonv0.6
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.6 · 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.000s · 17.8MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

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

strip_prefix
from wimpy import strip_prefix
strip_suffix
from wimpy import strip_suffix
is_subsequence
from wimpy import is_subsequence
chunks
from wimpy import chunks
grouper
from wimpy import grouper
ceiling_division
from wimpy import ceiling_division
WimpyError
from wimpy.exceptions import WimpyError
from wimpy import WimpyError
WimpyError resides in the 'exceptions' submodule, not directly under 'wimpy'.

Demonstrates stripping prefixes, checking for subsequences, and creating overlapping chunks from an iterable, which are core utilities provided by the library.

from wimpy import strip_prefix, is_subsequence, chunks # Example 1: Stripping prefixes text = "hello_world" stripped_text = strip_prefix(text, "hello_") print(f"Original: {text}, Stripped: {stripped_text}") # Example 2: Checking for subsequence sequence = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] sub = [2, 5, 8] is_sub = is_subsequence(sub, sequence) print(f"Is {sub} a subsequence of {sequence}? {is_sub}") # Example 3: Chunking an iterable data = list(range(10)) chunk_size = 3 overlap = 1 result_chunks = list(chunks(data, chunk_size, overlap)) print(f"Original data: {data}, Chunks (size={chunk_size}, overlap={overlap}): {result_chunks}")
Debug
Known issues
gotchaThe `strip_prefix` and `strip_suffix` functions in v0.6+ introduce a `strict` parameter (default `False`). If `strict=True`, the function will raise a `WimpyError` if the prefix/suffix is not found. Prior to v0.6, there was no `strict` option, and missing prefixes/suffixes would simply return the original string.
fix
If you require an error for missing prefixes/suffixes, explicitly set `strict=True`. Otherwise, the default behavior of returning the original string when not found remains.
affects: 0.6 and later
gotchaThe `chunks` function had a bug in versions prior to v0.6 where negative `overlap` values were not handled correctly and could lead to unexpected results. This was fixed in v0.6.
fix
Upgrade to wimpy v0.6 or later to ensure correct handling of all `overlap` values, including negative ones.
affects: Prior to 0.6
gotchaThe `strip_prefix` and `strip_suffix` functions by default will silently return the original string if the specified prefix or suffix is not found. This might be unexpected if you anticipated an empty string or an error.
fix
Always check the return value, or for versions 0.6+, use `strict=True` if you prefer an explicit error when the prefix/suffix is absent.
affects: All versions
Errors
Common errors & fixes
from wimpy import WimpyError ModuleNotFoundError: No module named 'WimpyError'
The `WimpyError` exception is located in the `wimpy.exceptions` submodule, not directly in the top-level `wimpy` module.
fix
Change the import statement to `from wimpy.exceptions import WimpyError`.
wimpy.exceptions.WimpyError: Prefix 'non_existent_' not found in 'hello_world'
You are using `strip_prefix` or `strip_suffix` with `strict=True`, and the specified prefix/suffix was not present in the target string.
fix
Either ensure the prefix/suffix always exists, or handle the `wimpy.exceptions.WimpyError` exception, or remove `strict=True` to revert to the default behavior of returning the original string when the prefix/suffix is missing.
Upgrade
Version history
0.6latest on PyPI · released Oct 9, 2018
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
8
Resources
wimpy — pip install wimpy · libregistry