Skip to main content

Overview

package

PyPI Package latest release

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.

Installation

pip install generic_utils

Development

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
127.0.0.1:6379> SET __THIS_IS_A_TEST_INSTANCE__ True
OK
127.0.0.1:6379> 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/local_settings.py (not in version-control). Replace the values with appropriate values for your environment:

CQLENGINE = {
    "TEST_CLUSTER": {
        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=""),
        ConfigKey.DEFAULT_TIMEOUT: EXPLICTLY_NOT_10_SECONDS_TIMEOUT
    }
}

Run the test suite:

nosetests tests

Or, using tox:

tox

Release files for generic-utils 0.20.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 generic-utils 0.20.0
File Size Uploaded
generic_utils-0.20.0.tar.gz 122.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for generic-utils 0.20.0
File Interpreter ABI Platform
generic_utils-0.20.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 251.3 kB

Release files / generic_utils-0.20.0.tar.gz

Download URL generic_utils-0.20.0.tar.gz
Size 122.7 kB
Tags Source
SHA-256 checksum
How to use checksums
bae1de39da3d98fc2ebf390ed1034945772da41866953f236590e6ad4a8e2cf6
BLAKE2b-256 checksum
How to use checksums
6902e6461ee90cb98b0341e1412d3179f6c0990c738ca5114bbcf2b4fbbe0d4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / generic_utils-0.20.0-py2.py3-none-any.whl

Download URL generic_utils-0.20.0-py2.py3-none-any.whl
Size 128.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
87977c332841ae30013dffd807b8d2f7bbfd65a066f0f8b931da20e94b93b498
BLAKE2b-256 checksum
How to use checksums
42db5d5c9956745a343895ddee93d79d686216cf9550d46452b5950c9f820f7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.20.0 This release

2 release files

0.19.1

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