Saravanan666/pypi-org huggingface dataset:
Package: redis-semaphore-eval
Redis Semaphore Evalhttps://redislabs.com/ebook/part-2-core-concepts/chapter-6-application-components-in-redis/6-3-counting-semaphores/UsageTo acquire a lock:fromredisimportRedisfromredis_semaphore_evalimportsemaphoreredis=Redis(host="localhost",port=6379,db=0)key="unique_lock_key"withsemaphore(redis,key=key,limit=2,expire_in=5,timeout=1)aslock_id:...To acquire a lock but continuously renew it in a background thread:fromredisimportRedisfromredis_semaphore_evalimportauto_renewing_semaphoreredis=Redis(host="localhost",port=6379,db=0)key="unique_lock_key"withauto_renewing_semaphore(redis,key=key,limit=2,expire_in=5,timeout=1,auto_renewal_interval=4)aslock_id:...Contributingpoetryrunpre-commitinstall-tpre-commit-tcommit-msg&&poetryrunpre-commitrun--all
docker-composeup-d
poetryrunpython-mpytest
docker-composedown
Package: redis-sentinel
Python Redis SentinelGiven a Redis + Sentinel service, this package allow you to connect simultaneously to both the master node
and to the slave nodes, transparently balancing the connection used to the user.ScopeThe redis packages doesn't expose a tool to automatically choose between the master node and the slaves ones.
With this package, you get an object that automatically detect when to use the master one and when to connect to the slaves.This is useful for the scenarios when you need to expose a Redis connection, you need to execute read and write operation,
but you want also take advantage of the read only nodesMechanismThe automatic selection between master and slaves is detected by the Redis command executed:
into the class, there is an attribute (REPLICAS_COMMANDS) which contain the list of Redis' commands that will be executed on the slaves connection pool.Those commands which are not listed inREPLICAS_COMMANDSare executed on the master node.The main idea is to use the slave for the read operations (such as GET, KEYS ecc...) and to use the master just for the writes.UsageInstantiateRedisSentinelpassing aredis.sentinel.Sentinelinstance, the service name,
and every connection parameter you would pass to theredis.Redisconstructor (excepts obviously the host and the port, which are given by Sentinel)
Package: redis-sentinel-connector
The idea behind this package is possibility to you use some client or something like the Metabase for collect and analyse logs of your application.Its need two environments variables:TYPE = 'TEST' or 'DEV'TEST: You will use fakeredis and not need use Redis instance.(Don't need environment REDIS_URL)DEV: Use this if You has a local Redis like Docker Redis.(Don't need environment REDIS_URL)REDIS_URL = 'complete_redis_sentinel_url'Sample:
sentinel://:testefoobar@host1.sentinel.domain.com:26379,host2.sentinel.domain.com:26379,host3-155915407905.sentinel.domain.com:26379/service_name:redisserviceSample:fromredis_sentinel_connectorimportRedisConnectorredis_connector=RedisConnector().connect()Or pass a variable with the complete url to the connect functionSample:fromredis_sentinel_connectorimportRedisConnectorSENTINEL_URL="sentinel://:testefoobar@host1.sentinel.domain.com:26379,host2.sentinel.domain.com:26379,host3-155915407905.sentinel.domain.com:26379/service_name:redisservice"redis_connector=RedisConnector().connect(SENTINEL_URL)
Package: redissentry-core
This is generic RedisSentry documentaion, for django specific notes,
see django-redissentry docs.InstallationThis is how RedisSentry can be integrated into any python-powered project (eg Flask):from redissentry import RedisSentry

def protected_auth(username, password):
    sentry = RedisSentry(ip, username)
    msg = sentry.ask()
    if msg:
        raise Exception(msg)
    res = auth(username, password)
    msg = sentry.inform(bool(res))
    if not res:
        raise Exception('Incorrect username or password. ' + msg)
    return reswhere auth() is the original auth function.
Package: redis-server
redis-serverTo install the pre-compiled Redis binaries:pipinstallredis-server==<redis-version>Supportedredis-version:5.0.76.0rc2Supported platforms:manylinux2010_x86_64manylinux2010_i686macosx_10_15_x86_64Supported python versions:cp35cp36cp37cp38To get the paths of pre-compiled Redis binaries:importredis_serverredis_server.REDIS_SERVER_PATH# redis-serverredis_server.REDIS_CLI_PATH# redis-cli
Package: redis_session_backend
Welcome to redis_session_backend's documentation!======================================INSTALLATION------------To use redis_session_backend use pip or easy_install:`pip install redis_session_backend`or`easy_install redis_session_backend`CONTRIBUTE----------Fork https://github.com/Lispython/redis_session_backend/ , create commit and pull request.SEE ALSO--------- `django framework`_.. _`django framework`: http://djangoproject.com
Package: redis-shelve
Redis ShelveA Python shelve that uses Redis as storage.MotivationIn some contexts writing state to files can be hard. Redis can be a more
suitable storage solution. If you need a shelve but cannot write to file and
if you are friends with Redis already, you can use Redis Shelve.LicenseRedis Shelve is licensed under LGPLv3. See the LICENSE file for details.Installationpip install redis-shelveUsageThe behaviour of the Redis shelve should be similar to Python shelve. Instead
of a filename, you can pass redis-shelve a redis instance. You can think of the
configured redis database being similiar to a file in Python shelve.importredisshelvefromredisimportRedisredis=Redis(db=15)shelf=redisshelve.RedisShelf(redis=redis)shelf['test']='Test'assert'Test'==shelf['test']assert'Test'==shelf.get('test')You can also use theredisshelve.opencontext manager.withredisshelve.open(redis=redis)asshelf:shelf['foo']='Bar'Prefixing keysBy default, the keys you enter in the shelf are used as keys in Redis. If you
think this might conflict with existing values, you can prefix your keys.NB:As a side effect, if you also use writeback, the keys in the shelf's cache
are also prefixed.shelf=redisshelve.RedisShelf(redis=redis,key_prefix='my_prefix')withredisshelve.open(redis=redis,key_prefix='my_prefix')asshelf:shelf['foo']='Bar'More examples.Please see the tests for more examples.unprefixed:tests/test_redisshelve_unprefixed.pyprefixed:tests/test_redisshelve_prefixed.py
Package: redissimple
Redis-simpleRedis-simple is a Python package that contains handy functions for interacting with Redis Library.Installation and updatingUse the package managerpipto install RedisSimple like below.
Rerun this command to check for and install  updates .pipinstallredissimpleUsageFeatures:functions.get (tenant_id, entity_name, entity_id)  --> Get the data stored for provided key in the Redis Cache.functions.set    --> Set the key value pair in the Redis cachefunctions.remove      --> Remove the key from Redis CacheHow to create distributionDelete existing dist folder on project root directoryExecute below command on project root directory
** python3 setup.py sdistHow to upload distribution to pypi
python3 -m twine upload --repository pypi dist/*Demo of some of the features:
Package: redis-simple-cache
# redis-simple-cacheredis-simple-cache is a pythonic interface for creating a cache over redis.It provides simple decorators that can be added to any function to cache its return values.Requirements:-------------redis 2.6.2redis-py 2.7.1 (see requirements.txt file)Installation:-------------pip install redis-simple-cacheor to get the latest versiongit clone git://github.com/vivekn/redis-simple-cache.gitcd redis-simple-cachepython setup.py installUsage:------from redis_cache import cache_it_json@cache_it_json(limit=1000, expire=60 * 60 * 24)def fib(n):if n == 0:return 0elif n == 1:return 1else:return fib(n-1) + fib(n-2)`limit` is the maximum number of keys, `expire` is the expire time in seconds.It is always recommended to specify a expire time, since by default redis-server will only remove keys with an expire time set in a event of full memory. But if you wish your keys to never expire, set `expire` to `None`.**Note that function arguments and result must be pickleable, since cache_it uses the pickle module.**It is also possible to use redis-simple-cache as a object-oriented cache:>> from redis_cache import SimpleCache>> c = SimpleCache(10)  # cache that has a maximum limit of 10 keys>> c.store("foo", "bar")>> c.get("foo")'bar'>> "foo" in c  # efficient membership test, time-complexity O(1)True>> len(c)  # efficient cardinality calculation, time-complexity O(1)1>> c.keys()  # returns all keys, time-complexity O(N) with N being the cache c cardinalityset(['foo'])>> c.flush()  # flushes the cache, time-complexity O(N) with N being the cache c cardinality>> "foo" in cFalse>> len(c)0Check out more examples in the test_rediscache.py file.Advanced:---------Advanced users can customize the decorators even more by passing a SimpleCache object. For example:my_cache = SimpleCache(limit=100, expire=60 * 60, hashkeys=True, host='localhost', port=6379, db=1, namespace='Fibonacci')@cache_it(cache=my_cache)def fib(n):# ...`hashkeys` parameter makes the SimpleCache to store keys in md5 hash. It is `True` by default in decorators, but `False` by default in a new SimpleCache object.`host`, `port` and `db` are the same redis config params used in StrictRedis class of redis-py.By default, the `namespace` is the name of the module from which the decorated function is called, but it can be overridden with the `namespace` parameter.AUTHOR: Vivek NarayananCONTRIBUTORS:Flávio JuvenalSam ZaydelDavid NgDJ GilcreaseJohannes Maximilian ToballRobert MarshallBen HaydenLICENSE: BSD
Package: redis-simple-cache-3k
redis-simple-cacheredis-simple-cache is a pythonic interface for creating a cache over redis.It provides simple decorators that can be added to any function to cache its return values.Forked package with python 3 support.
Original package is located here:https://github.com/vivekn/redis-simple-cacheRequirements:redis 4.0.0Installation:pip install redis-simple-cache-3kor to get the latest versiongit clone git://github.com/ohanetz/redis-simple-cache-3k.git
cd redis-simple-cache-3k
python setup.py installUsage:from redis_cache import cache_it_json

@cache_it_json(limit=1000, expire=60 * 60 * 24)
def fib(n):
    if n == 0:
        return 0
    elif n == 1:
        return 1
    else:
        return fib(n-1) + fib(n-2)limitis the maximum number of keys,expireis the expire time in seconds.It is always recommended to specify a expire time, since by default redis-server will only remove keys with an expire time set in a event of full memory. But if you wish your keys to never expire, setexpiretoNone.Note that function arguments and result must be pickleable, since cache_it uses the pickle module.It is also possible to use redis-simple-cache as a object-oriented cache:>> from redis_cache import SimpleCache
>> c = SimpleCache(10)  # cache that has a maximum limit of 10 keys
>> c.store("foo", "bar")
>> c.get("foo")
'bar'
>> "foo" in c  # efficient membership test, time-complexity O(1)
True
>> len(c)  # efficient cardinality calculation, time-complexity O(1)
1
>> c.keys()  # returns all keys, time-complexity O(N) with N being the cache c cardinality
set(['foo'])
>> c.flush()  # flushes the cache, time-complexity O(N) with N being the cache c cardinality
>> "foo" in c
False
>> len(c)
0Check out more examples in the test_rediscache.py file.Advanced:Advanced users can customize the decorators even more by passing a SimpleCache object. For example:my_cache = SimpleCache(limit=100, expire=60 * 60, hashkeys=True, host='localhost', port=6379, db=1, namespace='Fibonacci')
@cache_it(cache=my_cache)
def fib(n):
    # ...hashkeysparameter makes the SimpleCache to store keys in md5 hash. It isTrueby default in decorators, butFalseby default in a new SimpleCache object.host,portanddbare the same redis config params used in StrictRedis class of redis-py.
By default, thenamespaceis the name of the module from which the decorated function is called, but it can be overridden with thenamespaceparameter.AUTHOR: Vivek NarayananCONTRIBUTORS:Flávio JuvenalSam ZaydelDavid NgDJ GilcreaseJohannes Maximilian ToballRobert MarshallBen HaydenPython 3 and Redis 4 support added by Omer HanetzLICENSE: BSD
Package: redis-simple-mq
redis-simple-mqA simple message queue for Redis.DescriptionThis is a light-weight message queue based on Redis.Key features:Class based API to the queue with all basic queue functionsQueue is implement as FIFOAll messages are stored and retrieved as UTF-8 stringsBulk methods for enqueue and dequeueNo limit on the number of parallel queuesFully testedBasic examplefromredisimportRedisfromsimple_mqimportSimpleMQconn=Redis()q=SimpleMQ(conn)q.enqueue('Hello, World!')message=q.dequeue()print(message)See also the examples folder for examples.
Package: redis_simple_queue
redis_simple_queue---------------redis_simple_queue implements a queue on top of Redis.Requires:* Redis 2.0+* Newest version of redis-py http://github.com/andymccurdy/redis-py* redis_wrap http://pypi.python.org/pypi/redis_wrapExamples----------Example of using the queue::from redis_simple_queue import *delete_jobs('tasks')put('tasks', '42')assert 'tasks' in get_all_queues()assert queue_stats('tasks')['queue_size'] == 1assert reserve('tasks') == '42'assert queue_stats('tasks')['queue_size'] == 0Copyright: 2010 by amixLicense: BSD.
Package: redis-sniffer
# Redis Sniffer v1.1.0## AboutThis tool will monitor a specific port and interface for redis traffic and captures the commands being sent to Redis and/or formatted full TCP dump data.  This can be used for analysis for debugging or for replaying the transactions as a way of doing real load/performance testing.Redis Hound must be run locally on a Redis server or a server that is sending commands to Redis.## InstallationInstalling from the Eternal Projects Apt repo is the preferred method of installation since it handles installing all the needed dependencies.Once Redis Sniffer is installed, you will have the executable at /usr/local/bin/redis-sniffer### Install from Apt1. Get the key for the repo```bashwget -O - http://apt.eternalprojects.com/conf/apt.eternalprojects.com.gpg.key|apt-key add -```2. Add the Repo to /etc/apt/sources.list```bashdeb http://apt.eternalprojects.com/ stable main```3. Install the package```bashsudo apt-get updatesudo apt-get install -y redis-sniffer```### Install from Pypi```bashsudo apt-get -y libpcap-dev python-devsudo pip install pypcapsudo pip install dpktsudo pip install redis-sniffer```### Get the source and install```bashsudo apt-get -y install libpcap-dev python-devgit clone https://github.com/eternalprojects/redis-sniffer.gitcd redis-sniffersudo python setup.py installsudo python setup.py install --user```## Usage**Please Note: Redis Sniffer must be run as root/sudo since it has to bind to a network interface which is not allowed by non-privileged users.**```bashsudo redis-sniffer -i <interface> -p <port>sudo redis-sniffer -i bond0 -p 6379 -f setex,select,del```Additional Options:```bash-l {event,full,both} - logging type--out - location to write logs--event-log - name of the event log--full-log - name of the full log-f, --filter - specify a comma seperated list of redis commands to log```
Package: redis_structures
Redis data structures wrapped with Python 3.Full documentation can be found at http://docr.it/redis_structuresInstallationredis_structures requires a running Redis server. SeeRedis’s quickstartfor installation instructions.To install redis_structures:$sudopipinstallredis_structuresor from source:$gitclonehttps://github.com/jaredlunde/redis_structures$cdredis_structures$sudopythonsetup.pyinstallGetting Started>>>fromredis_structuresimportStrictRedis,RedisHash>>>client=StrictRedis(host='localhost',port=6379,db=0)>>>rh=RedisHash("my_hash",prefix="rs:hash"client=client)>>>rh['hello']="world"# sets the field name 'hello' to value 'world' in>>># redis under the key rs:hash:my_hash>>>rh['hello']'world'>>>delrh['hello']>>>rh.get('hello')None
Package: redis-task-queue
version number: 0.0.2
author: Andres PegadoOverviewA python package that can be installed with pip.Installation / UsageTo install use pip:$ pip install redis-task-queueOr clone the repo:$ git clonehttps://github.com/apegadoboureghida/redis-task-queue.git$ python setup.py installContributingTBDExampleTBD
Package: redis-tasks
redis-tasksredis-tasksis a lightweight framework created to reliably process background
tasks. Built-inSIGTERMsignal handling makes it a great choice for a task
manager running on Heroku. Out-of-the-box provided task scheduler with a
user-friendly interface makes periodic task management easy and scalable.For more information and usage instructions, see ourdocumentation.MonitoringWant to monitorredis-taskstasks, queues and workers? Check outrt-dashboard- a monitoring tool forredis-tasks.Contributingtoxis used to run the tests
and automatically sets up virtual environments to run the tests in. It
implicitly usesvirtualenv.
To installtoxrunpip install toxMake sure to install the supported python versions on your local machine.
If you don't want to install all supported python versions, you can either
explicitly specify environments you want to runtoxin or alternatively you
could runtoxwith the--skip_missing_interpretersflag.Running testsYou can run all the tests withtoxor run specific test environments, for example only tests on Python 3.8, withtox -e py38If you want to customize the pytest run, you can pass in pytest arguments
after the--like sotox -e py38 -- tests/test_cli.pyThis will run tests only on Python 3.8 and from one moduletests/test_cli.pyonly.Running linter checksYou can runflake8checks withtox -e flake8flake8checks are also run as a part of the all tests run withtoxBuilding documentation locallyYou can build documentation locally withtox -e docsThe built html files will be located indocs/build/html.
Package: redis-throttled-queue
Queue system with key-based throttling implemented over Redis.Free software: BSD 2-Clause LicenseInstallationpip install redis-throttled-queueYou can also install the in-development version with:pip install https://github.com/ionelmc/python-redis-throttled-queue/archive/main.zipDocumentationhttps://python-redis-throttled-queue.readthedocs.io/DevelopmentTo run all the tests run:toxNote, to combine the coverage data from all the tox environments run:Windowsset PYTEST_ADDOPTS=--cov-append
toxOtherPYTEST_ADDOPTS=--cov-append tox1
Changelog
=========1.0.0 (2022-11-15)Switched from eval scripts to redis functions. Minimum Redis server version becomes 7.0.Replaced unpack calls with direct indexing in the Lua functions.These changes improve the push operation by at least 6%.0.6.0 (2022-07-06)Simplifiedpop()code to avoid the expensive scan operations.
The'...:nameskey is now a sorted set and will be used as a template for the usage keys ('...:usage:<window>').0.5.0 (2022-06-28)Added support in aAsyncThrottledQueueclass that only differs a bit from the regularThrottledQueue:__len__is removed, instead a awaitablesize()method is available.__init__doesn’t validate version anymore, instead you can await onvalidate_version().push(),pull()andcleanup()are awaitable.Added avalidate_versionargument toThrottledQueue(default:True).0.4.4 (2022-05-09)Fixed missing usage key expiration when some queues are empty.0.4.3 (2022-04-09)Fixed buggy counts when duplicate values are pushed.
For now the highest priority will be used when two identical
values would be pushed.0.4.2 (2022-04-02)Refactored some duplicated code in thepopscript.0.4.1 (2022-03-31)Fixed bogus error incleanup()when db is completely empty.0.4.0 (2022-03-31)Addedlast_activityandidle_secondsattributes.Added acleanup()method.0.3.1 (2022-03-31)Renamed attributes (should be safe to mess with):_limitbecomeslimit._resolutionbecomesresolution.0.3.0 (2022-03-31)Allowedpop(window)using any window value (str/bytes/int recommended tho).0.2.0 (2022-03-31)Fixed__len__(was returning a string).0.1.0 (2022-03-30)First release on PyPI.
Package: redistimeseries
redistimeseries-pyDeprecation noticeAs ofredis-py 4.0.0this library is deprecated. It's features have been merged into redis-py. Please either install itfrom pypyorthe repo.redistimeseries-py is a package that gives developers easy access to RedisTimeSeries module. The package extendsredis-py's interface with RedisTimeSeries's API.Installation$ pip install redistimeseriesDevelopmentCreate a virtualenv to manage your python dependencies, and ensure it's active.virtualenv -v venvInstallpypoetryto manage your dependencies.pip install poetryInstall dependencies.poetry installtoxruns all tests as its default target. Runningtoxby itself will run unit tests. Ensure you have a running redis, with the module loaded.APIThe complete documentation of RedisTimeSeries's commands can be found atRedisTimeSeries's website.Usage example# Simple examplefromredistimeseries.clientimportClientrts=Client()rts.create('test',labels={'Time':'Series'})rts.add('test',1,1.12)rts.add('test',2,1.12)rts.get('test')rts.incrby('test',1)rts.range('test',0,-1)rts.range('test',0,-1,aggregation_type='avg',bucket_size_msec=10)rts.range('test',0,-1,aggregation_type='sum',bucket_size_msec=10)rts.info('test').__dict__# Example with rulesrts.create('source',retention_msecs=40)rts.create('sumRule')rts.create('avgRule')rts.createrule('source','sumRule','sum',20)rts.createrule('source','avgRule','avg',15)rts.add('source','*',1)rts.add('source','*',2)rts.add('source','*',3)rts.get('sumRule')rts.get('avgRule')rts.info('sumRule').__dict__Further notes on back-filling time seriesSinceRedisTimeSeries 1.4we've added the ability to back-fill time series, with different duplicate policies.The default behavior is to block updates to the same timestamp, and you can control it via theduplicate_policyargument. You can check in detail theduplicate policy documentation.Bellow you can find an example of theLASTduplicate policy, in which we override duplicate timestamps with the latest value:fromredistimeseries.clientimportClientrts=Client()rts.create('last-upsert',labels={'Time':'Series'},duplicate_policy='last')rts.add('last-upsert',1,10.0)rts.add('last-upsert',1,5.0)# should output [(1, 5.0)]print(rts.range('last-upsert',0,-1))LicenseBSD 3-Clause
Package: redistock
RedistockA simple and easy-to-use and cluster-supported distributed lock implement based on Redis and Python.InstallationpipinstallredistockUsageSimple usage:importredisfromredistockimportRedistockredis_conn=redis.StrictRedis(...)# simplelock=Redistock(redis_conn,'name')iflock.acquire():print('Obtained lock')lock.release()# with statementwithRedistock(redis_conn,'name'):print('Obtained lock')Advanced usage:importredisfromredistockimportRedistockfromredistockimportRedistockNotObtainedredis_conn=redis.StrictRedis(...)withRedistock(redis_conn,'name',ttl=1):# will be blocked for 1 secondsprint('Obtained lock')withRedistock(redis_conn,'name',ttl=0.001):# will be blocked for 1 millisecondsprint('Obtained lock')withRedistock(redis_conn,'name',delay=1):# will delay 1 seconds between twice retry, default 0.001print('Obtained lock')lock=Redistock(redis_conn,'name',block=False)# do not retry, raise RedistockNotObtained if not obtained lockiflock.acquire():print('Obtained lock')lock.release()try:withRedistock(redis_conn,'name',timeout=10):# will try to acquire for 10 seconds, success or raise RedistockNotObtained# after 10 secondsprint('Obtained lock')exceptRedistockNotObtained:print('Not obtained lock')
Package: redistools
A Redis tools provide python’s Lock RLock Semaphore BoundedSemaphore Condition Event Barrier and Queue cross processQuickstartInstall the library withpip install redistools.
Import the collections from the top-levelredistoolspackage.fromredistoolsimportRedisManagerasManagermanager=Manager()Then use it as a standard multiprocessing.Manager <https://docs.python.org/3/library/multiprocessing.html#multiprocessing.managers.SyncManager>Notice: We didn’t provideArrayandValueinRedisManager© 2016-? wwqgtxx