Require the codec `context` kwarg: remove connection context from the `key` dict
Maintainer thường phản hồi trong vòng 6 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 54/100
Hướng nghiên cứu
Start in table.py, decode_attribute, _extract_context, Codec._codec_config, _build_path, and _get_backend; trace where codec_context and config are passed before removing the legacy underscore-key path. Check the four named ecosystem codecs for migration readiness before removing compatibility. Done means supported codecs require context, config is explicit in the path/backend helpers, and the legacy fallback and capability check are gone.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
The breaking half of #1550, deliberately deferred out of #1556 so that 2.3.4 stayed additive.
What 2.3.4 shipped
encode/decode gained an explicit context argument carrying schema, table, field and config. Nothing broke, by three deliberate choices:
- DataJoint passes
contextonly to codecs whose signature declares it, so a codec with the old signature is never offered the argument. - The underscore keys —
_schema,_table,_field,_config— stay inkeyand are still populated. _extract_context(key)still accepts one argument, warning only when it actually falls back to those keys.
The documentation already teaches the new signature as the signature, in both repos, so codecs written from 2.3.4 onward are ready for this.
What this issue removes
- Stop populating the underscore keys.
table.pybuilds them alongsidecodec_context;decode_attributebuilds{"_config": ...}alongside{"config": ...}. Both halves collapse to thecontextone, andkeyreverts to meaning the primary key, as it does everywhere else in DataJoint. - Drop the fallback in
_extract_contextandCodec._codec_config, along with theDeprecationWarning. - Drop the capability check. With every supported codec declaring
context,_accepts_kwarg(fn, "context")can go and the argument is passed unconditionally. Thestore_namecheck stays — that one is genuinely optional.
Worth doing at the same time
Make config a required parameter of _build_path and _get_backend rather than defaulting to None with a global-config fallback. That fallback is what made the original defect silent: omitting config resolved a different store rather than raising, which is how dj-figpack-codecs#6 and dj-canvasxpress-codecs#3 both shipped broken. A required parameter turns that into a TypeError at the call site.
This is the part with real value, and it is why the deprecation window exists.
Migration
For a codec author it is two lines:
# before
def encode(self, value, *, key=None, store_name=None):
schema, table, field, pk = self._extract_context(key)
config = (key or {}).get("_config")
# after
def encode(self, value, *, key=None, context=None, store_name=None):
schema, table, field, pk = self._extract_context(key, context)
config = self._codec_config(key, context)
Before closing
Check the four codecs in the ecosystem — dj-figpack-codecs, dj-canvasxpress-codecs, dj-zarr-codecs, dj-photon-codecs. All four were on the old signature when 2.3.4 was cut; each needs the two-line change above before the legacy path is removed, and a release that requires DataJoint >= 2.4.
- Ngôn ngữ chính
- Python
- Star
- 198
- Fork
- 103
- Merge trung bình
- 6 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 10
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của datajoint/datajoint-python
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
datajoint/datajoint-python#1703 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
datajoint/datajoint-python#1702 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
datajoint/datajoint-python#1701 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
datajoint/datajoint-python#1691 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
dependencies needs-discussion
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
datajoint/datajoint-python#1687 ·
Maintainer thường phản hồi trong vòng 6 ngày
Tất cả issue của datajoint/datajoint-python
Issue tương tự
-
needs-triage
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 85/100
gke-labs/kube-agents#6620 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
open-webui/open-webui#34719 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
cognition
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
One non-object JSON record makes the session catalog exitCó thể đã có người làm @he-yufeng đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Suggestion]: Geonode MCP ServerĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
collabnix/awesome-mcp-lists#433 ·
Maintainer thường phản hồi trong vòng 4 ngày