semvec/pypi-packages huggingface dataset:
gxredis 0.3.2
Simple redis-py wrapper library
License: MIT
Keywords: Redis,key-value store

gxredis
=======

Simple `redis-py <https://redis-py.readthedocs.io/en/latest/>`_ wrapper library

Installation
------------

To install gxredis, simply:

.. code-block:: bash

    $ sudo pip install gxredis


Usage
-----

.. code-block:: pycon

    >>> import redis
    >>> from gxredis import *

    >>> class ItemDao(RedisDao):
    >>>        item = RedisString("device:{device_id}:item:{item_id}")
    >>>        item_list = RedisList("device:{device_id}:list")
    >>>        item_set = RedisSet("device:{device_id}:set")
    >>>        item_hash = RedisHash("device:{device_id}:hash")
    >>>        item_zset = RedisSortedSet("device:{device_id}:zset")

    >>> client = redis.StrictRedis("localhost", 6379, 15)
    >>> dao = ItemDao(client, key_params={"device_id": "GX123"})

    >>> dao.item
    RedisString(key="device:{device_id}:item:{item_id}", key_params={'device_id': 'GX123'})

    >>> dao.item_list
    RedisList(key="device:{device_id}:list", key_params={'device_id': 'GX123'})

    >>> dao.item(item_id=1).set("item01")
    True

    >>> dao.item(item_id=1).get()
    'item01'

    >>> pipe = dao.pipeline()
    >>> accr1 = pipe.item(item_id=1)     # accessor for item01
    >>> accr2 = pipe.item(item_id=2)     # accessor for item02
    >>> accr1.set("item01")
    >>> accr2.set("item02")
    >>> pipe.item_list.rpush(accr1.key)
    >>> pipe.item_list.rpush(accr2.key)
    >>> pipe.execute()

    >>> dao.item_list.lrange(0, 100)
    ['device:GX123:item:1', 'device:GX123:item:2']


LICENSE
-------

- MIT
aws-utilities 1.3.1
Utilities for use with aws.
License: MIT
Requires Python: >=3.6,<4.0

# aws-utilities

This package includes various command-line utilities for use with aws.

## Installation
### pip
```
pip install aws-utilities
```

### pipx
```
pipx install aws-utilities
```

### git
To set up a local checkout with [pyenv](https://github.com/pyenv/pyenv) run these commands:
```
git clone https://github.com/reversefold/aws-utilities.git
cd aws-utilities
pyenv virtualenv 3.6.5 aws-utilities
pyenv local aws-utilities
pip install -r dev-requirements.txt
./sync-requirements.sh
```

## Scripts
### tail_cloudwatch_logs.py

Get the last `n` lines of a cloudwatch log group and follow the output in realtime as it is written to CloudWatch Logs. Has the ability to use any profile set up in your `~/.aws/credentials` so working across multiple accounts is easy.

Inspired by [cw](https://github.com/lucagrulla/cw).


### tail_stack_events.py

Get the last `n` events for a CloudFormation stack and all of its nested stacks and follow the events in realtime. This utility can give you a view into all of the events happening in any size CloudFormation stack, even if it has multiple levels of nested stacks. When this script is started up it finds all nested stacks and follows their events as well if the stack is in any status which includes IN_PROGRESS. When following stack events, nested stacks will be dynamically added to and removed from the set of stacks being queried for events as nested stacks go into the various `IN_PROGRESS` and `COMPLETE` states. This lets you get a complete picture of what is going on while also making the minimum number of API calls.

In postmortem mode this script will find the events that caused the last stack update to fail. It will follow nested stack failures until it finds the specific resource that caused the failure.

Originally inspired by [tail-stack-events](https://github.com/tmont/tail-stack-events) and [cfn-tail](https://github.com/taimos/cfn-tail).


### aws_switch.py

A quick and dirty script to make any one of your configured aws profiles the default profile. Useful when you're using tools which don't support profiles or when you work in distinct profiles at distinct times.


### wait_for_stack_complete.py

A simple script for running on an ec2 instance. No parameters are taken. Finds the CloudFormation stack that the instance resides in and polls until the stack is in a `COMPLETE` state. If the stack has a parent stack it will watch that one instead. Has retries with exponential backoff (up to 5m) for all API calls so as to not overload the AWS APIs when used in a large environment. This script is particularly useful for UserData or cfn-init scripts which need to wait for other resources to be created and attached, such as EBS volumes not included in the instance's BlockDeviceMapping.