Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

A set of generic utility classes and helper functions for Python development.

Project Description


A set of generic utility classes and helper functions for Python development.

generic_utils is a set of generic Python utilities which currently target Python 2.7.X environments with no other required dependencies. The code targets both general production code as well as test utilities to facilitate easier test generation, management and complexity.

This library is not currently intended to be generally useful to the community at large as there is work to be done to provide greater Python support as well as general documentation and upkeep, but has been used successfully in production environments within the prescribed environments.


pip install generic_utils


Install requirements into a local virtualenv:

virtualenv env
env/bin/pip install -e ".[html,cassandra,celery_test,test_utils]"

This project requires available cassandra and redis hosts in order to run the full test-suite.

Redis Setup:

docker run -d --name test-redis -p 6379:6379 -v /path/to/storage/redis:/data redis

Connect to the container:

$ docker exec -i -t test-redis /bin/bash
$ root@7a3377df67f0:/data# redis-cli> SET __THIS_IS_A_TEST_INSTANCE__ True
OK> exit

Cassandra Setup:

$ docker run --name test-cassandra -d -p 9042:9042 -p 7000:7000 -v /path/to/storage/cassandra:/var/lib/cassandra cassandra:3.0

Connect to the container:

$ docker exec -i -t test-cassandra /bin/bash

Open cqlsh and create the python_utils_test keyspace:

$ cqlsh
> CREATE KEYSPACE python_utils_test WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1} AND DURABLE_WRITES = true;

Configure Cassandra cluster in tests/ (not in version-control). Replace the values with appropriate values for your environment:

        ConfigKey.CONTACT_POINTS: get_config_value("TEST_CASSANDRA_CONTACT_POINTS", default=["localhost"]),
        ConfigKey.KEYSPACE: get_config_value("TEST_CASSANDRA_KEYSPACE", "python_utils_test"),
        ConfigKey.PORT: get_config_value("TEST_CASSANDRA_PORT", default=9042),
        ConfigKey.USERNAME: get_config_value("TEST_CASSANDRA_USERNAME", default=""),
        ConfigKey.PASSWORD: get_config_value("TEST_CASSANDRA_PASSWORD", default=""),

Run the test suite:

nosetests tests

Or, using tox:


Release History

This version
History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(128.6 kB) Copy SHA256 Hash SHA256
Wheel py2.py3 Dec 19, 2016
(122.7 kB) Copy SHA256 Hash SHA256
Source None Dec 19, 2016

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting