[patch] Use dict[str, Any] for JSON repository document types #38

Merged
brian merged 1 commits from cursor/json-dict-str-any-typing into main 2026-07-09 18:45:12 +02:00
Owner

Summary
Tightens JSON repository typing from bare dict to dict[str, Any] across the interface, Redis adapter, example, tests, and README subclassing snippet.

This documents the intended JSON shape (string-keyed objects) and improves static analysis without changing runtime behavior. Generics and TypedDict models are intentionally deferred.

Changes
JsonRepositoryInterface.get / set now use dict[str, Any]
RedisAdapter signatures and cast() updated to match
UserJsonRepository example and unit test stubs aligned
README subclassing example updated with from typing import Any
Test plan

uv run mypy python_repositories tests/unit

uv run pytest tests/unit/ -v (95 passed)

Integration tests pass in CI

Summary Tightens JSON repository typing from bare dict to dict[str, Any] across the interface, Redis adapter, example, tests, and README subclassing snippet. This documents the intended JSON shape (string-keyed objects) and improves static analysis without changing runtime behavior. Generics and TypedDict models are intentionally deferred. Changes JsonRepositoryInterface.get / set now use dict[str, Any] RedisAdapter signatures and cast() updated to match UserJsonRepository example and unit test stubs aligned README subclassing example updated with from typing import Any Test plan uv run mypy python_repositories tests/unit uv run pytest tests/unit/ -v (95 passed) Integration tests pass in CI
brian added 1 commit 2026-07-09 18:42:24 +02:00
Use dict[str, Any] for JSON repository document types.
PR Title Check / check-title (pull_request) Successful in 6s
Code Quality Pipeline / code-quality (pull_request) Successful in 1m28s
Test Python Package / unit-tests (pull_request) Successful in 1m29s
Test Python Package / coverage-report (pull_request) Successful in 16s
Test Python Package / integration-tests (pull_request) Successful in 48s
42e885edd5
Clarifies that JSON CRUD operates on string-keyed objects without changing runtime behavior.

Co-authored-by: Cursor <[email protected]>
Member

Test Coverage Report:

Name                                                            Stmts   Miss    Cover   Missing
-----------------------------------------------------------------------------------------------
python_repositories/__init__.py                                    12      0  100.00%
python_repositories/adapters/__init__.py                           13      0  100.00%
python_repositories/adapters/connection_aware_adapter.py           61      0  100.00%
python_repositories/adapters/minio_adapter.py                     117      0  100.00%
python_repositories/adapters/redis_adapter.py                     105      0  100.00%
python_repositories/config/__init__.py                              4      0  100.00%
python_repositories/config/dotenv_loader.py                         7      0  100.00%
python_repositories/config/env_bool.py                             14      0  100.00%
python_repositories/config/minio_config.py                         21      0  100.00%
python_repositories/config/redis_config.py                         14      0  100.00%
python_repositories/examples/__init__.py                            0      0  100.00%
python_repositories/examples/artifact_object_repository.py          9      0  100.00%
python_repositories/examples/user_json_repository.py               11      0  100.00%
python_repositories/interfaces/__init__.py                          5      0  100.00%
python_repositories/interfaces/connection_aware_interface.py        8      0  100.00%
python_repositories/interfaces/context_aware_interface.py           8      0  100.00%
python_repositories/interfaces/json_repository_interface.py        15      0  100.00%
python_repositories/interfaces/object_repository_interface.py      11      0  100.00%
-----------------------------------------------------------------------------------------------
TOTAL                                                             435      0  100.00%

**Test Coverage Report:** ``` Name Stmts Miss Cover Missing ----------------------------------------------------------------------------------------------- python_repositories/__init__.py 12 0 100.00% python_repositories/adapters/__init__.py 13 0 100.00% python_repositories/adapters/connection_aware_adapter.py 61 0 100.00% python_repositories/adapters/minio_adapter.py 117 0 100.00% python_repositories/adapters/redis_adapter.py 105 0 100.00% python_repositories/config/__init__.py 4 0 100.00% python_repositories/config/dotenv_loader.py 7 0 100.00% python_repositories/config/env_bool.py 14 0 100.00% python_repositories/config/minio_config.py 21 0 100.00% python_repositories/config/redis_config.py 14 0 100.00% python_repositories/examples/__init__.py 0 0 100.00% python_repositories/examples/artifact_object_repository.py 9 0 100.00% python_repositories/examples/user_json_repository.py 11 0 100.00% python_repositories/interfaces/__init__.py 5 0 100.00% python_repositories/interfaces/connection_aware_interface.py 8 0 100.00% python_repositories/interfaces/context_aware_interface.py 8 0 100.00% python_repositories/interfaces/json_repository_interface.py 15 0 100.00% python_repositories/interfaces/object_repository_interface.py 11 0 100.00% ----------------------------------------------------------------------------------------------- TOTAL 435 0 100.00% ```
brian merged commit 95c78596e7 into main 2026-07-09 18:45:12 +02:00
brian deleted branch cursor/json-dict-str-any-typing 2026-07-09 18:45:13 +02:00
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: lille-vemmelund/python-repositories#38