Skip to content

Consolidate updates to dependencies #597

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

Merged
merged 41 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
2cb0226
Update dependabot.yml
gaby Mar 7, 2024
30e0c9d
Bump actions/setup-python from 4 to 5
dependabot[bot] Mar 7, 2024
d2620e2
Bump actions/cache from 3 to 4
dependabot[bot] Mar 7, 2024
90c2339
Bump github/codeql-action from 2 to 3
dependabot[bot] Mar 7, 2024
858d5d5
Bump rojopolis/spellcheck-github-actions from 0.33.1 to 0.36.0
dependabot[bot] Mar 7, 2024
ca052ae
Merge pull request #1 from gaby/dependabot/github_actions/actions/set…
gaby Mar 7, 2024
d16cf18
Merge pull request #2 from gaby/dependabot/github_actions/actions/cac…
gaby Mar 7, 2024
2228a6b
Bump actions/checkout from 3 to 4
dependabot[bot] Mar 7, 2024
24897f6
Update pytest-asyncio requirement from ^0.20.3 to ^0.23.5
dependabot[bot] Mar 7, 2024
84420cd
Merge pull request #5 from gaby/dependabot/github_actions/actions/che…
gaby Mar 7, 2024
9f38524
Merge pull request #4 from gaby/dependabot/github_actions/rojopolis/s…
gaby Mar 7, 2024
08786be
Merge pull request #3 from gaby/dependabot/github_actions/github/code…
gaby Mar 7, 2024
efa7581
Merge pull request #7 from gaby/dependabot/pip/pytest-asyncio-tw-0.23.5
gaby Mar 7, 2024
188f0a2
Add py3.12 and pypy-3.10
gaby Mar 7, 2024
34933ed
Update pytest requirement from ^7.1.3 to ^8.0.2
dependabot[bot] Mar 7, 2024
6168b5d
Merge pull request #10 from gaby/dependabot/pip/pytest-tw-8.0.2
gaby Mar 7, 2024
a5af2f7
Update more-itertools requirement from >=8.14,<10.0 to >=8.14,<11.0
dependabot[bot] Mar 7, 2024
8e85cd5
Update redis requirement from >=3.5.3,<5.0.0 to >=3.5.3,<6.0.0
dependabot[bot] Mar 7, 2024
54fc930
Update black requirement from ^23.1 to ^24.2
dependabot[bot] Mar 7, 2024
a8e5559
Merge pull request #12 from gaby/dependabot/pip/redis-gte-3.5.3-and-l…
gaby Mar 7, 2024
bf303af
Merge pull request #8 from gaby/dependabot/pip/more-itertools-gte-8.1…
gaby Mar 7, 2024
b46af5f
Merge pull request #11 from gaby/dependabot/pip/black-tw-24.2
gaby Mar 7, 2024
575d553
Update pydantic requirement from >=1.10.2,<2.1.0 to >=1.10.2,<2.7.0
dependabot[bot] Mar 7, 2024
f73d99c
Update pyproject.toml
gaby Mar 7, 2024
43c1261
Update pyproject.toml
gaby Mar 7, 2024
cb4ee8b
Merge pull request #6 from gaby/dependabot/pip/pydantic-gte-1.10.2-an…
gaby Mar 7, 2024
300e5e5
Update command for compose to v2
gaby Mar 7, 2024
4372df8
Fix formatting issues with black
gaby Mar 7, 2024
39f4ac3
Fix several typing issues
gaby Mar 7, 2024
e90b510
Bump tox to latest v3 release
gaby Mar 7, 2024
735d6c3
Update tox requirement from ^3.26.0 to ^4.14.1
dependabot[bot] Mar 7, 2024
1a9e5d5
Add py3.12 to pyproject.toml
gaby Mar 7, 2024
4a55301
Bump codecov/codecov-action from 3 to 4
dependabot[bot] Mar 7, 2024
3d277cf
Bump release-drafter/release-drafter from 5 to 6
dependabot[bot] Mar 7, 2024
0df286e
Merge pull request #14 from gaby/dependabot/github_actions/codecov/co…
gaby Mar 7, 2024
a99f290
Merge pull request #15 from gaby/dependabot/github_actions/release-dr…
gaby Mar 7, 2024
d609990
Merge pull request #9 from gaby/dependabot/pip/tox-tw-4.14.1
gaby Mar 7, 2024
ea59eea
setting up setuptools when python version >= 3.12
slorello89 Mar 22, 2024
539e7d4
moving escaped brace string interpolation into regular format methods…
slorello89 Mar 25, 2024
3bb6678
fixing for linter
slorello89 Mar 25, 2024
1610602
updating version
slorello89 Mar 26, 2024
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
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ jobs:
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Python 3.9
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{env.pythonversion}}
#----------------------------------------------
Expand All @@ -45,7 +45,7 @@ jobs:
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest ]
pyver: [ "3.8", "3.9", "3.10", "3.11", "pypy-3.8", "pypy-3.9" ]
pyver: [ "3.8", "3.9", "3.10", "3.11", "3.12", "pypy-3.8", "pypy-3.9", "pypy-3.10" ]
redisstack: [ "latest" ]
fail-fast: false
services:
Expand All @@ -98,9 +98,9 @@ jobs:
INSTALL_DIR: ${{ github.workspace }}/redis
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.pyver }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.pyver }}
#----------------------------------------------
Expand All @@ -117,7 +117,7 @@ jobs:
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
Expand All @@ -144,7 +144,7 @@ jobs:
make test
poetry run coverage xml
- name: Upload coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
flags: unit
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
4 changes: 2 additions & 2 deletions .github/workflows/pypi-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ jobs:
value: "${{ steps.get_version.outputs.VERSION }}"

- name: Set up Python 3.9
uses: actions/setup-python@v4.3.0
uses: actions/setup-python@v5
with:
python-version: 3.9

- name: Cache Poetry virtualenv
uses: actions/cache@v3.0.11
uses: actions/cache@v4
id: cache
with:
path: ~/.virtualenvs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
- uses: release-drafter/release-drafter@v6
with:
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
config-name: release-drafter-config.yml
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Check Spelling
uses: rojopolis/spellcheck-github-actions@0.33.1
uses: rojopolis/spellcheck-github-actions@0.36.0
with:
config_path: .github/spellcheck-settings.yml
task_name: Markdown
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ clean:
rm -rf dist
rm -rf redis_om
rm -rf tests_sync
docker-compose down
docker compose down


.PHONY: dist
Expand All @@ -65,7 +65,7 @@ format: $(INSTALL_STAMP) sync
.PHONY: test
test: $(INSTALL_STAMP) sync redis
REDIS_OM_URL="$(REDIS_OM_URL)" $(POETRY) run pytest -n auto -vv ./tests/ ./tests_sync/ --cov-report term-missing --cov $(NAME) $(SYNC_NAME)
docker-compose down
docker compose down

.PHONY: test_oss
test_oss: $(INSTALL_STAMP) sync redis
Expand All @@ -81,7 +81,7 @@ shell: $(INSTALL_STAMP)

.PHONY: redis
redis:
docker-compose up -d
docker compose up -d

.PHONY: all
all: lint format test
2 changes: 1 addition & 1 deletion aredis_om/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
FindQuery,
HashModel,
JsonModel,
VectorFieldOptions,
KNNExpression,
NotFoundError,
QueryNotSupportedError,
QuerySyntaxError,
RedisModel,
RedisModelError,
VectorFieldOptions,
)
2 changes: 1 addition & 1 deletion aredis_om/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
Field,
HashModel,
JsonModel,
VectorFieldOptions,
KNNExpression,
NotFoundError,
RedisModel,
VectorFieldOptions,
)
36 changes: 25 additions & 11 deletions aredis_om/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,20 +630,30 @@ def resolve_value(
values: filter = filter(None, value.split(separator_char))
for value in values:
value = escaper.escape(value)
result += f"@{field_name}:{{{value}}}"
result += "@{field_name}:{{{value}}}".format(
field_name=field_name, value=value
)
else:
value = escaper.escape(value)
result += f"@{field_name}:{{{value}}}"
result += "@{field_name}:{{{value}}}".format(
field_name=field_name, value=value
)
elif op is Operators.NE:
value = escaper.escape(value)
result += f"-(@{field_name}:{{{value}}})"
result += "-(@{field_name}:{{{value}}})".format(
field_name=field_name, value=value
)
elif op is Operators.IN:
expanded_value = cls.expand_tag_value(value)
result += f"(@{field_name}:{{{expanded_value}}})"
result += "(@{field_name}:{{{expanded_value}}})".format(
field_name=field_name, expanded_value=expanded_value
)
elif op is Operators.NOT_IN:
# TODO: Implement NOT_IN, test this...
expanded_value = cls.expand_tag_value(value)
result += f"-(@{field_name}:{{{expanded_value}}})"
result += "-(@{field_name}):{{{expanded_value}}}".format(
field_name=field_name, expanded_value=expanded_value
)

return result

Expand Down Expand Up @@ -1525,9 +1535,11 @@ async def all_pks(cls): # type: ignore
# TODO: We need to decide how we want to handle the lack of
# decode_responses=True...
return (
remove_prefix(key, key_prefix)
if isinstance(key, str)
else remove_prefix(key.decode(cls.Meta.encoding), key_prefix)
(
remove_prefix(key, key_prefix)
if isinstance(key, str)
else remove_prefix(key.decode(cls.Meta.encoding), key_prefix)
)
async for key in cls.db().scan_iter(f"{key_prefix}*", _type="HASH")
)

Expand Down Expand Up @@ -1698,9 +1710,11 @@ async def all_pks(cls): # type: ignore
# TODO: We need to decide how we want to handle the lack of
# decode_responses=True...
return (
remove_prefix(key, key_prefix)
if isinstance(key, str)
else remove_prefix(key.decode(cls.Meta.encoding), key_prefix)
(
remove_prefix(key, key_prefix)
if isinstance(key, str)
else remove_prefix(key.decode(cls.Meta.encoding), key_prefix)
)
async for key in cls.db().scan_iter(f"{key_prefix}*", _type="ReJSON-RL")
)

Expand Down
4 changes: 2 additions & 2 deletions aredis_om/model/query_resolver.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import List, Mapping
from typing import List, Mapping, Optional

from aredis_om.model.model import Expression

Expand Down Expand Up @@ -100,5 +100,5 @@ class QueryResolver:
def __init__(self, *expressions: Expression):
self.expressions = expressions

def resolve(self) -> str:
def resolve(self) -> Optional[str]:
"""Resolve expressions to a RediSearch query string."""
18 changes: 10 additions & 8 deletions aredis_om/model/render_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@
This code adapted from the library "pptree," Copyright (c) 2017 Clément Michard
and released under the MIT license: https://github.com/clemtoy/pptree
"""

import io
from typing import Any, Optional


def render_tree(
current_node,
nameattr="name",
left_child="left",
right_child="right",
indent="",
last="updown",
buffer=None,
):
current_node: Any,
nameattr: str = "name",
left_child: str = "left",
right_child: str = "right",
indent: str = "",
last: str = "updown",
buffer: Optional[io.StringIO] = None,
) -> str:
"""Print a tree-like structure, `current_node`.

This is a mostly-direct-copy of the print_tree() function from the ppbtree
Expand Down
6 changes: 3 additions & 3 deletions aredis_om/model/token_escaper.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import re
from typing import Optional, Pattern
from typing import Match, Optional, Pattern


class TokenEscaper:
Expand All @@ -11,14 +11,14 @@ class TokenEscaper:
# Source: https://redis.io/docs/stack/search/reference/escaping/#the-rules-of-text-field-tokenization
DEFAULT_ESCAPED_CHARS = r"[,.<>{}\[\]\\\"\':;!@#$%^&*()\-+=~\/ ]"

def __init__(self, escape_chars_re: Optional[Pattern] = None):
def __init__(self, escape_chars_re: Optional[Pattern[str]] = None):
if escape_chars_re:
self.escaped_chars_re = escape_chars_re
else:
self.escaped_chars_re = re.compile(self.DEFAULT_ESCAPED_CHARS)

def escape(self, value: str) -> str:
def escape_symbol(match):
def escape_symbol(match: Match[str]) -> str:
value = match.group(0)
return f"\\{value}"

Expand Down
4 changes: 2 additions & 2 deletions aredis_om/util.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import inspect


def is_async_mode():
async def f():
def is_async_mode() -> bool:
async def f() -> None:
"""Unasync transforms async functions in sync functions"""
return None

Expand Down
2 changes: 1 addition & 1 deletion docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ andrew.key()
With the model's Redis key, you can start `redis-cli` and inspect the data stored under that key. Here, we run `JSON.GET` command with `redis-cli` using the running "redis" container that this project's Docker Compose file defines:

```
$ docker-compose exec -T redis redis-cli HGETALL mymodel.Customer:01FKGX1DFEV9Z2XKF59WQ6DC9r
$ docker compose exec -T redis redis-cli HGETALL mymodel.Customer:01FKGX1DFEV9Z2XKF59WQ6DC9r

1) "pk"
2) "01FKGX1DFEV9Z2XKF59WQ6DC9T"
Expand Down
21 changes: 13 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "redis-om"
version = "0.2.1"
version = "0.2.2"
description = "Object mappings, and more, for Redis."
authors = ["Redis OSS <[email protected]>"]
maintainers = ["Redis OSS <[email protected]>"]
Expand All @@ -21,6 +21,7 @@ classifiers = [
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python',
]
include=[
Expand All @@ -35,30 +36,31 @@ include=[

[tool.poetry.dependencies]
python = ">=3.8,<4.0"
redis = ">=3.5.3,<5.0.0"
pydantic = ">=1.10.2,<2.1.0"
redis = ">=3.5.3,<6.0.0"
pydantic = ">=1.10.2,<2.5.0"
click = "^8.0.1"
types-redis = ">=3.5.9,<5.0.0"
python-ulid = "^1.0.3"
typing-extensions = "^4.4.0"
hiredis = "^2.2.3"
more-itertools = ">=8.14,<10.0"
more-itertools = ">=8.14,<11.0"
setuptools = {version = "^69.2.0", markers = "python_version >= '3.12'"}

[tool.poetry.dev-dependencies]
mypy = "^0.982"
pytest = "^7.1.3"
pytest = "^8.0.2"
ipdb = "^0.13.9"
black = "^23.1"
black = "^24.2"
isort = "^5.9.3"
flake8 = "^5.0.4"
bandit = "^1.7.4"
coverage = "^7.1"
pytest-cov = "^4.0.0"
pytest-xdist = "^3.1.0"
unasync = "^0.5.0"
pytest-asyncio = "^0.20.3"
pytest-asyncio = "^0.23.5"
email-validator = "^2.0.0"
tox = "^3.26.0"
tox = "^4.14.1"
tox-pyenv = "^1.1.0"

[tool.poetry.scripts]
Expand All @@ -67,3 +69,6 @@ migrate = "redis_om.model.cli.migrate:migrate"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"



2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
skipsdist = true
envlist = py37, py38, py39, py310, py311
envlist = py38, py39, py310, py311, py312

[testenv]
whitelist_externals = poetry
Expand Down