Skip to content

Commit

Permalink
Consolidate updates to dependencies (#597)
Browse files Browse the repository at this point in the history
* 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] <support@github.com>

* 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] <support@github.com>

* 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] <support@github.com>

* 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] <support@github.com>

* 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] <support@github.com>

* 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] <support@github.com>

* 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] <support@github.com>

* 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] <support@github.com>

* 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] <support@github.com>

* 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] <support@github.com>

* 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] <support@github.com>

* 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] <support@github.com>

* 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] <support@github.com>

* 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] <support@github.com>

* 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] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: slorello89 <steve.lorello@redis.com>
  • Loading branch information
3 people committed Mar 26, 2024
1 parent 1213ca7 commit dabd0fc
Show file tree
Hide file tree
Showing 16 changed files with 78 additions and 57 deletions.
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 <oss@redis.com>"]
maintainers = ["Redis OSS <oss@redis.com>"]
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

0 comments on commit dabd0fc

Please sign in to comment.