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

Clean dependencies #239

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,12 @@ Installation is simple with `pip`, Poetry, or Pipenv.
# With pip
$ pip install redis-om

# Optionally hiredis can be installed separately or with
$ pip install redis-om[hiredis]

# If you intend to use pydantic.EmailStr for email validation you need to install email-validator separately or with
$ pip install redis-om[email]

# Or, using Poetry
$ poetry add redis-om
```
Expand Down
12 changes: 4 additions & 8 deletions aredis_om/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1179,14 +1179,10 @@ def find(cls, *expressions: Union[Any, Expression]) -> FindQuery:
@classmethod
def from_redis(cls, res: Any):
# TODO: Parsing logic copied from redisearch-py. Evaluate.
import six
from six.moves import xrange
from six.moves import zip as izip

def to_string(s):
if isinstance(s, six.string_types):
if isinstance(s, str):
return s
elif isinstance(s, six.binary_type):
elif isinstance(s, bytes):
return s.decode("utf-8", "ignore")
else:
return s # Not a string we care about
Expand All @@ -1195,12 +1191,12 @@ def to_string(s):
step = 2 # Because the result has content
offset = 1 # The first item is the count of total matches.

for i in xrange(1, len(res), step):
for i in range(1, len(res), step):
fields_offset = offset

fields = dict(
dict(
izip(
zip(
map(to_string, res[i + fields_offset][::2]),
map(to_string, res[i + fields_offset][1::2]),
)
Expand Down
9 changes: 9 additions & 0 deletions docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,15 @@ Finally, you can install Redis OM with `pip` by running the following command:

**TIP:** If you aren't using Poetry or Pipenv and are instead installing directly with `pip`, we recommend that you install Redis OM in a virtual environment (AKA, a virtualenv). If you aren't familiar with this concept, see [Dan Bader's video and transcript](https://realpython.com/lessons/creating-virtual-environment/).

Optionally hiredis can be installed separately or with

$ pip install redis-om[hiredis]

If you intend to use pydantic.EmailStr for email validation you need to install email-validator separately or with

$ pip install redis-om[email]



## Setting the Redis URL Environment Variable

Expand Down
Loading