Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

s/redis/valkey/ single commit with fixes #2

Merged
merged 8 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions .github/workflows/stale-issues.yml

This file was deleted.

16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ The Python interface to the Valkey key-value store.

---------------------------------------------

**Note: ** valkey-py 5.0 will be the last version of valkey-py to support Python 3.7, as it has reached [end of life](https://devguide.python.org/versions/). valkey-py 5.1 will support Python 3.8+.

---------------------------------------------

## Installation

Start a valkey via docker:
Expand Down Expand Up @@ -79,7 +75,7 @@ There is built-in support for all of the [out-of-the-box Valkey commands](https:

## Advanced Topics

The [official Redis command documentation](https://valkey.io/commands)
The [official Valkey command documentation](https://valkey.io/commands)
does a great job of explaining each command in detail. valkey-py attempts
to adhere to the official command syntax. There are a few exceptions:

Expand All @@ -91,17 +87,17 @@ to adhere to the official command syntax. There are a few exceptions:
- **SUBSCRIBE/LISTEN**: Similar to pipelines, PubSub is implemented as
a separate class as it places the underlying connection in a state
where it can\'t execute non-pubsub commands. Calling the pubsub
method from the Redis client will return a PubSub instance where you
method from the Valkey client will return a PubSub instance where you
can subscribe to channels and listen for messages. You can only call
PUBLISH from the Redis client (see [this comment on issue
PUBLISH from the Valkey client (see [this comment on issue
#151](https://github.com/redis/redis-py/issues/151#issuecomment-1545015)
for details).

For more details, please see the documentation on [advanced topics page](https://valkey-py.readthedocs.io/en/stable/advanced_features.html).

### Pipelines

The following is a basic example of a [Redis pipeline](https://valkey.io/docs/manual/pipelining/), a method to optimize round-trip calls, by batching Redis commands, and receiving their results as a list.
The following is a basic example of a [Valkey pipeline](https://redis.io/docs/manual/pipelining/), a method to optimize round-trip calls, by batching Valkey commands, and receiving their results as a list.


``` python
Expand All @@ -115,7 +111,7 @@ The following is a basic example of a [Redis pipeline](https://valkey.io/docs/ma

### PubSub

The following example shows how to utilize [Redis Pub/Sub](https://valkey.io/docs/manual/pubsub/) to subscribe to specific channels.
The following example shows how to utilize [Valkey Pub/Sub](https://redis.io/docs/manual/pubsub/) to subscribe to specific channels.

``` python
>>> r = valkey.Valkey(...)
Expand Down Expand Up @@ -143,4 +139,4 @@ Special thanks to:
system.
- Paul Hubbard for initial packaging support in redis-py.

[![Redis](./docs/logo-valkey.png)](https://valkey.io/)
[![Valkey](./docs/logo-valkey.png)](https://valkey.io/)
3 changes: 1 addition & 2 deletions docs/advanced_features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,6 @@ existing event loop inside your application.
>>> # do something with the message
>>> time.sleep(0.001) # be nice to the system :)

Older versions of valkey-py only read messages with pubsub.listen().
listen() is a generator that blocks until a message is available. If
your application doesn't need to do anything else but receive and act on
messages received from valkey, listen() is an easy way to get up an
Expand Down Expand Up @@ -424,7 +423,7 @@ supported:
Sharded pubsub
~~~~~~~~~~~~~~

`Sharded pubsub <https://valkey.io/docs/interact/pubsub/#:~:text=Sharded%20Pub%2FSub%20helps%20to,the%20shard%20of%20a%20cluster.>`_ is a feature introduced with Valkey 7.0, and fully supported by valkey-py as of 5.0. It helps scale the usage of pub/sub in cluster mode, by having the cluster shard messages to nodes that own a slot for a shard channel. Here, the cluster ensures the published shard messages are forwarded to the appropriate nodes. Clients subscribe to a channel by connecting to either the master responsible for the slot, or any of its replicas.
`Sharded pubsub <https://valkey.io/docs/interact/pubsub/#:~:text=Sharded%20Pub%2FSub%20helps%20to,the%20shard%20of%20a%20cluster.>`_ is a feature that helps scale the usage of pub/sub in cluster mode, by having the cluster shard messages to nodes that own a slot for a shard channel. Here, the cluster ensures the published shard messages are forwarded to the appropriate nodes. Clients subscribe to a channel by connecting to either the master responsible for the slot, or any of its replicas.

This makes use of the `SSUBSCRIBE <https://valkey.io/commands/ssubscribe>`_ and `SPUBLISH <https://valkey.io/commands/spublish>`_ commands within Valkey.

Expand Down
4 changes: 2 additions & 2 deletions docs/clustering.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Clustering
==========

valkey-py now supports cluster mode and provides a client for `Valkey
valkey-py supports cluster mode and provides a client for `Valkey
Cluster <https://valkey.io/topics/cluster-tutorial>`__.

The cluster client is based on Grokzen’s
`valkey-py-cluster <https://github.com/Grokzen/valkey-py-cluster>`__, has
`redis-py-cluster <https://github.com/Grokzen/redis-py-cluster>`__, has
added bug fixes, and now supersedes that library. Support for these
changes is thanks to his contributions.

Expand Down
4 changes: 2 additions & 2 deletions docs/examples/asyncio_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,8 @@
"\n",
"Three URL schemes are supported:\n",
"\n",
"- `valkey://` creates a TCP socket connection. <https://www.iana.org/assignments/uri-schemes/prov/valkey>\n",
"- `valkeys://` creates a SSL wrapped TCP socket connection. <https://www.iana.org/assignments/uri-schemes/prov/valkeys>\n",
"- `valkey://` creates a TCP socket connection.\n",
"- `valkeys://` creates a SSL wrapped TCP socket connection.\n",
"- ``unix://``: creates a Unix Domain Socket connection.\n"
]
},
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/opentelemetry/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
valkey==4.3.4
valkey
uptrace==1.14.0
mkmkme marked this conversation as resolved.
Show resolved Hide resolved
opentelemetry-instrumentation-valkey==0.35b0
2 changes: 1 addition & 1 deletion docs/examples/search_vector_similarity_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Find more example apps, tutorials, and projects using Valkey Vector Similarity Search [in this GitHub organization](https://github.com/ValkeyVentures)."
"Find more example apps, tutorials, and projects using Redis Vector Similarity Search [in this GitHub organization](https://github.com/RedisVentures)."
]
}
],
Expand Down
10 changes: 5 additions & 5 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ Module Documentation
Contributing
*************

- `How to contribute <https://github.com/valkey/valkey-py/blob/master/CONTRIBUTING.md>`_
- `Issue Tracker <https://github.com/valkey/valkey-py/issues>`_
- `Source Code <https://github.com/valkey/valkey-py/>`_
- `Release History <https://github.com/valkey/valkey-py/releases/>`_
- `How to contribute <https://github.com/valkey-io/valkey-py/blob/master/CONTRIBUTING.md>`_
- `Issue Tracker <https://github.com/valkey-io/valkey-py/issues>`_
- `Source Code <https://github.com/valkey-io/valkey-py/>`_
- `Release History <https://github.com/valkey-io/valkey-py/releases/>`_

License
*******

This project is licensed under the `MIT license <https://github.com/valkey/valkey-py/blob/master/LICENSE>`_.
This project is licensed under the `MIT license <https://github.com/valkey-io/valkey-py/blob/master/LICENSE>`_.
2 changes: 1 addition & 1 deletion docs/opentelemetry.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ OpenTelemetry instrumentation

Instrumentations are plugins for popular frameworks and libraries that use OpenTelemetry API to record important operations, for example, HTTP requests, DB queries, logs, errors, and more.

To install OpenTelemetry `instrumentation <https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/valkey/valkey.html>`_ for valkey-py:
To install OpenTelemetry `instrumentation <https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/redis/redis.html>`_ for valkey-py:

.. code-block:: shell

Expand Down
152 changes: 0 additions & 152 deletions docs/redismodules.rst

This file was deleted.

2 changes: 1 addition & 1 deletion docs/resp3_features.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
RESP 3 Features
===============

As of version 5.0, valkey-py supports the `RESP 3 standard <https://github.com/valkey/valkey-specifications/blob/master/protocol/RESP3.md>`_. Practically, this means that client using RESP 3 will be faster and more performant as fewer type translations occur in the client. It also means new response types like doubles, true simple strings, maps, and booleans are available.
valkey-py supports the `RESP 3 standard <https://github.com/valkey/valkey-specifications/blob/master/protocol/RESP3.md>`_. Practically, this means that client using RESP 3 will be faster and more performant as fewer type translations occur in the client. It also means new response types like doubles, true simple strings, maps, and booleans are available.
mkmkme marked this conversation as resolved.
Show resolved Hide resolved

Connecting
-----------
Expand Down
18 changes: 0 additions & 18 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,6 @@ def pytest_addoption(parser):
def _get_info(valkey_url):
client = valkey.Valkey.from_url(valkey_url)
info = client.info()
try:
client.execute_command("DPING")
info["enterprise"] = True
except valkey.ResponseError:
info["enterprise"] = False
client.connection_pool.disconnect()
return info

Expand All @@ -141,18 +136,15 @@ def pytest_sessionstart(session):
version = info["valkey_version"]
arch_bits = info["arch_bits"]
cluster_enabled = info["cluster_enabled"]
enterprise = info["enterprise"]
except valkey.ConnectionError:
# provide optimistic defaults
info = {}
version = "10.0.0"
arch_bits = 64
cluster_enabled = False
enterprise = False
VALKEY_INFO["version"] = version
VALKEY_INFO["arch_bits"] = arch_bits
VALKEY_INFO["cluster_enabled"] = cluster_enabled
VALKEY_INFO["enterprise"] = enterprise
# store VALKEY_INFO in config so that it is available from "condition strings"
session.config.VALKEY_INFO = VALKEY_INFO

Expand Down Expand Up @@ -247,16 +239,6 @@ def skip_ifmodversion_lt(min_version: str, module_name: str):
raise AttributeError(f"No valkey module named {module_name}")


def skip_if_valkey_enterprise() -> _TestDecorator:
check = VALKEY_INFO.get("enterprise", False) is True
return pytest.mark.skipif(check, reason="Valkey enterprise")


def skip_ifnot_valkey_enterprise() -> _TestDecorator:
check = VALKEY_INFO.get("enterprise", False) is False
return pytest.mark.skipif(check, reason="Not running in valkey enterprise")


def skip_if_nocryptography() -> _TestDecorator:
try:
import cryptography # noqa
Expand Down
7 changes: 1 addition & 6 deletions tests/test_asyncio/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import pytest
import pytest_asyncio
import valkey.asyncio as valkey
from packaging.version import Version
from tests.conftest import VALKEY_INFO
from valkey._parsers import _AsyncHiredisParser, _AsyncRESP2Parser
from valkey.asyncio import Sentinel
Expand Down Expand Up @@ -248,11 +247,7 @@ async def wait_for_command(
# for, something went wrong
if key is None:
# generate key
valkey_version = VALKEY_INFO["version"]
if Version(valkey_version) >= Version("5.0.0"):
id_str = str(await client.client_id())
else:
id_str = f"{random.randrange(2 ** 32):08x}"
id_str = f"{random.randrange(2 ** 32):08x}"
mkmkme marked this conversation as resolved.
Show resolved Hide resolved
key = f"__VALKEY-PY-{id_str}__"
await client.get(key)
while True:
Expand Down
Loading
Loading