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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
# Framework Release Guide

This guide documents how to release a new **framework version** for the Universal Dependencies dataset (e.g., v2.0 → v2.1).

**Important:** This is different from adding a new **UD data version** (e.g., UD 2.17 → 2.18). For that, see [ADDING_NEW_UD_VERSION.md](ADDING_NEW_UD_VERSION.md).

## Framework vs. Data Versioning

**Framework Version** (e.g., v2.0, v2.1):
- The tooling, templates, and architecture used to generate datasets
- Includes: generation scripts, templates, documentation, architecture decisions
- Lives in: `tools/`, `templates/`, root documentation files
- Applies to: All UD data versions (2.7, 2.8, ..., 2.17, 2.18, ...)

**UD Data Version** (e.g., 2.17, 2.18):
- The actual Universal Dependencies linguistic data
- Released by the UD project ~annually
- Each gets its own git branch
- Can use the latest framework version

**Example:** "UD 2.17 data using framework v2.0 architecture"

## When to Release a New Framework Version

Use [semantic versioning](https://semver.org/): `MAJOR.MINOR.PATCH`

### Major Version (v2.0 → v3.0)

**Breaking changes** that require user code modifications:

- Schema changes (adding/removing/renaming fields)
- Changed data format (e.g., v1.x script loader → v2.0 Parquet)
- Incompatible API changes
- Removing deprecated features

**Example:** v1.x → v2.0 moved to Parquet format and removed Python script loader

### Minor Version (v2.0 → v2.1)

**New features** that are backwards compatible:

- New optional fields in schema
- New tools or scripts
- Enhanced functionality (e.g., better MWT handling)
- Performance improvements
- New documentation

**Example:** Adding empty_nodes field to schema while keeping all existing fields

### Patch Version (v2.0.0 → v2.0.1)

**Bug fixes** that don't change functionality:

- Fixing parsing errors
- Correcting metadata extraction
- Documentation typos
- Template rendering issues
- Validation improvements

**Example:** Fixing double-equals parsing in FEATS fields

## Release Checklist

### 1. Decide Version Number

```bash
# Current version
CURRENT_VER="2.0.0"

# New version (update based on changes)
NEW_VER="2.1.0"  # or "2.0.1" for patch, "3.0.0" for major
```

**Determine type:**
- Breaking changes? → Major
- New features? → Minor
- Bug fixes only? → Patch

### 2. Update Version Numbers

**File: pyproject.toml**
```toml
[project]
name = "universal-dependencies"
version = "2.1.0"  # Update this
```

**File: MIGRATION.md** (if major/minor)
Update the version references in examples:
```markdown
# Migration Guide: v2.0 → v2.1

This guide helps you migrate from v2.0 to v2.1...
```

### 3. Update CHANGELOG.md

Create entry for new version:

```markdown
## [2.1.0] - 2026-01-XX

### Added
- New feature X
- Enhanced functionality Y

### Changed
- Improved Z

### Fixed
- Bug fix for A

### Removed
- Deprecated feature B (if major version)
```

**For breaking changes (major version):**
```markdown
### Breaking Changes
- **Description**: Clear explanation
- **Impact**: Who is affected
- **Migration**: How to update code
```

### 4. Update Documentation

**Files to review and update:**

- **README.md** (root) - Update version badges, examples
- **MIGRATION.md** - Add new section if breaking changes
- **ADDING_NEW_UD_VERSION.md** - Update if workflow changes
- **tools/README.md** - Update if scripts change
- **templates/README.tmpl** - Update if dataset card needs changes

**Version-specific updates:**
```bash
# Search for old version references
grep -r "v2\.0" --include="*.md"
grep -r "2\.0\.0" --include="*.md"

# Update as needed
```

### 5. Update Templates (if applicable)

If schema or architecture changed:

**File: tools/templates/README.tmpl**
- Update schema documentation
- Update code examples
- Add new field descriptions

**Test template rendering:**
```bash
cd tools
./03_generate_README.py -o
# Review generated README-2.17 for correctness
```

### 6. Test Changes Thoroughly

**Test on sample UD version (e.g., 2.17):**

```bash
cd tools

# Test metadata generation
./02_generate_metadata.py -o

# Test README generation
./03_generate_README.py -o

# Test Parquet generation (small subset)
uv run ./04_generate_parquet.py --test

# Test validation
uv run ./05_validate_parquet.py --local --test
```

**Verify outputs:**
- `metadata-2.17.json` has correct structure
- `README-2.17` renders correctly
- Parquet files load properly
- No validation errors

### 7. Update ud-hf-parquet-tools Dependency (if needed)

If the framework requires a new version of the external library:

**File: pyproject.toml**
```toml
dependencies = [
    "ud-hf-parquet-tools>=1.2.0",  # Update minimum version
]
```

**Update wrapper scripts:**
```bash
# tools/04_generate_parquet.py
# tools/05_validate_parquet.py
```

### 8. Apply to All UD Data Branches

The framework update should be applied to all active UD data branches:

```bash
# List all UD data branches
git branch -r | grep -E "origin/[0-9]+"

# Example output:
# origin/2.7
# origin/2.8
# ...
# origin/2.17

# For each branch, merge the framework changes
for branch in 2.7 2.8 2.9 2.10 2.11 2.12 2.13 2.14 2.15 2.16 2.17; do
    echo "Updating branch ${branch}..."

    git checkout ${branch}
    git pull origin ${branch}

    # Cherry-pick framework changes (or merge from main)
    # Option A: Cherry-pick specific commits
    git cherry-pick <commit-hash>

    # Option B: Merge main (if no conflicts expected)
    git merge main --no-edit

    # Regenerate files with new framework
    cd tools
    ./02_generate_metadata.py -o
    ./03_generate_README.py -o
    cd ..

    # Copy to root
    cp tools/README-${branch} README.md
    cp tools/metadata-${branch}.json metadata.json

    # Commit
    git add README.md metadata.json tools/
    git commit -m "Update to framework v${NEW_VER}"

    # Push
    git push origin ${branch}
done

git checkout main
```

**Caution:** Review each branch carefully for conflicts or branch-specific issues.

### 9. Create Git Tag

```bash
# Tag the main branch
git checkout main
git tag -a v${NEW_VER} -m "Framework release v${NEW_VER}

Changes:
- Feature A
- Improvement B
- Fix C

See CHANGELOG.md for full details."

# Push tag
git push origin v${NEW_VER}
```

### 10. Create GitHub Release

1. Go to: https://github.com/YOUR_ORG/universal_dependencies/releases/new
2. Select tag: `v2.1.0`
3. Release title: `Framework v2.1.0`
4. Description:
   ```markdown
   ## Framework v2.1.0

   This release updates the Universal Dependencies dataset **framework** to v2.1.0.

   **This is a framework release, not a UD data release.** It applies to all UD data versions (2.7-2.17).

   ### What's New

   - Feature X: Description
   - Enhancement Y: Description
   - Bug fix Z: Description

   ### Breaking Changes (if any)

   - Change A: Migration instructions

   ### Upgrade Instructions

   For users: See [MIGRATION.md](MIGRATION.md) if breaking changes exist.

   For maintainers: Framework has been applied to all UD data branches (2.7-2.17).

   ### Full Changelog

   See [CHANGELOG.md](CHANGELOG.md) for complete release notes.
   ```

5. Mark as pre-release if not stable
6. Publish release

### 11. Update HuggingFace Hub (Optional)

If this is a major release that affects the dataset card or user experience:

```bash
# For each UD version branch on HF Hub
for branch in 2.7 2.8 ... 2.17; do
    git checkout ${branch}
    git push hf ${branch}
done
```

### 12. Announce Release

**Update dataset card (README.md):**
```markdown
## What's New in Framework v2.1

**Framework v2.1.0** brings the following improvements:
- New feature X
- Enhanced Y
- Bug fix Z

For full details, see [CHANGELOG.md](CHANGELOG.md).
```

**Announce on:**
- HuggingFace Hub discussions
- GitHub releases page
- Relevant communities (if major release)

## Testing Strategy

### Automated Tests

If tests exist in the repository:

```bash
# Run all tests
pytest tests/

# Run specific test suites
pytest tests/test_parsing.py
pytest tests/test_conversion.py
```

**Note:** Tests have been moved to the external `ud-hf-parquet-tools` library.

### Manual Testing

**Test matrix:**

| UD Version | Test Type | Expected Result |
|------------|-----------|-----------------|
| 2.17 (latest) | Full generation | All files generated correctly |
| 2.17 | Validation | 100% fidelity |
| 2.17 | Load from HF | Dataset loads without errors |
| 2.10 (mid) | Regeneration | Framework updates apply cleanly |
| 2.7 (oldest) | Regeneration | Framework updates apply cleanly |

**Specific tests:**

1. **Schema validation:**
   ```python
   from datasets import load_dataset
   ds = load_dataset("commul/universal_dependencies", "en_ewt", revision="2.17")
   assert "mwt" in ds["train"].features
   assert "empty_nodes" in ds["train"].features
   ```

2. **Data integrity:**
   ```bash
   uv run tools/05_validate_parquet.py --local --test
   # Should report 0 errors
   ```

3. **Backwards compatibility (if minor/patch):**
   ```python
   # Old code should still work
   ds = load_dataset("commul/universal_dependencies", "fr_gsd", revision="2.17")
   tokens = ds["train"][0]["tokens"]
   # No errors
   ```

### Rollback Plan

If critical issues are discovered:

```bash
# Revert to previous version
git checkout v2.0.0

# Or revert specific commits
git revert <commit-hash>

# Update version back
# Edit pyproject.toml, CHANGELOG.md

# Tag rollback
git tag -a v2.1.1 -m "Rollback v2.1.0 due to critical bug"
git push origin v2.1.1
```

## Common Scenarios

### Scenario 1: Bug Fix Release (v2.0.0 → v2.0.1)

**Example:** Fix metadata parsing bug

```bash
# 1. Fix the bug in code
# 2. Update version in pyproject.toml
# 3. Update CHANGELOG.md
# 4. Test on sample branch (2.17)
# 5. Apply to all branches
# 6. Tag and release
```

**Skip:** No migration guide needed, no schema changes

### Scenario 2: Minor Feature Release (v2.0 → v2.1)

**Example:** Add empty_nodes field to schema

```bash
# 1. Update templates/README.tmpl with new field docs
# 2. Update version in pyproject.toml
# 3. Update CHANGELOG.md
# 4. Test on sample branch
# 5. Apply to all branches
# 6. Update MIGRATION.md (optional, if users need guidance)
# 7. Tag and release
```

**Impact:** Users can optionally use new field, old code still works

### Scenario 3: Major Breaking Release (v2.0 → v3.0)

**Example:** Change schema significantly

```bash
# 1. Update all templates and scripts
# 2. Update version in pyproject.toml
# 3. Create detailed MIGRATION.md section
# 4. Update CHANGELOG.md with breaking changes
# 5. Test extensively on all branches
# 6. Apply to all branches (may require regeneration)
# 7. Tag and release
# 8. Announce with migration guide
```

**Impact:** Users may need to update code, provide clear migration path

## Version History

| Version | Date | Type | Highlights |
|---------|------|------|------------|
| v2.0.0 | 2025-01 | Major | Parquet format, no Python script, external helpers |
| v1.0.0 | 2024-XX | Major | Initial Python script loader |

## Best Practices

1. **Semantic Versioning:** Always follow semver strictly
2. **Test Thoroughly:** Test on oldest and newest UD versions
3. **Document Changes:** Update all relevant documentation
4. **Communicate Clearly:** Explain impact to users
5. **Batch Branches:** Update all UD branches together for consistency
6. **Keep Changelog:** Maintain detailed CHANGELOG.md
7. **Tag Consistently:** Use `v{MAJOR}.{MINOR}.{PATCH}` format

## Troubleshooting

### Issue: Merge conflicts when applying to branches

**Solution:**
```bash
# If conflicts occur:
git checkout ${branch}
git merge main

# Resolve conflicts manually
# Prioritize branch-specific data (metadata, stats)
# Take framework changes from main (templates, scripts)

git add .
git commit -m "Merge framework v${NEW_VER} into ${branch}"
```

### Issue: Tests fail after framework update

**Solution:**
1. Identify which test is failing
2. Determine if it's a legitimate bug or test needs updating
3. Fix code or update test
4. Don't proceed with release until all tests pass

### Issue: Documentation out of sync

**Solution:**
```bash
# Systematically check all docs
grep -r "v2\.0" --include="*.md" | grep -v CHANGELOG

# Update each file
# Commit separately for clarity
git commit -m "Update docs to reference v2.1"
```

## Reference

- **Framework documentation:** [tools/README.md](tools/README.md)
- **UD data releases:** [ADDING_NEW_UD_VERSION.md](ADDING_NEW_UD_VERSION.md)
- **User migration:** [MIGRATION.md](MIGRATION.md)
- **External library:** https://github.com/bot-zen/ud-hf-parquet-tools
- **Semantic versioning:** https://semver.org/

## Support

For questions about framework releases:
- Check existing release notes in CHANGELOG.md
- Review past release PRs/commits
- Open an issue in the repository