Skip to main content

logo

qsu - Quick & Simple Utility

PyPI version PyPI downloads PyPI python versions license test

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 qsu package — no submodule spelunking, no classes to instantiate.
  • Cheap to import. Categories and functions are resolved on first access (PEP 562), so import qsu does not drag in cryptography, subprocess and urllib for code that never touches them.
  • Typed. The package ships a py.typed marker 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,
    arrChunk,
    duration,
    numberFormat,
    objPick,
    strToCamelCase,
    truncate,
    isEmail,
    md5Hash,
)

# Lists
arrUnique([1, 1, 2, 3, 3])  # [1, 2, 3]
arrChunk([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, arrChunk, sortNatural
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 numSum, clamp, numRound, numRandom
misc qsu.misc debounce, throttle, retry, sleep
net qsu.net fetchData, parseAddress
object qsu.object objClone, objMerge, objPick, objGet
os qsu.os getCpuModel, getRamSize, runCommand
string qsu.string collapseWhitespace, truncate, strToCamelCase, pad
verify qsu.verify isEmail, isUrl, isEmpty, isEqualLoose
web qsu.web getSlug, escapeHtml, isMobileDeviceFromUa, isBot

The verify category provides len. Importing that name directly shadows the Python builtin for the rest of the module, so reach for it as qsu.len(...) — or import it 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.

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.

Metadata

Release files for qsu 1.100.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qsu 1.100.0
File Size Uploaded Provenance Actions
qsu-1.100.0.tar.gz 103.1 kB With provenance Details for qsu-1.100.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for qsu 1.100.0
File Interpreter ABI Platform Actions
qsu-1.100.0-py3-none-any.whl Python 3 none any Details for qsu-1.100.0-py3-none-any.whl

Total release size: 266.7 kB

Release files / qsu-1.100.0.tar.gz

Download URL qsu-1.100.0.tar.gz
Size 103.1 kB
Tags Source
SHA-256 checksum
How to use checksums
08ede340745da1b232e99f371131cef9c98352acd4871056e70b3c06ec489637
BLAKE2b-256 checksum
How to use checksums
cbaa84a59a898b9ea00988b4fe9ef8de32e9599240df5db515212296e8d32f58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / qsu-1.100.0-py3-none-any.whl

Download URL qsu-1.100.0-py3-none-any.whl
Size 163.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a8245d8e77a5eea21b276f19993049d36186fa29049f7256798c48ca13886d4c
BLAKE2b-256 checksum
How to use checksums
e0c28c887d687baf184279467cebd103afec862d501e64b5250f2350274d9bc6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Security for qsu 1.100.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for qsu-1.100.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page