Hyperp - hyper productive utility functions for Python
Hyperp is a small utility library designed to simplify everyday coding tasks.
It embraces safe defaults over exceptions — for example, read() returns a default value if the file can't be read, helping you gracefully handle edge cases without extra boilerplate.
Purpose
I run a software consultancy where we build products for clients and internal projects.
To stay Hyper Productive (hence "hyperp"), I created this library to streamline development and encourage safer patterns.
It also helps my team write more robust code with minimal effort.
Need simple, beautiful software frontend, backend or design? Checkout BaunIT.com
General Utility Functions
Documentation by example
from hyperp import *
# to_int: Convert to int, or return default on failure
to_int("42", 0) # 42
to_int("x", 0) # 0
to_int(None, -1) # -1
# is_int: Check if input is an integer
is_int("123") # True
is_int("abc") # False
# is_float: Check if input is a float
is_float("3.14") # True
is_float("hello") # False
# is_ip4: Check if input is a valid IPv4 address
is_ip4("192.168.1.1") # True
is_ip4("999.999.0.1") # False
# mkdir: Create a directory and all parents if needed
mkdir("path/to/dir")
# mkdir_file: Create parent directories for a file path
mkdir_file("logs/output.log") # Creates the 'logs' directory if missing
# write: Write string data to a file, creating dirs if needed
write("out/data.txt", "hello world")
# read: Read a file, return default on error
read("out/data.txt", "default") # "hello world" or "default" if not found
# rmdir: Remove a directory and its contents, ignore errors
rmdir("path/to/remove")
# sanitize: Make filename safe for storage/use
sanitize("my*unsafe:file?.txt") # "myunsafefile.txt"
# send_file: Upload file to a URL as multipart/form-data
send_file("https://example.com/upload", "report.pdf") # Returns dict with msg and response
# download: Download file from URL to disk, streaming for efficiency
download("https://example.com/image.jpg", "images/photo.jpg") # Returns "images/photo.jpg"
download("https://bad-url.com/file.pdf", "out.pdf", "") # Returns "" on error
# throttle_call: Limit function execution to once per N seconds
def load_data():
return fetch_from_api()
throttle_call(load_data, 5) # Executes
throttle_call(load_data, 5) # Returns None (too soon)
time.sleep(5)
throttle_call(load_data, 5) # Executes again
# timer: Decorator to measure function execution time
@timer
def slow_function():
time.sleep(1)
return "done"
slow_function() # Prints: "slow_function took 1.0001 seconds"
Django specific
Documentation by example
from hyperp.django import *
# cache: Shorthand for Django's cache_control with flexible time units
@cache(seconds=30, minutes=5, hours=1, days=1, public=False)
def my_view(request):
...
# get_csrf: Return CSRF token input element for forms
def form_view(request):
csrf = get_csrf(request)
return HttpResponse(f"<form>{csrf}<input name='x'></form>")
# get_ip: Extract client IP address from request headers
def log_request(request):
ip = get_ip(request)
# Use the IP (e.g., for logging, rate limiting, etc.)
Metadata
Release files for hyperp 1.0.15
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hyperp-1.0.15.tar.gz | 8.3 kB | Without provenance | Details for hyperp-1.0.15.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hyperp-1.0.15-py3-none-any.whl | Python 3 | none | any | Details for hyperp-1.0.15-py3-none-any.whl |
Total release size: 17.4 kB
Release files / hyperp-1.0.15.tar.gz
| Download URL | hyperp-1.0.15.tar.gz |
|---|---|
| Size | 8.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b7bac013722b0da3ac5b8683436a5f01241f2c375311a74b1075516cee715d2f
|
|
BLAKE2b-256 checksum How to use checksums |
020dcc78d1f6b951b310672cdc8084988764d063ac17f41cf3416bd04af764b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / hyperp-1.0.15-py3-none-any.whl
| Download URL | hyperp-1.0.15-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
55d8aa73fe8059e7b38b2c793bd18505d376816ac50097e8817b1f46e701a718
|
|
BLAKE2b-256 checksum How to use checksums |
38bd1f5553b07e65108c781d504535d6f7847a6c589df76074fbe5bc7a4d9cab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Security for hyperp 1.0.15
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.