qsu - Quick & Simple Utility
qsu is a library that collects frequently used utility functions — slugs, text case, date math, number and file size formatting, deep clone and merge, validation, hashing, file and OS helpers. Stop rewriting the same small helpers in every project.
from qsu import getSlug, fileSizeFormat, objMerge
getSlug('Hello World!') # 'hello-world'
fileSizeFormat(1000000) # '976.56 KB'
objMerge({'a': {'b': 1}}, {'a': {'c': 2}}) # {'a': {'b': 1, 'c': 2}}
Why qsu
- Flat, one-import API. Every function is available straight from the top-level
qsupackage — no submodule spelunking, no classes to instantiate. - Cheap to import. Categories and functions are resolved on first access (PEP 562), so
import qsudoes not drag incryptography,subprocessandurllibfor code that never touches them. - Typed. The package ships a
py.typedmarker and full annotations, so mypy and other checkers follow every name to the function behind it. - Predictable. Arguments are validated and edge cases —
None, empty values, nested lists, non-string input — return a sensible result instead of raising. - Tested. The suite runs on Python 3.9, 3.11 and 3.13 across Linux, macOS and Windows in CI.
Function names are camelCase rather than snake_case. That is deliberate: qsu keeps one API shape across every language it ships in, so getSlug is getSlug wherever you use it.
Installation
qsu requires Python 3.8 or later.
pip install qsu
qsu is published to PyPI, so modern package managers such as uv, Poetry and PDM install it from their default index without any extra configuration:
uv add qsu
poetry add qsu
pdm add qsu
If you use uv outside of a project — in a plain virtual environment, for example — use the pip-compatible command instead:
uv pip install qsu
The only runtime dependency is cryptography, used by the encrypt and decrypt helpers. It is imported the first time one of them is used, not at import qsu.
How to use
Import the functions you need directly from qsu:
from qsu import capitalizeFirst, strCount
print(capitalizeFirst('abcd')) # 'Abcd'
print(strCount('123412341234', '1')) # 3
You can also import a single category, or the package as a whole:
from qsu.string import truncate
from qsu.web import getSlug
import qsu
qsu.today() # '20xx-xx-xx'
Options: keyword arguments or a dict
Functions with optional settings accept them either as keyword arguments or as a single dict. Both forms behave identically, so pick whichever reads better at the call site:
pad('7', 3, char='0', position='start') # '007'
pad('7', 3, {'char': '0', 'position': 'start'}) # '007'
Examples
from qsu import (
arrUnique,
arrGroupByMaxCount,
duration,
numberFormat,
objPick,
strToCamelCase,
truncate,
isEmail,
md5Hash,
)
# Lists
arrUnique([1, 1, 2, 3, 3]) # [1, 2, 3]
arrGroupByMaxCount([1, 2, 3, 4, 5], 2) # [[1, 2], [3, 4], [5]]
# Formatting
numberFormat(1234567) # '1,234,567'
duration(1234567890) # '14 Days 6 Hours 56 Minutes 7 Seconds'
# Dicts
objPick({'a': 1, 'b': 2, 'c': 3}, ['a', 'c']) # {'a': 1, 'c': 3}
# Strings
strToCamelCase('foo bar') # 'fooBar'
truncate('Hello world', 5, '...') # 'Hello...'
# Validation and hashing
isEmail('abc@example.com') # True
md5Hash('test') # '098f6bcd4621d373cade4e832627b4f6'
API overview
Functions are grouped into categories. Each one is importable from the top-level package or from its own module.
| Category | Module | Examples |
|---|---|---|
array |
qsu.array |
arrUnique, arrGroupByMaxCount, sortNumeric |
crypto |
qsu.crypto |
md5Hash, sha256Hash, encodeBase64, objectId |
date |
qsu.date |
today, dayDiff, createDateListFromRange |
file |
qsu.file |
getFileSize, moveFile, joinFilePath |
format |
qsu.format |
numberFormat, fileSizeFormat, duration |
math |
qsu.math |
sum, clamp, round, numPick |
misc |
qsu.misc |
debounce, throttle, retry, sleep |
net |
qsu.net |
fetchData |
object |
qsu.object |
objClone, objMerge, objPick, objGet |
os |
qsu.os |
getCpu, getRamSize, runCommand |
string |
qsu.string |
trim, truncate, strToCamelCase, pad |
verify |
qsu.verify |
isEmail, isUrl, isEmpty, isEqual |
web |
qsu.web |
getSlug, escapeHtml, isMobile, isBotAgent |
The math category provides sum, min, max, round, floor and ceil. Importing those names directly shadows the Python builtins for the rest of the module, so reach for them as qsu.sum(...) — or import them under an alias — when you need both.
Documentation
Installing and using the package and defining all the utility methods can be found on the documentation page below.
- Installation
- Reference — every function, with parameters, defaults and examples
- Changelog
Development
The package lives in the qsu monorepo under packages/python. Source is one function per file, in qsu/<category>/<functionName>.py.
pip install -e ".[dev]" # install with test and type-check dependencies
pytest # run the test suite
mypy # type check
Contributing
Anyone can contribute to the project by reporting new issues or submitting a pull request. For more information, please see CONTRIBUTING.md.
License
Please see the LICENSE file for more information about project owners, usage rights, and more.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qsu-1.3.0.tar.gz.
File metadata
- Download URL: qsu-1.3.0.tar.gz
- Upload date:
- Size: 54.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f11c5edd00b08f0be8807bc45e3a9646a662a2b20c1610c467dafbb74ee05e01
|
|
| MD5 |
e4f788412da12836b81be8dd1c6f124d
|
|
| BLAKE2b-256 |
da3f592f59cd8a5a2b091dffdc21481abcc932730bce9cdf02c7bd9234218149
|
File details
Details for the file qsu-1.3.0-py3-none-any.whl.
File metadata
- Download URL: qsu-1.3.0-py3-none-any.whl
- Upload date:
- Size: 100.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ef626fecb573ae5594c108395caebc1bb1131e0508035fae913c4586b1ea5b5
|
|
| MD5 |
9f56187dab6c777118a894048c22c831
|
|
| BLAKE2b-256 |
94b82d76825af0b9c7ebab5a837a107df0522b41538af502ca6744e903e7ba4e
|