Skip to content

Commit dabd0fc

Browse files
gabydependabot[bot]slorello89
authored
Consolidate updates to dependencies (#597)
* Update dependabot.yml * Bump actions/setup-python from 4 to 5 Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](actions/setup-python@v4...v5) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * Bump actions/cache from 3 to 4 Bumps [actions/cache](https://github.com/actions/cache) from 3 to 4. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](actions/cache@v3...v4) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * Bump github/codeql-action from 2 to 3 Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 3. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](github/codeql-action@v2...v3) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * Bump rojopolis/spellcheck-github-actions from 0.33.1 to 0.36.0 Bumps [rojopolis/spellcheck-github-actions](https://github.com/rojopolis/spellcheck-github-actions) from 0.33.1 to 0.36.0. - [Release notes](https://github.com/rojopolis/spellcheck-github-actions/releases) - [Changelog](https://github.com/rojopolis/spellcheck-github-actions/blob/master/CHANGELOG.md) - [Commits](rojopolis/spellcheck-github-actions@0.33.1...0.36.0) --- updated-dependencies: - dependency-name: rojopolis/spellcheck-github-actions dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * Bump actions/checkout from 3 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * Update pytest-asyncio requirement from ^0.20.3 to ^0.23.5 Updates the requirements on [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) to permit the latest version. - [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases) - [Commits](pytest-dev/pytest-asyncio@v0.20.3...v0.23.5) --- updated-dependencies: - dependency-name: pytest-asyncio dependency-type: direct:development ... Signed-off-by: dependabot[bot] <[email protected]> * Add py3.12 and pypy-3.10 * Update pytest requirement from ^7.1.3 to ^8.0.2 Updates the requirements on [pytest](https://github.com/pytest-dev/pytest) to permit the latest version. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](pytest-dev/pytest@7.1.3...8.0.2) --- updated-dependencies: - dependency-name: pytest dependency-type: direct:development ... Signed-off-by: dependabot[bot] <[email protected]> * Update more-itertools requirement from >=8.14,<10.0 to >=8.14,<11.0 Updates the requirements on [more-itertools](https://github.com/more-itertools/more-itertools) to permit the latest version. - [Release notes](https://github.com/more-itertools/more-itertools/releases) - [Commits](more-itertools/more-itertools@v8.14.0...v10.2.0) --- updated-dependencies: - dependency-name: more-itertools dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> * Update redis requirement from >=3.5.3,<5.0.0 to >=3.5.3,<6.0.0 Updates the requirements on [redis](https://github.com/redis/redis-py) to permit the latest version. - [Release notes](https://github.com/redis/redis-py/releases) - [Changelog](https://github.com/redis/redis-py/blob/master/CHANGES) - [Commits](redis/redis-py@3.5.3...v5.0.2) --- updated-dependencies: - dependency-name: redis dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> * Update black requirement from ^23.1 to ^24.2 Updates the requirements on [black](https://github.com/psf/black) to permit the latest version. - [Release notes](https://github.com/psf/black/releases) - [Changelog](https://github.com/psf/black/blob/main/CHANGES.md) - [Commits](psf/black@23.1.0...24.2.0) --- updated-dependencies: - dependency-name: black dependency-type: direct:development ... Signed-off-by: dependabot[bot] <[email protected]> * Update pydantic requirement from >=1.10.2,<2.1.0 to >=1.10.2,<2.7.0 Updates the requirements on [pydantic](https://github.com/pydantic/pydantic) to permit the latest version. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](pydantic/pydantic@v1.10.2...v2.6.3) --- updated-dependencies: - dependency-name: pydantic dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> * Update pyproject.toml * Update pyproject.toml * Update command for compose to v2 * Fix formatting issues with black * Fix several typing issues * Bump tox to latest v3 release * Update tox requirement from ^3.26.0 to ^4.14.1 Updates the requirements on [tox](https://github.com/tox-dev/tox) to permit the latest version. - [Release notes](https://github.com/tox-dev/tox/releases) - [Changelog](https://github.com/tox-dev/tox/blob/main/docs/changelog.rst) - [Commits](tox-dev/tox@3.26.0...4.14.1) --- updated-dependencies: - dependency-name: tox dependency-type: direct:development ... Signed-off-by: dependabot[bot] <[email protected]> * Add py3.12 to pyproject.toml * Bump codecov/codecov-action from 3 to 4 Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3 to 4. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@v3...v4) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * Bump release-drafter/release-drafter from 5 to 6 Bumps [release-drafter/release-drafter](https://github.com/release-drafter/release-drafter) from 5 to 6. - [Release notes](https://github.com/release-drafter/release-drafter/releases) - [Commits](release-drafter/release-drafter@v5...v6) --- updated-dependencies: - dependency-name: release-drafter/release-drafter dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * setting up setuptools when python version >= 3.12 * moving escaped brace string interpolation into regular format methods to dodge PEP-701 tokenizer issue in unasync * fixing for linter * updating version --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: slorello89 <[email protected]>
1 parent 1213ca7 commit dabd0fc

16 files changed

+78
-57
lines changed

.github/workflows/ci.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ jobs:
2626
timeout-minutes: 5
2727
steps:
2828
- name: Checkout
29-
uses: actions/checkout@v3
29+
uses: actions/checkout@v4
3030
- name: Setup Python 3.9
31-
uses: actions/setup-python@v4
31+
uses: actions/setup-python@v5
3232
with:
3333
python-version: ${{env.pythonversion}}
3434
#----------------------------------------------
@@ -45,7 +45,7 @@ jobs:
4545
#----------------------------------------------
4646
- name: Load cached venv
4747
id: cached-poetry-dependencies
48-
uses: actions/cache@v3
48+
uses: actions/cache@v4
4949
with:
5050
path: .venv
5151
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
@@ -76,7 +76,7 @@ jobs:
7676
strategy:
7777
matrix:
7878
os: [ ubuntu-latest ]
79-
pyver: [ "3.8", "3.9", "3.10", "3.11", "pypy-3.8", "pypy-3.9" ]
79+
pyver: [ "3.8", "3.9", "3.10", "3.11", "3.12", "pypy-3.8", "pypy-3.9", "pypy-3.10" ]
8080
redisstack: [ "latest" ]
8181
fail-fast: false
8282
services:
@@ -98,9 +98,9 @@ jobs:
9898
INSTALL_DIR: ${{ github.workspace }}/redis
9999
steps:
100100
- name: Checkout
101-
uses: actions/checkout@v3
101+
uses: actions/checkout@v4
102102
- name: Setup Python ${{ matrix.pyver }}
103-
uses: actions/setup-python@v4
103+
uses: actions/setup-python@v5
104104
with:
105105
python-version: ${{ matrix.pyver }}
106106
#----------------------------------------------
@@ -117,7 +117,7 @@ jobs:
117117
#----------------------------------------------
118118
- name: Load cached venv
119119
id: cached-poetry-dependencies
120-
uses: actions/cache@v3
120+
uses: actions/cache@v4
121121
with:
122122
path: .venv
123123
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
@@ -144,7 +144,7 @@ jobs:
144144
make test
145145
poetry run coverage xml
146146
- name: Upload coverage
147-
uses: codecov/codecov-action@v3
147+
uses: codecov/codecov-action@v4
148148
with:
149149
file: ./coverage.xml
150150
flags: unit

.github/workflows/codeql.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ jobs:
2525

2626
steps:
2727
- name: Checkout repository
28-
uses: actions/checkout@v3
28+
uses: actions/checkout@v4
2929

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

3636
- name: Perform CodeQL Analysis
37-
uses: github/codeql-action/analyze@v2
37+
uses: github/codeql-action/analyze@v3

.github/workflows/pypi-publish.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ jobs:
2727
value: "${{ steps.get_version.outputs.VERSION }}"
2828

2929
- name: Set up Python 3.9
30-
uses: actions/setup-python@v4.3.0
30+
uses: actions/setup-python@v5
3131
with:
3232
python-version: 3.9
3333

3434
- name: Cache Poetry virtualenv
35-
uses: actions/cache@v3.0.11
35+
uses: actions/cache@v4
3636
id: cache
3737
with:
3838
path: ~/.virtualenvs

.github/workflows/release-drafter.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
# Drafts your next Release notes as Pull Requests are merged into "master"
14-
- uses: release-drafter/release-drafter@v5
14+
- uses: release-drafter/release-drafter@v6
1515
with:
1616
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
1717
config-name: release-drafter-config.yml

.github/workflows/spellcheck.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ jobs:
66
runs-on: ubuntu-latest
77
steps:
88
- name: Checkout
9-
uses: actions/checkout@v3
9+
uses: actions/checkout@v4
1010
- name: Check Spelling
11-
uses: rojopolis/spellcheck-github-actions@0.33.1
11+
uses: rojopolis/spellcheck-github-actions@0.36.0
1212
with:
1313
config_path: .github/spellcheck-settings.yml
1414
task_name: Markdown

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ clean:
3838
rm -rf dist
3939
rm -rf redis_om
4040
rm -rf tests_sync
41-
docker-compose down
41+
docker compose down
4242

4343

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

7070
.PHONY: test_oss
7171
test_oss: $(INSTALL_STAMP) sync redis
@@ -81,7 +81,7 @@ shell: $(INSTALL_STAMP)
8181

8282
.PHONY: redis
8383
redis:
84-
docker-compose up -d
84+
docker compose up -d
8585

8686
.PHONY: all
8787
all: lint format test

aredis_om/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
FindQuery,
99
HashModel,
1010
JsonModel,
11-
VectorFieldOptions,
1211
KNNExpression,
1312
NotFoundError,
1413
QueryNotSupportedError,
1514
QuerySyntaxError,
1615
RedisModel,
1716
RedisModelError,
17+
VectorFieldOptions,
1818
)

aredis_om/model/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
Field,
55
HashModel,
66
JsonModel,
7-
VectorFieldOptions,
87
KNNExpression,
98
NotFoundError,
109
RedisModel,
10+
VectorFieldOptions,
1111
)

aredis_om/model/model.py

+25-11
Original file line numberDiff line numberDiff line change
@@ -630,20 +630,30 @@ def resolve_value(
630630
values: filter = filter(None, value.split(separator_char))
631631
for value in values:
632632
value = escaper.escape(value)
633-
result += f"@{field_name}:{{{value}}}"
633+
result += "@{field_name}:{{{value}}}".format(
634+
field_name=field_name, value=value
635+
)
634636
else:
635637
value = escaper.escape(value)
636-
result += f"@{field_name}:{{{value}}}"
638+
result += "@{field_name}:{{{value}}}".format(
639+
field_name=field_name, value=value
640+
)
637641
elif op is Operators.NE:
638642
value = escaper.escape(value)
639-
result += f"-(@{field_name}:{{{value}}})"
643+
result += "-(@{field_name}:{{{value}}})".format(
644+
field_name=field_name, value=value
645+
)
640646
elif op is Operators.IN:
641647
expanded_value = cls.expand_tag_value(value)
642-
result += f"(@{field_name}:{{{expanded_value}}})"
648+
result += "(@{field_name}:{{{expanded_value}}})".format(
649+
field_name=field_name, expanded_value=expanded_value
650+
)
643651
elif op is Operators.NOT_IN:
644652
# TODO: Implement NOT_IN, test this...
645653
expanded_value = cls.expand_tag_value(value)
646-
result += f"-(@{field_name}:{{{expanded_value}}})"
654+
result += "-(@{field_name}):{{{expanded_value}}}".format(
655+
field_name=field_name, expanded_value=expanded_value
656+
)
647657

648658
return result
649659

@@ -1525,9 +1535,11 @@ async def all_pks(cls): # type: ignore
15251535
# TODO: We need to decide how we want to handle the lack of
15261536
# decode_responses=True...
15271537
return (
1528-
remove_prefix(key, key_prefix)
1529-
if isinstance(key, str)
1530-
else remove_prefix(key.decode(cls.Meta.encoding), key_prefix)
1538+
(
1539+
remove_prefix(key, key_prefix)
1540+
if isinstance(key, str)
1541+
else remove_prefix(key.decode(cls.Meta.encoding), key_prefix)
1542+
)
15311543
async for key in cls.db().scan_iter(f"{key_prefix}*", _type="HASH")
15321544
)
15331545

@@ -1698,9 +1710,11 @@ async def all_pks(cls): # type: ignore
16981710
# TODO: We need to decide how we want to handle the lack of
16991711
# decode_responses=True...
17001712
return (
1701-
remove_prefix(key, key_prefix)
1702-
if isinstance(key, str)
1703-
else remove_prefix(key.decode(cls.Meta.encoding), key_prefix)
1713+
(
1714+
remove_prefix(key, key_prefix)
1715+
if isinstance(key, str)
1716+
else remove_prefix(key.decode(cls.Meta.encoding), key_prefix)
1717+
)
17041718
async for key in cls.db().scan_iter(f"{key_prefix}*", _type="ReJSON-RL")
17051719
)
17061720

aredis_om/model/query_resolver.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import List, Mapping
1+
from typing import List, Mapping, Optional
22

33
from aredis_om.model.model import Expression
44

@@ -100,5 +100,5 @@ class QueryResolver:
100100
def __init__(self, *expressions: Expression):
101101
self.expressions = expressions
102102

103-
def resolve(self) -> str:
103+
def resolve(self) -> Optional[str]:
104104
"""Resolve expressions to a RediSearch query string."""

aredis_om/model/render_tree.py

+10-8
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@
22
This code adapted from the library "pptree," Copyright (c) 2017 Clément Michard
33
and released under the MIT license: https://github.com/clemtoy/pptree
44
"""
5+
56
import io
7+
from typing import Any, Optional
68

79

810
def render_tree(
9-
current_node,
10-
nameattr="name",
11-
left_child="left",
12-
right_child="right",
13-
indent="",
14-
last="updown",
15-
buffer=None,
16-
):
11+
current_node: Any,
12+
nameattr: str = "name",
13+
left_child: str = "left",
14+
right_child: str = "right",
15+
indent: str = "",
16+
last: str = "updown",
17+
buffer: Optional[io.StringIO] = None,
18+
) -> str:
1719
"""Print a tree-like structure, `current_node`.
1820
1921
This is a mostly-direct-copy of the print_tree() function from the ppbtree

aredis_om/model/token_escaper.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import re
2-
from typing import Optional, Pattern
2+
from typing import Match, Optional, Pattern
33

44

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

14-
def __init__(self, escape_chars_re: Optional[Pattern] = None):
14+
def __init__(self, escape_chars_re: Optional[Pattern[str]] = None):
1515
if escape_chars_re:
1616
self.escaped_chars_re = escape_chars_re
1717
else:
1818
self.escaped_chars_re = re.compile(self.DEFAULT_ESCAPED_CHARS)
1919

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

aredis_om/util.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import inspect
22

33

4-
def is_async_mode():
5-
async def f():
4+
def is_async_mode() -> bool:
5+
async def f() -> None:
66
"""Unasync transforms async functions in sync functions"""
77
return None
88

docs/getting_started.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ andrew.key()
603603
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:
604604

605605
```
606-
$ docker-compose exec -T redis redis-cli HGETALL mymodel.Customer:01FKGX1DFEV9Z2XKF59WQ6DC9r
606+
$ docker compose exec -T redis redis-cli HGETALL mymodel.Customer:01FKGX1DFEV9Z2XKF59WQ6DC9r
607607
608608
1) "pk"
609609
2) "01FKGX1DFEV9Z2XKF59WQ6DC9T"

pyproject.toml

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "redis-om"
3-
version = "0.2.1"
3+
version = "0.2.2"
44
description = "Object mappings, and more, for Redis."
55
authors = ["Redis OSS <[email protected]>"]
66
maintainers = ["Redis OSS <[email protected]>"]
@@ -21,6 +21,7 @@ classifiers = [
2121
'Programming Language :: Python :: 3.9',
2222
'Programming Language :: Python :: 3.10',
2323
'Programming Language :: Python :: 3.11',
24+
'Programming Language :: Python :: 3.12',
2425
'Programming Language :: Python',
2526
]
2627
include=[
@@ -35,30 +36,31 @@ include=[
3536

3637
[tool.poetry.dependencies]
3738
python = ">=3.8,<4.0"
38-
redis = ">=3.5.3,<5.0.0"
39-
pydantic = ">=1.10.2,<2.1.0"
39+
redis = ">=3.5.3,<6.0.0"
40+
pydantic = ">=1.10.2,<2.5.0"
4041
click = "^8.0.1"
4142
types-redis = ">=3.5.9,<5.0.0"
4243
python-ulid = "^1.0.3"
4344
typing-extensions = "^4.4.0"
4445
hiredis = "^2.2.3"
45-
more-itertools = ">=8.14,<10.0"
46+
more-itertools = ">=8.14,<11.0"
47+
setuptools = {version = "^69.2.0", markers = "python_version >= '3.12'"}
4648

4749
[tool.poetry.dev-dependencies]
4850
mypy = "^0.982"
49-
pytest = "^7.1.3"
51+
pytest = "^8.0.2"
5052
ipdb = "^0.13.9"
51-
black = "^23.1"
53+
black = "^24.2"
5254
isort = "^5.9.3"
5355
flake8 = "^5.0.4"
5456
bandit = "^1.7.4"
5557
coverage = "^7.1"
5658
pytest-cov = "^4.0.0"
5759
pytest-xdist = "^3.1.0"
5860
unasync = "^0.5.0"
59-
pytest-asyncio = "^0.20.3"
61+
pytest-asyncio = "^0.23.5"
6062
email-validator = "^2.0.0"
61-
tox = "^3.26.0"
63+
tox = "^4.14.1"
6264
tox-pyenv = "^1.1.0"
6365

6466
[tool.poetry.scripts]
@@ -67,3 +69,6 @@ migrate = "redis_om.model.cli.migrate:migrate"
6769
[build-system]
6870
requires = ["poetry-core>=1.0.0"]
6971
build-backend = "poetry.core.masonry.api"
72+
73+
74+

tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tox]
22
skipsdist = true
3-
envlist = py37, py38, py39, py310, py311
3+
envlist = py38, py39, py310, py311, py312
44

55
[testenv]
66
whitelist_externals = poetry

0 commit comments

Comments
 (0)