Privex Python Helpers’s documentation

Privex Logo

Welcome to the documentation for Privex’s Python Helpers - a small, open source Python 3 package containing a variety of functions, classes, exceptions, decorators and more - each of which would otherwise be too small to maintain in an individual package.

This documentation is automatically kept up to date by ReadTheDocs, as it is automatically re-built each time a new commit is pushed to the Github Project

Quick install

Installing with Pipenv (recommended)

pipenv install privex-helpers

Installing with standard pip3

pip3 install privex-helpers

Python Module Overview

Privex’s Python Helpers is organised into various sub-modules to make it easier to find the functions/classes you want to use, and to avoid having to load the entire module (though it’s lightweight).

With the exception of privex.helpers.django (Django gets upset if certain django modules are imported before it’s initialised), all functions/classes are imported within the __init__ file, allowing you to simply type:

from privex.helpers import empty, run_sync, asn_to_name

Instead of having to import the functions from each individual module:

from privex.helpers.common import empty
from privex.helpers.asyncx import run_sync
from privex.helpers.net import asn_to_name

Below is a listing of the sub-modules available in privex-helpers with a short description of what each module contains.

privex.helpers.asyncx

Functions and classes related to working with Python’s native asyncio support

privex.helpers.black_magic

This module contains somewhat risky code that uses app introspection e.g.

privex.helpers.cache

Helper functions/classes related to caching.

privex.helpers.common

Common functions and classes that don’t fit into a specific category

privex.helpers.collections

Functions, classes and/or types which either are, or are related to Python variable storage types (dict, tuple, list, set etc.)

privex.helpers.converters

Various functions/classes which convert/parse objects from one type into another.

privex.helpers.crypto

Cryptography related helper classes/functions

privex.helpers.decorators

Class Method / Function decorators

privex.helpers.django

This module file contains Django-specific helper functions, to help save time when developing with the Django framework.

privex.helpers.exceptions

Exception classes used either by our helpers, or just generic exception names which are missing from the standard base exceptions in Python, and are commonly used across our projects.

privex.helpers.extras

Various helper functions/classes which depend on a certain package being installed.

privex.helpers.geoip

Various helper functions for use with Maxmind’s GeoIP2 Library

privex.helpers.net

Network related helper code

privex.helpers.plugin

This module handles connection objects for databases, APIs etc.

privex.helpers.settings

Configuration options for helpers, and services they depend on, such as Redis.

privex.helpers.setuppy

Helpers for setup.py, e.g.

privex.helpers.thread

Helper functions and classes to ease the use Thread’s with python’s threading library

privex.helpers.types

All Documentation

Code Documentation:

Unit Testing