Skip to content

Commit a7fe2dc

Browse files
feat: setup redis
* feat(deps): add missing dependencies added redis added tenacity added pytest dev dependency added lock file * feat: add events with redis added event handling boilerplate added testing boilerplate changed workflow to accommodate redis
1 parent 318acaf commit a7fe2dc

25 files changed

Lines changed: 490 additions & 16 deletions

.github/workflows/pr-checks.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
format:
1414
name: Check Formatting
1515
runs-on: ubuntu-latest
16+
1617
steps:
1718
- uses: actions/checkout@v3
1819
- uses: actions/setup-python@v4.0.0
@@ -33,19 +34,32 @@ jobs:
3334
test:
3435
name: Test
3536
runs-on: ${{ matrix.os }}
37+
3638
strategy:
3739
matrix:
3840
os: [ubuntu-latest, macos-latest]
3941
python:
4042
- version: "3.13"
4143
toxenv: "py313"
44+
4245
steps:
4346
- uses: actions/checkout@v3
4447
- uses: actions/setup-python@v4.0.0
4548
with:
4649
python-version: ${{ matrix.python.version }}
4750
- name: Install tox
4851
run: python -m pip install tox
52+
- name: Install and start Redis
53+
run: |
54+
if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
55+
sudo apt-get update
56+
sudo apt-get install -y redis-server
57+
elif [ "${{ matrix.os }}" == "macos-latest" ]; then
58+
brew install redis
59+
fi
4960
- name: Run pytest
5061
run: tox -e ${{ matrix.python.toxenv }} -- --randomly-seed=$RANDOM
5162
working-directory: daemon
63+
env:
64+
REDIS_HOST: localhost
65+
REDIS_PORT: 6379

daemon/.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ dist/
77
# -- created by tox -- #
88
.tox
99
.mypy_cache
10-
.pytest_cache
10+
.pytest_cache
11+
12+
# -- redis -- #
13+
dump.rdb

daemon/poetry.lock

Lines changed: 130 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

daemon/pyproject.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ authors = [
88
license = {text = "MIT"}
99
requires-python = ">=3.13"
1010
dependencies = [
11+
"redis (>=7.1.0,<8.0.0)",
12+
"tenacity (>=9.1.2,<10.0.0)"
1113
]
1214

1315

@@ -36,4 +38,8 @@ multi_line_output = 3
3638
include_trailing_comma = true
3739
force_grid_wrap = 0
3840
use_parentheses = true
39-
ensure_newline_before_comments = true
41+
ensure_newline_before_comments = true
42+
[dependency-groups]
43+
dev = [
44+
"pytest (>=9.0.2,<10.0.0)"
45+
]

daemon/src/config.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from typing import TypedDict
2+
3+
REDIS_HOST = "localhost"
4+
REDIS_PORT = 6379
5+
6+
7+
class RedisInfo(TypedDict):
8+
host: str
9+
port: int
10+
11+
12+
def get_redis_host_and_port() -> RedisInfo:
13+
return {
14+
"host": REDIS_HOST,
15+
"port": REDIS_PORT,
16+
}

daemon/src/core/types.py

Whitespace-only changes.

daemon/src/domain/__init__.py

Whitespace-only changes.

daemon/src/domain/commands.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from uuid import UUID
2+
3+
4+
class Command:
5+
task_id: UUID

daemon/src/domain/events.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from dataclasses import dataclass
2+
from uuid import UUID
3+
4+
5+
class Event:
6+
task_id: UUID
7+
8+
9+
@dataclass
10+
class TaskCreated(Event):
11+
task_id: UUID

0 commit comments

Comments
 (0)