Skip to content
Merged
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
25 changes: 17 additions & 8 deletions make_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
"AsyncMock": "Mock",
# RedisVL uses SearchIndex for sync, not SyncSearchIndex
"AsyncSearchIndex": "SearchIndex",
# Fix supports_hash_field_expiration to check sync Redis class
"redis_lib.asyncio.Redis": "redis_lib.Redis",
}


Expand Down Expand Up @@ -75,39 +77,39 @@ def main():
"redis_om/model/cli/migrate_data.py",
"redis_om/model/cli/migrate.py"
]

for cli_file in cli_files:
file_path = Path(__file__).absolute().parent / cli_file
if file_path.exists():
with open(file_path, 'r') as f:
content = f.read()

# Remove run_async() call wrappers (not the function definition)
# Only match run_async() calls that are not function definitions
def remove_run_async_call(match):
inner_content = match.group(1)
return inner_content

# Pattern to match run_async() function calls (not definitions)
# Look for = or return statements followed by run_async(...)
lines = content.split('\n')
new_lines = []

for line in lines:
# Skip function definitions
if 'def run_async(' in line:
new_lines.append(line)
continue

# Replace run_async() calls
if 'run_async(' in line and ('=' in line or 'return ' in line or line.strip().startswith('run_async(')):
# Simple pattern for function calls
line = re.sub(r'run_async\(([^)]+(?:\([^)]*\)[^)]*)*)\)', r'\1', line)

new_lines.append(line)

content = '\n'.join(new_lines)

with open(file_path, 'w') as f:
f.write(content)

Expand All @@ -117,6 +119,13 @@ def remove_run_async_call(match):
with open(model_file, 'r') as f:
content = f.read()

# Fix supports_hash_field_expiration to check sync Redis class
# The unasync replacement doesn't work for dotted attribute access
content = content.replace(
'redis_lib.asyncio.Redis',
'redis_lib.Redis'
)

# Fix Pipeline import: redis.asyncio.client -> redis.client
content = content.replace(
'from redis.asyncio.client import Pipeline',
Expand Down
13 changes: 12 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "redis-om"
version = "1.0.5"
version = "1.0.6"
description = "Object mappings, and more, for Redis."
authors = [{ name = "Redis OSS", email = "oss@redis.com" }]
maintainers = [{ name = "Redis OSS", email = "oss@redis.com" }]
Expand Down Expand Up @@ -81,12 +81,23 @@ build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["aredis_om", "redis_om"]
# Include generated sync code (redis_om/) that is in .gitignore
# These files are created by `make sync` before building
artifacts = [
"redis_om/**/*",
"tests_sync/**/*",
]

[tool.hatch.build.targets.sdist]
include = [
"aredis_om/**/*",
"redis_om/**/*",
]
# Include generated sync code (redis_om/) that is in .gitignore
artifacts = [
"redis_om/**/*",
"tests_sync/**/*",
]



Loading