Saravanan666/pypi-org huggingface dataset:
Package: redis-cooker
redis-cookerAn redis python datastructures packageInstallationTo install redis-cooker, simply:$ pip install redis-cookeror from source:$ python setup.py installGetting Started>>> from redis_cooker.clients import set_connection_url
>>> from redis_cooker.collections import RedisList
>>>
>>> set_connection_url('redis://:@127.0.0.1:6379/15')
>>> for i in RedisList("Testing:RedisList", init=['Hello', 'World']):
>>>     print(i)
Hello
WorldBy default, all data will use the built-in json serializer.Attention!If the key has existed in Redis, new object will connect to the existed key and ignore the "init" value.For complex operations, redis-cooker uses lua instead of python.Datastructuresredis-cooker provide 6 datastructures in current version:collections: RedisMutableSet, RedisString, RedisList, RedisDict, RedisDeque, RedisDefaultDictothers: ABNTestIntegration with Pydantic>>> from typing import List
>>>
>>> from pydantic import BaseModel
>>> from redis_cooker.clients import set_connection_url
>>> from redis_cooker.collections import RedisList
>>>
>>> set_connection_url('redis://:@127.0.0.1:6379/15')
>>>
>>>
>>> class Person(BaseModel):
        name: str
        age: int
>>>
>>>
>>> data = [{"name": "A", "age": 15},{"name": "B", "age": "16"}]
>>> for i in RedisList("Testing:Pydantic", init=data, schema=Person):
>>>     print(i)
{'name': 'A', 'age': 15}
{'name': 'B', 'age': '16'}Integration with DRF Serializer>>> from typing import List
>>>
>>> from rest_framework import serializers
>>> from redis_cooker.clients import set_connection_url
>>> from redis_cooker.collections import RedisList
>>>
>>> set_connection_url('redis://:@127.0.0.1:6379/15')
>>>
>>>
>>> class DRFPerson(serializers.Serializer):
        name = serializers.CharField()
        age = serializers.IntegerField()
>>>
>>>
>>> data = [{"name": "A", "age": 15},{"name": "B", "age": "16"}]
>>> for i in RedisList("Testing:DRF", init=data, schema=DRFPerson):
>>>     print(i)
OrderedDict([('name', 'A'), ('age', 15)])
OrderedDict([('name', 'B'), ('age', 16)])Use ABNTest in your internal A/B Test>>> from redis_cooker.abn_test import ABNTest, Choice
>>> from redis_cooker.clients import current_redis_client, set_connection_url
>>>
>>> set_connection_url('redis://:@127.0.0.1:6379/15')
>>> client = current_redis_client()
>>>
>>> topic = "lead comment"
>>> choices = [Choice(name="A", value=5), Choice(name="B", value=5), Choice(name="C", value=2)]
>>> abn_test = ABNTest(topic, choices)
>>> choice = abn_test.fetch()
Package: redis_dashboard
django_redis_dashboard application for monitoring redis servers which
used by application.UsageINSTALLATIONTo use django_redis_dashboard  use pip or easy_install:pip install django_redis_dashboardoreasy_install django_redis_dashboardAdd redis_dashboard to yourINSTALLED_APPSsetting:INSTALLED_APPS = (
    # ...
    'redis_dashboard',
)Add the urls to your url configuration:urlpatterns = patterns('',
    # ...
    (r'^redis-dashboard/', include('redis-dashboard.urls')),
)Configure you redis servers:REDIS = {
     'default': {
                'HOST': '127.0.0.1',
            'PORT': 6379,
            'DB': 2
             },
     'slave': {
                    'HOST': '127.0.0.1',
            'PORT': 6378,
                            'DB': 3
     }
}CONTRIBUTEForkhttps://github.com/Lispython/django-redis-dashboard/, create commit and pull request.SEE ALSOpython pypi.
Package: redis-data-transfer
Redis data transfer toolAn easy-to-use tool to transfer data between redis servers or clusters.Installationpip install redis-data-transferUsageThe command line structure is quite simple:redis-data-transfer [options] your.source.server your.destination.serverFor details about the options available:redis-data-transfer --helpConceptsThe implementation is made around a pipeline system with queues and subprocesses. The user can
control the number of parallel subprocesses for each step of the pipeline:A single scanner reads all keys from the source.Checkers look in the destination and filter out any key that already exists. They can be disabled
if desired.Readers fetch the content of each key from the source.Writers store the content for each key in the destination.DevelopmentThe code ishosted on github.
The repository usespoetryfor packaging.
The project usestoxfor testing.
Package: redis-decorator
Quick startInstallpipinstallredis_decoratorInitializefromredis_decimportCachefromredisimportStrictRedisredis=StrictRedis(decode_responses=True)cache=Cache(redis)ExamplesMake sure you have redis up and running.(https://redis.io/)Example1 : Cache string returnfromtimeimportsleepfromdatetimeimportdatetime@cache.ttl(300)defpseudo_calc():sleep(1)print("Computation in progress")returnstr(datetime.now())foriinrange(10):print(pseudo_calc())Example 2: Cache Pandas Dataframe# Set cache's time to live to 300 seconds (expires in 300 seconds)# If left blank, e.g. @cache.df(), cache will stay forever. Don't recommended.importpandasaspd@cache.df(300)defreturn_a_df(*args,**kwargs):sleep(1)print("Computation in progress")returnpd.DataFrame({"time":[str(datetime.now())for_inrange(5)],"foo":list(range(5))})foriinrange(5):print(return_a_df(1,5))Example 3: Cache dict@cache.dict(60)defreturn_a_dict(*args,**kwargs):sleep(1)print("Computation in progress")return{"now":str(datetime.now())}foriinrange(5):print(return_a_dict())Example 4: Cache float number@cache.float(60)defreturn_a_float(*args,**kwargs):returnrandom()foriinrange(5):print(return_a_float())Delete Cache# Delete cache by function and signaturecache.delete_cache(return_a_float,2,b=3)# Delete cache by functioncache.delete_cache(return_a_float)# Delete all cachescache.delete_cache()
Package: redis-distributed-lock
Redis Distributed LockRedis distributed lock for python3, using setnx and lua script,
provide block and no-block functionInstallpip install redis-distributed-lockUsagefromredis_distributed_lockimportRDLockimportredisredisconn=redis.Redis(host="127.0.0.1",port=6379,decode_responses=True)lock=RDLock(redisconn)# Prevent CPU consumption all the time,# specify the sleeptime for block mode (default 100 millsec)lock=RDLock(redisconn,sleeptime=1000)# Specify lock prefix name (default: lock_)lock=RDLock(redisconn,prefix="lock_")# Using block method, default timeout is 0 (second)# default key expire is 5000 millseckey="key"try:iflock.acquire(key,expire=3000,timeout=2):# Do somethingpassfinally:lock.release(key)# Using No-block methodlock.acquire_no_block(key)
Package: redis-docker-harness
Classes and methods for integrating code inside a docker image into a processing pipeline, using redis for exchanging data.Changelog0.0.4 (2023-07-25)added theredis_timeoutparameter to the argparse options to make the pubsub threadsleep_timeparameter
configurable from the command-line (the default is now 0.01 instead of 0.001 to avoid high CPU load)thecreate_parsermethod can now specify the default values for: host, port, db, channel_in, channel_out, sleep_time0.0.3 (2023-07-10)fixed password support when accessing environment variable0.0.2 (2023-07-07)added support for supplying a password to use for the Redis connection (–password/–password_env)0.0.1 (2021-09-22)initial release
Package: redisdol
redisdolredis with a simple (dict-like or list-like) interfaceTo install:pip install redisdolProvides acollections.abc.MutableMapping(i.e. dict-like) interface to Redis.Note that Redis automatically converts everything to bytes when writing, which means that
read and write are not inverse of each other in the base RedisPersister.
A serialization/deserialization layer can be added to make read and write consistent.>>>fromredisdolimportRedisBytesPersister>>>s=RedisBytesPersister()# plenty of params possible (all those of redis.Redis), but taking defaults.>>>>>># clear the kehys we'll be using>>>keys=['_pyst_test_str','_pyst_test_int','_pyst_test_float']>>>forkinkeys:...dels[k]>>>>>>before_length=len(s)>>>>>>s['_pyst_test_str']='hello'>>>s['_pyst_test_str']# note you won't be getting a str but bytesb'hello'>>>>>>'_pyst_test_str'ins>>>>>># numbers are converted to strings then bytes>>>s['_pyst_test_int']=42>>>asserts['_pyst_test_int']==b'42'>>>s['_pyst_test_float']=3.14>>>asserts['_pyst_test_float']==b'3.14'>>>>>>assertlen(s)==before_length+3>>>>>>'_pyst_test_float'in>>>>>># clean up>>>forkinkeys:...dels[k]>>>
Package: redis-dumper
Redis DumperCLI utility and library for creating encrypted redis dump.Installpipinstallredis_dumperUse in CLIredis_dumper[OPTIONS]COMMAND[ARGS]...Use in your codeExamples:importioimportaioredisimportredis_dumperREDIS_ADDR='redis://10.0.0.1:6379'PASSWORD='qwerty'FILE_PATH='mydump.rdump'asyncdefdump_to_file_example():awaitredis_dumper.dump_to_file(REDIS_ADDR,PASSWORD,FILE_PATH)asyncdefdump_to_bytesio_example():dump=awaitredis_dumper.dump_to_bytesio(REDIS_ADDR,PASSWORD)asyncdefrestore_from_file_example():awaitredis_dumper.restore_from_file(REDIS_ADDR,PASSWORD,FILE_PATH)asyncdefrestore_from_bytesio_example(dump:io.BytesIO):awaitredis_dumper.restore_from_bytesio(REDIS_ADDR,PASSWORD,dump)# you can also use the already created aioredis.Redis instanceasyncdefexample_with_created_redis():redis=awaitaioredis.create_redis(REDIS_ADDR)dump=awaitredis_dumper.dump_to_bytesio(redis,PASSWORD)
Package: redisea
RediSea is a Redis (in-memory database) communication framework used for viewing Redis keys, dumping Redis keys, dumping key information about the Redis server, real-time Redis database analysis, and much more!Please note, this framework does work even if a Redis instance is not present. There is also an option for remotely connecting to a Redis instance.RediSea is available through pip:pipinstallrediseaOnce RediSea is installed, you can run it like any other executable:rediseaAfter running RediSea, it'll boot up the application in an open prompt.Usage (only required if installing from source)You can run this command to install all the required tools for this framework:pip3install-rrequirements.txtpython3redisea/main.py
Package: redis-elastic
Redis ElasticSearchversion 1.0.2 (Stable release)SummaryThis Python code uses various libraries to connect to and manipulate data in different databases. Specifically, it imports the ast, psycopg2, functools, redis, threading, time, json, and pandas libraries, as well as the Elasticsearch and bulk modules of the elasticsearch library.The Settings_redis_elastic class uses the connection parameters to a Redis server and an Elasticsearch server to create methods that allow you to get data from a PostgreSQL database and send it to an Elasticsearch index through Redis.In addition, the class uses a decorator to cache the results of a Redis function and another method to update the cache periodically. It also defines a method to convert data stored in Redis to a Pandas DataFrame object.Finally, the code runs an infinite loop to send the data from Redis to Elasticsearch with a certain time interval. This process is done in a separate thread, while another thread takes care of updating the cache periodically.recommendationsUse docker for testing, You can deploy the official containersDocker Postgres | 🐘Docker Redis | 💾Docker Elasticsearch | ⚡Example by executionfromWarehouse.redis_elasticimportSettings_redis_elasticpostgres={"host":"127.0.0.1","port":"5432","user":"etl","password":"123","database":"customer"}query="""Select rp.id,rp.name,rp.code from res_partner rp"""my_object=Settings_redis_elastic("localhost","6379","http://localhost:9200")my_object.fusion(query,"_test","test",10,20,postgres)DocumentationThe first step is to create an object, and connect redis and elasticsearchmy_object=Settings_redis_elastic("redis_ip","port_redis","http://ip_elasticserch:port")Variables descriptionquery : It is the query that we make from the database, in the first version it works with postgresredis_name : Is the name of the collection that Redis saveselasticsearch_name : It is the way to feed the Elasticsearch APItime_redis : The time the SQL query is saved to Redistime_elastic : It is the timeout from Redis to elasticsearch,Recommendation:It should be bigger than <<time_redis>>database : It is the connection to the database, it must be a dictionaryPosition in the methodfusionmy_object.fusion(query,redis_name,elasticsearch_name,time_redis,time_elastic,database)Mode debugExample of the toolsfromDevelop.toolsimportactionpostgres={"host":"127.0.0.1","port":"5432","user":"etl","password":"123","database":"customer"}query="""Select rp.id,rp.name,rp.code from res_partner rp"""action.get_query_dates(postgres,query)action.get_redis_dates("localhost",6379,"cached_query_dates_test:():dict_items([])")Actionsget_query_datesWith this function you get the results of your query in a Dataframe and print the columnsaction.get_query_dates(my_database,my_query)get_redis_datesGet the data from the Redis collection in a Dataframeaction.get_redis_dates(my_ip,port,name_of_colection_redis)
Package: redisengine
Info:RedisEngine is a MongoEngine-inspired lib for ORM-like manipulation of Redis-powered cache in Python.Repository:https://github.com/RedisEngine/redisengineAuthor:Kris Kavalieri (https://github.com/kriskavalieri)AboutRedisEngine is intended to be an ORM-like Object-To-Redis-Type-Mapper written in Python.
This is a work in progress, as several things are pending completion, like: exhaustive tests,
CI, documentation and API reference.Given the above, any usage other than experimental is strongly discouraged for the time being.Future releases will include integration with Django’s and MongoEngine’s signal framework/module so that cache management can be automated
in a customizable fashion.MotivationI found myself in an occasional need of cache validation which usually resulted in a more entropic (and WET) code to cope with.
It naturally occurred this would be the best course of action.Installationpip install-Uredisengine.Alternatively, download thesourceand runpython setup.py install.Dependenciesredis>=2.10.5TestsTo run the test suite, ensure you are running a local instance of Redis on
the standard port, and run:python setup.py nosetests.Run selected tests with:$pythonsetup.pynosetests--teststests/fields/test_fields.py:FieldTest.test_default_values_nothing_set-sCommunityYet to comeContributingYet to come
Package: redis-enterprise-python
Redis Enterprise APIREST API Specifications¶Key Concepts¶Clusters¶Redis Labs clusters are a set of nodes, typically two or more, providing database services. Clusters are inherently multi-tenant, and a single cluster can manage multiple databases accessed through individual endpoints.Protocol and Headers¶JSON Requests and Responses¶The Redis Labs REST API uses the JavaScript Object Notation (JSON) for requests and responses.  Some responses may have an empty body, but indicate the response with standard HTTP codes. For more information, see RFC 4627 (http://www.ietf.org/rfc/rfc4627.txt) andwww.json.org.Both requests and responses may include zero or more objects.  In case the request is for a single entity, the response shall return a single JSON object, or none. In case the request if for a list of entities, the response shall return a single JSON array with 0 or more elements.  Requests may be delivered with some JSON object fields missing. In this case, these fields will be assigned default values (often indicating they are not in use).Request Headers¶The Redis Labs REST API supports the following HTTP headers:HeaderSupported/Required ValuesAcceptapplication/jsonContent-LengthLength (in bytes) of request message.Content-Typeapplication/jsonResponse Headers¶The Redis Labs REST API supports the following HTTP headers:HeaderSupported/Required ValuesContent-Typeapplication/jsonContent-LengthLength (in bytes) of request message.API Versions¶All RLEC API operations are versioned, in order to minimize the impact of backwards-incompatible API changes and to coordinate between different versions operating in parallel.Authentication¶Authentication to RLEC API occurs viaBasic Auth. Provide your RLEC username and password as the basic auth credentials.  All calls must be made over SSL, to port 9443.Example Request:curl-u"demo@redislabs.com:password"https://localhost:9443/v1/bdbsCommon Responses¶The following are common responses which may be returned in some cases regardless of any specific request.ResponseCondition / Required handling503 (Service Unavailable)Contacted node is currently not a member of any active cluster.505 (HTTP Version Not Supported)An unsupported X-API-Version was used, see API Versions above.noqa: E501
Package: redisenv
redisenvredisenv is library that makes generating redis test environments easier. This tool generatesdocker-composefiles, and runs all instances within docker.  Generated docker instances select a random port, based on the available free ports, and when runningredisenv ports, a JSON parse-able string of the build connections is outputted.Currently redisenv supports:Redis standaloneRedis SentinelRedis ClustersRedis masters with replicasRedis Enterprise ClustersNote: These require ports 8443, 9443, and can pick a random port per database. As a result, these two ports must be free in order to start a cluster. This is a temporary limitation, for now.Note: Today Redis Standalone supports redis-stack, but nothing else doesInstallationRequirementsPython >= 3.7docker-composedockerpipinstallredisenvUsageList options. Note, each sub command accepts its own--helpredisenv--helpStart an environment named foo, with one container:redisenv--namefoostandalonecreate--nodes1Start an environment with the redisbloom module, downloaded into a folder named modules. Note - you need the fulllocalpath to the directory.redisenv--namefoostandalonecreate-n1-M`pwd`/modules/modules-o"--loadmodule /modules/redisbloom.so"Destroy the environment named foo:redisenv--namefoodestroy
Package: redis-events
Redis EventsEvent based distributed computing using Redis and asyncioUsageCreate a worker that will respond to events:# worker.pyfromredis_eventsimportClient,Event# Point client at Redis serverclient=Client(host="mywebsite.com",port=6379,password="PASSWORD123")@client.event("echo")# name the event whatever you wantasyncdefecho_example(event:Event):reply_event=Event("echo",# this doesn't actually matter because it is a replyevent.data# echo the data that was in the first event)awaitclient.send_reply(event,reply_event)client.run()Create a script that will push events# send_events.pyfromredis_eventsimportClientimportasyncio# obviously, must point to the same Redis server as the workerclient=Client(host="mywebsite.com",port=6379,password="PASSWORD123")# Everything is asyncasyncdefsend_events():my_event=Event("echo",{"test":1234})awaitclient.send(my_event)reply=awaitclient.wait_for_reply(to=my_event,timeout=60)# wait for a reply for up to 1 minuteprint("GOT REPLY")asyncio.get_event_loop().run_until_complete(send_events())Installationpip install redis-events
Package: redis-event-tracker
EventTrackerClass EventTracker is used to gather statistics for multiple events.
It uses a Redis set (store) as a backend.InstallationTo install redis-event-tracker, simply:$sudopipinstallredis-event-trackerAPI Referencetrack_event(): Method track_event() increases a counter for a given event name in the today’s record.If there were errors, they are logged into a log file.Release Notes0.0.8 -2015.03.17Refactoring logger
Package: redisex
Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker. Redis provides data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, geospatial indexes, and streams. Redis has built-in replication, Lua scripting, LRU eviction, transactions, and different levels of on-disk persistence, and provides high availability via Redis Sentinel and automatic partitioning with Redis Cluster
Package: redis-exec-retry
This module wraps the execute_command method of the Redis class, allowing any retry passed to be used. It also introduces a new Backoff, LimitedTimeBackoff, allowing one to set a timeout before which the BackoffTimeoutExceeded is raised.The purpose of the module is to provide an alternative to the official redis app, as we await an update to hanlding timeout errors.UsageProvide aretryto the Redis class which shall be used later.Examplesimportredisimportsocketimportredis_exec_retrymax_seconds=2backoff_instance=redis.backoff.ExponentialBackoff()retry=redis.retry.Retry(backoff=redis_exec_retry.LimitedTimeBackOff(max_seconds,backoff_instance=backoff_instance),retries=-1,supported_errors=(redis.exceptions.BusyLoadingError,redis.exceptions.ConnectionError,redis.exceptions.TimeoutError,socket.timeout,),)r=redis_exec_retry.Redis(port=1000,retry=retry)print(r.keys("*"))# will run for 2 seconds before raising redis_exec_retry.BackoffTimeoutExceeded
Package: redis-export
Export redis keys with a given prefix or pattern, which later can be imported
to another redis server. To export all keys, use ‘*’ as pattern.InstallationTo install redis-export, simply:$python3-mpipinstallredis-exportYou should add ~/.local/bin/ to your PATH.Quick Startredis-exportPREFIX_OR_PATTERNOUTPUT_FILEredis-importINPUT_FILEFor example,# prefix based exportredis-export'phonebook:'~/d/t1.json# pattern based export
# redis-export 'phonebook:*:name:*' ~/d/t1.jsonredis-import--hostredis.example.com~/d/t1.jsonFor more usage help, run the command with--helpoption.Documentationredis-export will export keys with given pattern to a json file (keys and
values both base64 encoded).redis-import will import those keys and values back to redis.Implementation DetailSCAN is used to iterate over keys with given pattern.DUMP is used to dump the key.RESTORE is used to restore a key. force-replace param is set to TRUE.Exported file is a json list, each list item is of form (key, dump_value).
The redis key and dump value is encoded in base64 in order to fit in regular
json.Source CodeSource code is hosted athttps://gitlab.emacsos.com/sylecn/redis-exportYou may clone it via ssh or https protocolgitclonegit@gitlab.emacsos.com:sylecn/redis-export.gitgitclonehttps://gitlab.emacsos.com/sylecn/redis-export.gitLicenseCopyright (C) 2022, 2023 Yuanle Song <sylecn@gmail.com>This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.ChangeLogv0.3.0 2023-03-13support auth related options. Use the same options as redis-cli.add source code URL in README.rstv0.2.0 2022-09-24update README.rst, applied license, distributed on PyPI.v0.1.2 2022-09-18bugfix: when pattern contains ‘*’ should not errorv0.1.0 2021-11-21initial release