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
3 changes: 2 additions & 1 deletion .github/wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,5 @@ issubclass
ulid
coroutine
compat
programmatically
programmatically
uv
74 changes: 9 additions & 65 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,44 +27,16 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Setup Python 3.10
uses: actions/setup-python@v6
with:
python-version: ${{env.pythonversion}}
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v5
with:
path: .venv
key: venv-${{ runner.os }}-${{ env.pythonversion }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: uv sync
- name: Make sync version of library (redis_om)
run: make sync
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install library
run: poetry install --no-interaction
#----------------------------------------------
# run test suite
#----------------------------------------------
- name: Run linter
run: |
make dist
Expand Down Expand Up @@ -99,50 +71,22 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Setup Python ${{ matrix.pyver }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.pyver }}
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v5
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.pyver }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# Make sync version of library (redis_om)
#----------------------------------------------
- name: Install dependencies
run: uv sync
- name: Make sync version of library (redis_om)
run: make sync
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install library
run: poetry install --no-interaction
- name: Run unittests (redisstack:${{ matrix.redisstack }}, ${{ matrix.os }})
env:
REDIS_OM_URL: "redis://localhost:6379?decode_responses=True"
run: |
make test
poetry run coverage xml
uv run coverage xml
- name: Upload coverage
uses: codecov/codecov-action@v5
with:
Expand Down
25 changes: 5 additions & 20 deletions .github/workflows/docs-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,19 @@ jobs:
- name: Checkout
uses: actions/checkout@v6

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v5
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

- name: Install library
run: poetry install --no-interaction
run: uv sync

- name: Build MkDocs site
run: poetry run mkdocs build
run: uv run mkdocs build

- name: Setup Pages
uses: actions/configure-pages@v5
Expand Down
47 changes: 18 additions & 29 deletions .github/workflows/pypi-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,45 @@ on:
types: [ published ]

jobs:
pytest:
publish:
name: Publish to PyPi
runs-on: ubuntu-latest
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
environment: release
permissions:
id-token: write
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v6

- name: get version from tag
- name: Get version from tag
id: get_version
run: |
realversion="${GITHUB_REF/refs\/tags\//}"
realversion="${realversion//v/}"
echo "::set-output name=VERSION::$realversion"
echo "VERSION=$realversion" >> $GITHUB_OUTPUT

- name: Set the version for publishing
uses: sandstromviktor/toml-editor@2.0.0
with:
file: "pyproject.toml"
key: "tool.poetry.version"
key: "project.version"
value: "${{ steps.get_version.outputs.VERSION }}"

- name: Set up Python 3.9
- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: 3.9
python-version: "3.11"

- name: Cache Poetry virtualenv
uses: actions/cache@v5
id: cache
with:
path: ~/.virtualenvs
key: poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
poetry-${{ hashFiles('**/poetry.lock') }}

- name: Set Poetry config
run: |
pip install --upgrade pip poetry==1.8.4
poetry config virtualenvs.in-project false
poetry config virtualenvs.path ~/.virtualenvs
poetry export --dev --without-hashes -o requirements.txt
pip install -r requirements.txt
- name: Install dependencies
run: uv sync

- name: Make sync version of library (redis_om)
run: make sync

- name: Install
run: poetry install --no-interaction
- name: Build package
run: uv build

- name: Publish to PyPI
run: |
poetry publish -u __token__ -p ${{ secrets.PYPI_TOKEN }} --build
uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ repos:
hooks:
- id: codespell
args: [--write-changes]
exclude: ^(poetry\.lock|\.git/|docs/.*\.md)$
exclude: ^(uv\.lock|\.git/|docs/.*\.md)$
6 changes: 3 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Redis OM Python is an object mapping library for Redis that provides high-level

### Setup and Installation
```bash
# Install dependencies using Poetry (preferred)
poetry install
# Install dependencies using uv (preferred)
uv sync

# Or directly with pip
pip install -e .
Expand Down Expand Up @@ -177,7 +177,7 @@ class Address(EmbeddedJsonModel):

- **docs/**: Comprehensive documentation in Markdown
- **docker-compose.yml**: Redis Stack and OSS Redis instances for testing
- **pyproject.toml**: Poetry configuration with CLI script definitions
- **pyproject.toml**: Project configuration with CLI script definitions
- **.github/**: CI/CD workflows and issue templates
- **Session.vim**: Vim session configuration for development

Expand Down
22 changes: 8 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ Redis OM Python is an object mapping library for Redis that provides declarative

### Prerequisites

- Python 3.8 or higher (we test on 3.8-3.13)
- [Poetry](https://python-poetry.org/docs/#installation) for dependency management
- Python 3.10 or higher (we test on 3.10-3.13)
- [uv](https://docs.astral.sh/uv/) for dependency management
- Docker and Docker Compose for running Redis
- Make (for running development commands)

Expand All @@ -45,7 +45,7 @@ Redis OM Python is an object mapping library for Redis that provides declarative
make install
```

This will use Poetry to install all dependencies in a virtual environment.
This will use uv to install all dependencies in a virtual environment.

3. **Start Redis containers:**

Expand All @@ -57,12 +57,6 @@ Redis OM Python is an object mapping library for Redis that provides declarative
- Redis Stack (port 6380) - includes RediSearch and RedisJSON modules
- Redis OSS (port 6381) - standard Redis for compatibility testing

4. **Enter the Poetry shell (optional):**

```bash
make shell
```

## Project Architecture

### � Critical: Dual Async/Sync Architecture
Expand Down Expand Up @@ -145,7 +139,7 @@ make sync
vim tests/test_your_feature.py

# 5. Run tests iteratively
poetry run pytest tests/test_your_feature.py -vv
uv run pytest tests/test_your_feature.py -vv

# 6. Format and lint
make format
Expand All @@ -164,16 +158,16 @@ make test
make test

# Run specific test file
poetry run pytest tests/test_hash_model.py -vv
uv run pytest tests/test_hash_model.py -vv

# Run specific test
poetry run pytest tests/test_hash_model.py::test_saves_model -vv
uv run pytest tests/test_hash_model.py::test_saves_model -vv

# Run with coverage
poetry run pytest --cov=aredis_om --cov=redis_om --cov-report=term-missing
uv run pytest --cov=aredis_om --cov=redis_om --cov-report=term-missing

# Run tests in parallel
poetry run pytest -n auto
uv run pytest -n auto

# Test against OSS Redis (without modules)
make test_oss
Expand Down
Loading
Loading