Skip to content

Commit 496cb20

Browse files
authored
Merge branch 'master' into copilot/add-async-support-for-caching
2 parents 23125e3 + f57a518 commit 496cb20

7 files changed

Lines changed: 33 additions & 42 deletions

File tree

.github/workflows/ci-test.yml

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,10 @@ jobs:
5353
uses: actions/setup-python@v6
5454
with:
5555
python-version: ${{ matrix.python-version }}
56+
cache: "pip"
5657

57-
- name: Install dependencies
58-
run: |
59-
python -m pip install --upgrade pip
60-
python -m pip install -e . -r tests/requirements.txt
58+
- name: Install package & dependencies
59+
run: python -m pip install -e . -r tests/requirements.txt
6160

6261
- name: Lower inotify instance limit (Linux only, for Issue #24 test)
6362
if: runner.os == 'Linux' && matrix.backend == 'local'
@@ -75,14 +74,18 @@ jobs:
7574
colima start
7675
# For testcontainers to find the Colima socket
7776
sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock
77+
78+
- name: Install other test dependencies
79+
if: matrix.backend != 'local'
80+
run: python -m pip install -e . -r tests/requirements_${{ matrix.backend }}.txt
81+
7882
# ToDo: find a way to cache docker images
7983
#- name: Cache Container Images
8084
# if: matrix.backend == 'mongodb'
8185
# uses: borda/cache-container-images-action@b32a5e804cb39af3c3d134fc03ab76eac0bfcfa9
8286
# with:
8387
# prefix-key: "mongo-db"
8488
# images: mongo:latest
85-
8689
- name: Start MongoDB in docker
8790
if: matrix.backend == 'mongodb'
8891
run: |
@@ -93,11 +96,6 @@ jobs:
9396
# show running containers
9497
docker ps -a
9598
96-
- name: Install MongoDB core test dependencies
97-
if: matrix.backend == 'mongodb'
98-
run: |
99-
python -m pip install -e . -r tests/mongodb_requirements.txt
100-
10199
- name: Unit tests (DB)
102100
if: matrix.backend == 'mongodb'
103101
run: pytest -m "mongo" --cov=cachier --cov-report=term --cov-report=xml:cov.xml
@@ -117,11 +115,6 @@ jobs:
117115
sleep 10
118116
docker ps -a
119117
120-
- name: Install SQL core test dependencies (SQL/Postgres)
121-
if: matrix.backend == 'postgres'
122-
run: |
123-
python -m pip install -e . -r tests/sql_requirements.txt
124-
125118
- name: Unit tests (SQL/Postgres)
126119
if: matrix.backend == 'postgres'
127120
env:
@@ -138,11 +131,6 @@ jobs:
138131
sleep 5
139132
docker ps -a
140133
141-
- name: Install Redis core test dependencies
142-
if: matrix.backend == 'redis'
143-
run: |
144-
python -m pip install -e . -r tests/redis_requirements.txt
145-
146134
- name: Unit tests (Redis)
147135
if: matrix.backend == 'redis'
148136
run: pytest -m redis --cov=cachier --cov-report=term --cov-report=xml:cov.xml

AGENTS.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ cachier/
3636
│ └── __main__.py
3737
├── tests/ # Pytest-based tests, backend-marked
3838
│ ├── test_*.py
39-
│ └── *_requirements.txt # Backend-specific test requirements
39+
│ └── requirements_*.txt # Backend-specific test requirements
4040
├── examples/ # Usage examples
4141
├── README.rst # Main documentation
4242
├── pyproject.toml # Build, lint, type, test config
@@ -55,7 +55,7 @@ ______________________________________________________________________
5555
pip install .[all]
5656
```
5757

58-
- For backend-specific dev: see `tests/*_requirements.txt`.
58+
- For backend-specific dev: see `tests/requirements_*.txt`.
5959

6060
2. **Run tests:**
6161

@@ -111,7 +111,7 @@ ______________________________________________________________________
111111
- **Default:** Pickle (local file cache, `~/.cachier/`)
112112
- **Others:** Memory, MongoDB, SQL, Redis
113113
- **Adding a backend:** Implement in `src/cachier/cores/`, subclass `BaseCore`, add tests with appropriate markers, update docs, and CI matrix if needed.
114-
- **Optional dependencies:** Code/tests must gracefully skip if backend deps are missing. Install backend-specific deps via `tests/*_requirements.txt`.
114+
- **Optional dependencies:** Code/tests must gracefully skip if backend deps are missing. Install backend-specific deps via `tests/requirements_*.txt`.
115115
- **Requirements files:** `tests/sql_requirements.txt`, `tests/redis_requirements.txt` for backend-specific dependencies.
116116

117117
### 3. **Decorator Usage**
@@ -125,7 +125,7 @@ ______________________________________________________________________
125125
- **Run all tests:** `pytest`
126126
- **Backend-specific:** Use markers, e.g. `pytest -m mongo`, `pytest -m redis`, `pytest -m sql`
127127
- **Available markers:** `mongo`, `memory`, `pickle`, `redis`, `sql`, `maxage` (see `pyproject.toml`)
128-
- **Requirements:** See `tests/*_requirements.txt` for backend test deps.
128+
- **Requirements:** See `tests/requirements_*.txt` for backend test deps.
129129
- **CI:** Matrix covers OS/backend combinations. Mongo/SQL/Redis require Dockerized services.
130130
- **Missing deps:** Tests gracefully skip if optional backend dependencies are missing.
131131

@@ -406,9 +406,9 @@ ______________________________________________________________________
406406
pip install -e .
407407
pip install -r tests/requirements.txt
408408
# For specific backends:
409-
pip install -r tests/mongodb_requirements.txt
410-
pip install -r tests/redis_requirements.txt
411-
pip install -r tests/sql_requirements.txt
409+
pip install -r tests/requirements_mongodb.txt
410+
pip install -r tests/requirements_redis.txt
411+
pip install -r tests/requirements_postgres.txt
412412
```
413413
- **Run all tests:** `pytest`
414414
- **Run backend-specific tests:** `pytest -m <backend>` (mongo, redis, sql, memory, pickle, maxage)
@@ -421,7 +421,7 @@ ______________________________________________________________________
421421
- **Build package:** `python -m build`
422422
- **Check docs:** `python setup.py checkdocs`
423423
- **Run example:** `python examples/redis_example.py`
424-
- **Update requirements:** Edit `tests/*_requirements.txt` as needed (sql_requirements.txt, redis_requirements.txt).
424+
- **Update requirements:** Edit `tests/requirements_*.txt` as needed (sql_requirements.txt, redis_requirements.txt).
425425

426426
### Local Testing with Docker
427427

@@ -488,7 +488,7 @@ ______________________________________________________________________
488488

489489
### b. **Best Practices for Coding Assistance Agents**
490490

491-
- **Always check for backend-specific requirements** before running backend tests or code (see `tests/*_requirements.txt`).
491+
- **Always check for backend-specific requirements** before running backend tests or code (see `tests/requirements_*.txt`).
492492
- **When adding a backend:** Update all relevant places (core, tests, docs, CI matrix, requirements files).
493493
- **When editing core logic:** Ensure all backends are still supported and tested.
494494
- **When updating the decorator API:** Update docstrings, README, and tests.

CLAUDE.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ cachier/
3636
│ └── __main__.py
3737
├── tests/ # Pytest-based tests, backend-marked
3838
│ ├── test_*.py
39-
│ └── *_requirements.txt # Backend-specific test requirements
39+
│ └── requirements_*.txt # Backend-specific test requirements
4040
├── examples/ # Usage examples
4141
├── README.rst # Main documentation
4242
├── pyproject.toml # Build, lint, type, test config
@@ -55,7 +55,7 @@ ______________________________________________________________________
5555
pip install .[all]
5656
```
5757

58-
- For backend-specific dev: see `tests/*_requirements.txt`.
58+
- For backend-specific dev: see `tests/requirements_*.txt`.
5959

6060
2. **Run tests:**
6161

@@ -111,7 +111,7 @@ ______________________________________________________________________
111111
- **Default:** Pickle (local file cache, `~/.cachier/`)
112112
- **Others:** Memory, MongoDB, SQL, Redis
113113
- **Adding a backend:** Implement in `src/cachier/cores/`, subclass `BaseCore`, add tests with appropriate markers, update docs, and CI matrix if needed.
114-
- **Optional dependencies:** Code/tests must gracefully skip if backend deps are missing. Install backend-specific deps via `tests/*_requirements.txt`.
114+
- **Optional dependencies:** Code/tests must gracefully skip if backend deps are missing. Install backend-specific deps via `tests/requirements_*.txt`.
115115
- **Requirements files:** `tests/sql_requirements.txt`, `tests/redis_requirements.txt` for backend-specific dependencies.
116116

117117
### 3. **Decorator Usage**
@@ -125,7 +125,7 @@ ______________________________________________________________________
125125
- **Run all tests:** `pytest`
126126
- **Backend-specific:** Use markers, e.g. `pytest -m mongo`, `pytest -m redis`, `pytest -m sql`
127127
- **Available markers:** `mongo`, `memory`, `pickle`, `redis`, `sql`, `maxage` (see `pyproject.toml`)
128-
- **Requirements:** See `tests/*_requirements.txt` for backend test deps.
128+
- **Requirements:** See `tests/requirements_*.txt` for backend test deps.
129129
- **CI:** Matrix covers OS/backend combinations. Mongo/SQL/Redis require Dockerized services.
130130
- **Missing deps:** Tests gracefully skip if optional backend dependencies are missing.
131131

@@ -406,9 +406,9 @@ ______________________________________________________________________
406406
pip install -e .
407407
pip install -r tests/requirements.txt
408408
# For specific backends:
409-
pip install -r tests/mongodb_requirements.txt
410-
pip install -r tests/redis_requirements.txt
411-
pip install -r tests/sql_requirements.txt
409+
pip install -r tests/requirements_mongodb.txt
410+
pip install -r tests/requirements_redis.txt
411+
pip install -r tests/requirements_postgres.txt
412412
```
413413
- **Run all tests:** `pytest`
414414
- **Run backend-specific tests:** `pytest -m <backend>` (mongo, redis, sql, memory, pickle, maxage)
@@ -421,7 +421,7 @@ ______________________________________________________________________
421421
- **Build package:** `python -m build`
422422
- **Check docs:** `python setup.py checkdocs`
423423
- **Run example:** `python examples/redis_example.py`
424-
- **Update requirements:** Edit `tests/*_requirements.txt` as needed (sql_requirements.txt, redis_requirements.txt).
424+
- **Update requirements:** Edit `tests/requirements_*.txt` as needed (sql_requirements.txt, redis_requirements.txt).
425425

426426
### Local Testing with Docker
427427

@@ -488,7 +488,7 @@ ______________________________________________________________________
488488

489489
### b. **Best Practices for Claude**
490490

491-
- **Always check for backend-specific requirements** before running backend tests or code (see `tests/*_requirements.txt`).
491+
- **Always check for backend-specific requirements** before running backend tests or code (see `tests/requirements_*.txt`).
492492
- **When adding a backend:** Update all relevant places (core, tests, docs, CI matrix, requirements files).
493493
- **When editing core logic:** Ensure all backends are still supported and tested.
494494
- **When updating the decorator API:** Update docstrings, README, and tests.

scripts/README-local-testing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ The script automatically sets the required environment variables:
154154
2. **Python dependencies** - Install test requirements:
155155
```bash
156156
pip install -r tests/requirements.txt
157-
pip install -r tests/mongodb_requirements.txt # For MongoDB tests
158-
pip install -r tests/redis_requirements.txt # For Redis tests
159-
pip install -r tests/sql_requirements.txt # For SQL tests
157+
pip install -r tests/requirements_mongodb.txt # For MongoDB tests
158+
pip install -r tests/requirements_redis.txt # For Redis tests
159+
pip install -r tests/requirements_postgres.txt # For SQL tests
160160
```
161161

162162
## Troubleshooting
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
-r requirements.txt
22
# to connect to the test mongodb server
33
pymongo
44
dnspython
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
-r requirements.txt
12
# for SQL core tests
23
SQLAlchemy
34
psycopg2-binary
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
-r requirements.txt
2+
13
redis>=4.0.0
24
pandas>=1.3.0
35
birch>=0.0.35

0 commit comments

Comments
 (0)