You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat!: remove redundant 'index' field from parsed CSA tags (#15) (#36)
BREAKING CHANGE: The 'index' field has been removed from tag dictionaries
returned by CsaHeader.read(). Tags now contain only 'VR', 'VM', and 'value'.
The 'index' field was redundant with Python's guaranteed dict ordering
(Python 3.7+). Since minimum supported version is Python 3.9, dict insertion
order is language-guaranteed.
Migration: Use enumerate(parsed.items(), 1) to get explicit indices.
- Remove 'index' from parse_tag method
- Add comprehensive docstring to read() method
- Update tests to verify no 'index' field
- Update README examples
- Add migration guide to CHANGELOG
- Bump version to 2.0.0
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+44Lines changed: 44 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,50 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## [Unreleased]
9
9
10
+
## [2.0.0] - 2025-11-01
11
+
12
+
### 🔥 Breaking Changes
13
+
14
+
#### Removed redundant 'index' field from parsed CSA tags
15
+
16
+
**What changed:**
17
+
- The `'index'` field has been removed from each tag dictionary returned by `CsaHeader.read()`
18
+
- Tags now contain only: `'VR'` (Value Representation), `'VM'` (Value Multiplicity), and `'value'`
19
+
20
+
**Why:**
21
+
- The `'index'` field was redundant with Python's guaranteed dict ordering (Python 3.7+)
22
+
- Since the minimum supported Python version is 3.9, dict insertion order is guaranteed by the language
23
+
- This simplifies the API and follows the DRY (Don't Repeat Yourself) principle
24
+
- Resolves issue #15
25
+
26
+
**Migration guide:**
27
+
28
+
Before (v1.x):
29
+
```python
30
+
parsed = CsaHeader(raw_csa).read()
31
+
for tag_name, tag_data in parsed.items():
32
+
idx = tag_data['index'] # Direct access to index field
33
+
print(f"Tag {idx}: {tag_name}")
34
+
```
35
+
36
+
After (v2.0):
37
+
```python
38
+
parsed = CsaHeader(raw_csa).read()
39
+
for idx, (tag_name, tag_data) inenumerate(parsed.items(), 1):
40
+
print(f"Tag {idx}: {tag_name}")
41
+
```
42
+
43
+
**Note:** Tag ordering is preserved via Python's dict insertion order (guaranteed since Python 3.7). Tags appear in the same sequential order as they do in the CSA header.
44
+
45
+
### Added
46
+
- Comprehensive docstring for `CsaHeader.read()` method explaining dict ordering guarantees
47
+
- Migration examples in CHANGELOG showing how to enumerate tags if explicit indices are needed
48
+
49
+
### Changed
50
+
- Simplified tag structure from `{'index': int, 'VR': str, 'VM': int, 'value': Any}` to `{'VR': str, 'VM': int, 'value': Any}`
51
+
- Updated README examples to reflect new tag structure without 'index' field
52
+
- Updated test suite to verify tags no longer contain 'index' field
0 commit comments