Skip to main content

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

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.12

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

Source distribution (sdist)

Source distribution for hyperp 1.0.12
File Size Uploaded
hyperp-1.0.12.tar.gz 7.4 kB Details

Built distribution (wheel)

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

Total release size: 15.4 kB

Release files / hyperp-1.0.12.tar.gz

Download URL hyperp-1.0.12.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ca5deeb508d1647ac4dac5fb8dbc29ca97930bf5ccac30117513e59765a12e1b
BLAKE2b-256 checksum
How to use checksums
cbfdd3bb1204437b9ba869fcdd70f4cf081d669302d4309e9450f88006309102
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.12-py3-none-any.whl

Download URL hyperp-1.0.12-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee2e4c2dfc6c9cb75abac21012638869c91e9a8ad0ecbf5b6396d3627a61b263
BLAKE2b-256 checksum
How to use checksums
f1b5a83b9f9c321da60ef5c99896d0c0934311b7df11cd1dde4cbf68152437fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release history Release notifications | RSS feed

1.0.15

2 release files

1.0.14

2 release files

1.0.13

2 release files

This release

1.0.12 This release

2 release files

1.0.11

2 release files

1.0.7

2 release files

1.0.5

2 release files

1.0.4

2 release files

0.1.26

2 release files

0.1.25

2 release files

0.1.23

2 release files

0.1.22

2 release files

0.1.21

2 release files

0.1.20

2 release files

0.1.19

2 release files

0.1.18

2 release files

0.1.17

2 release files

0.1.16

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

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