Skip to content

Commit 40f2ceb

Browse files
authored
Merge branch 'main' into feature/save-nx-xx-flags
2 parents 4651c59 + 82b917c commit 40f2ceb

File tree

10 files changed

+74
-17
lines changed

10 files changed

+74
-17
lines changed

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,13 @@ dmypy.json
134134
.install.stamp
135135

136136
# Sync version of the library, via Unasync
137-
redis_om/
137+
# Note: redis_om/ contains placeholder files that ARE tracked:
138+
# - README.md (documentation)
139+
# - __init__.py (so Poetry recognizes it as a package)
140+
# All other files in redis_om/ are generated by `make sync` and ignored.
141+
redis_om/*
142+
!redis_om/README.md
143+
!redis_om/__init__.py
138144
tests_sync/
139145

140146
# Apple Files

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,9 @@ For feature requests, please describe:
330330

331331
## Additional Resources
332332

333-
- [Redis OM Documentation](https://redis.io/docs/stack/get-started/tutorials/stack-python/)
334-
- [RediSearch Documentation](https://redis.io/docs/stack/search/)
335-
- [RedisJSON Documentation](https://redis.io/docs/stack/json/)
333+
- [Redis OM Documentation](https://redis.io/docs/latest/develop/clients/redis-py/)
334+
- [RediSearch Documentation](https://redis.io/docs/latest/develop/interact/search-and-query/)
335+
- [RedisJSON Documentation](https://redis.io/docs/latest/develop/data-types/json/)
336336
- [Pydantic Documentation](https://docs.pydantic.dev/)
337337

338338
## Getting Help

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Before writing any code you'll need a Redis instance with the appropriate Redis
8080
docker run -p 6379:6379 -p 8001:8001 redis/redis-stack
8181
```
8282

83-
This launches the [redis-stack](https://redis.io/docs/stack/) an extension of Redis that adds all manner of modern data structures to Redis. You'll also notice that if you open up http://localhost:8001 you'll have access to the redis-insight GUI, a GUI you can use to visualize and work with your data in Redis.
83+
This launches the [redis-stack](https://redis.io/docs/latest/) an extension of Redis that adds all manner of modern data structures to Redis. You'll also notice that if you open up http://localhost:8001 you'll have access to the redis-insight GUI, a GUI you can use to visualize and work with your data in Redis.
8484

8585

8686
## 📇 Modeling Your Data
@@ -424,8 +424,8 @@ Redis OM uses the [MIT license][license-url].
424424
[redis-om-js]: https://github.com/redis-om/redis-om-js
425425
[redis-om-dotnet]: https://github.com/redis-om/redis-om-dotnet
426426
[redis-om-spring]: https://github.com/redis-om/redis-om-spring
427-
[redisearch-url]: https://redis.io/docs/stack/search/
428-
[redis-json-url]: https://redis.io/docs/stack/json/
427+
[redisearch-url]: https://redis.io/docs/latest/develop/interact/search-and-query/
428+
[redis-json-url]: https://redis.io/docs/latest/develop/data-types/json/
429429
[pydantic-url]: https://github.com/samuelcolvin/pydantic
430430
[ulid-url]: https://github.com/ulid/spec
431431
[redis-enterprise-url]: https://redis.com/try-free/

aredis_om/model/token_escaper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class TokenEscaper:
88
"""
99

1010
# Characters that RediSearch requires us to escape during queries.
11-
# Source: https://redis.io/docs/stack/search/reference/escaping/#the-rules-of-text-field-tokenization
11+
# Source: https://redis.io/docs/latest/develop/interact/search-and-query/advanced-concepts/escaping/
1212
DEFAULT_ESCAPED_CHARS = r"[,.<>{}\[\]\\\"\':;!@#$%^&*()\-+=~\/ ]"
1313

1414
def __init__(self, escape_chars_re: Optional[Pattern[str]] = None):

docs/getting_started.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,6 @@ If you're a FastAPI user, check out [how to integrate Redis OM with FastAPI](htt
765765

766766
<!-- Links -->
767767

768-
[redisearch-url]: https://redis.io/docs/stack/search/
769-
[redis-json-url]: https://redis.io/docs/stack/json/
768+
[redisearch-url]: https://redis.io/docs/latest/develop/interact/search-and-query/
769+
[redis-json-url]: https://redis.io/docs/latest/develop/data-types/json/
770770
[pydantic-url]: https://github.com/samuelcolvin/pydantic

docs/redis_modules.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ So, what won't work without these modules?
2222

2323
You can use RediSearch and RedisJSON with your self-hosted Redis deployment. Just follow the instructions on installing the binary versions of the modules in their Quick Start Guides:
2424

25-
- [RedisJSON Quick Start - Running Binaries](https://redis.io/docs/stack/json/)
26-
- [RediSearch Quick Start - Running Binaries](https://redis.io/docs/stack/search/quick_start/)
25+
- [RedisJSON Quick Start - Running Binaries](https://redis.io/docs/latest/develop/data-types/json/)
26+
- [RediSearch Quick Start - Running Binaries](https://redis.io/docs/latest/develop/get-started/document-database/)
2727

2828
**NOTE**: Both of these modules' Quick Start Guides also have instructions on how to run the modules in Redis with Docker.
2929

make_sync.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import os
22
import re
3+
import shutil
34
from pathlib import Path
45

56
import unasync
67

8+
# Files to preserve in redis_om/ directory (not overwritten by sync)
9+
PRESERVED_FILES = {"README.md"}
10+
711
ADDITIONAL_REPLACEMENTS = {
812
"aredis_om": "redis_om",
913
"async_redis": "sync_redis",
@@ -14,7 +18,28 @@
1418
}
1519

1620

21+
def clean_generated_dir(dirpath: Path, preserved: set):
22+
"""Remove generated files from a directory while preserving specified files."""
23+
if not dirpath.exists():
24+
return
25+
for item in dirpath.iterdir():
26+
if item.name in preserved:
27+
continue
28+
if item.is_dir():
29+
shutil.rmtree(item)
30+
else:
31+
item.unlink()
32+
33+
1734
def main():
35+
base_dir = Path(__file__).absolute().parent
36+
37+
# Clean generated directories before regenerating (preserve README.md)
38+
redis_om_dir = base_dir / "redis_om"
39+
tests_sync_dir = base_dir / "tests_sync"
40+
clean_generated_dir(redis_om_dir, PRESERVED_FILES)
41+
clean_generated_dir(tests_sync_dir, set())
42+
1843
rules = [
1944
unasync.Rule(
2045
fromdir="/aredis_om/",
@@ -28,7 +53,7 @@ def main():
2853
),
2954
]
3055
filepaths = []
31-
for root, _, filenames in os.walk(Path(__file__).absolute().parent):
56+
for root, _, filenames in os.walk(base_dir):
3257
for filename in filenames:
3358
if filename.rpartition(".")[-1] in (
3459
"py",

pyproject.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ readme = "README.md"
99
repository = "https://github.com/redis/redis-om-python"
1010
packages = [
1111
{ "include" = "aredis_om" },
12+
{ "include" = "redis_om" },
1213
]
1314
classifiers = [
1415
"Development Status :: 3 - Alpha",
@@ -25,10 +26,10 @@ classifiers = [
2526
'Programming Language :: Python :: 3.13',
2627
'Programming Language :: Python',
2728
]
28-
include=[
29-
"docs/*",
30-
"images/*",
31-
"redis_om/**/*",
29+
# Include redis_om (generated by make sync) in wheel builds.
30+
# This overrides .gitignore which excludes these files from version control.
31+
include = [
32+
{ path = "redis_om/**/*", format = ["sdist", "wheel"] },
3233
]
3334

3435
[tool.poetry.urls]

redis_om/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# redis_om - Sync Version (Auto-Generated)
2+
3+
This directory contains the **synchronous version** of redis-om-python.
4+
5+
## Important Notes
6+
7+
1. **Do not edit files in this directory directly** - they are auto-generated from `aredis_om/` using [unasync](https://github.com/python-trio/unasync).
8+
9+
2. **To regenerate**: Run `make sync` from the project root.
10+
11+
3. **Why this README exists**: This placeholder file allows the `redis_om` package to be declared in `pyproject.toml` for Poetry 2.0+ compatibility, which requires package directories to exist at install time.
12+
13+
4. **All other files are gitignored**: Only this README is tracked in git. The actual Python files are generated and ignored.
14+
15+
## Development Workflow
16+
17+
1. Make changes in `aredis_om/` (the async version)
18+
2. Run `make sync` to generate the sync version
19+
3. Run tests for both versions
20+

redis_om/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Placeholder __init__.py for Poetry package recognition.
2+
# This file is overwritten by `make sync` - see redis_om/README.md for details.
3+
#
4+
# The actual exports are generated from aredis_om/__init__.py.
5+
# Run `make sync` to generate the full sync version of the library.

0 commit comments

Comments
 (0)