Skip to content

Instantly share code, notes, and snippets.

@sayrer
Created December 1, 2025 19:24
Show Gist options
  • Select an option

  • Save sayrer/e976c9d73105751b9d60d3a049ebbf5e to your computer and use it in GitHub Desktop.

Select an option

Save sayrer/e976c9d73105751b9d60d3a049ebbf5e to your computer and use it in GitHub Desktop.
Summary
Successfully completed both tasks:
### 1. Made `tld_gen.py` Hermetic in Bazel ✅
**Changes:**
- **Updated `tld_gen.py`** - Added CLI arguments, replaced deprecated imports, added UTF-8 handling
- **Created `tld_gen_requirements.txt`** - Specified `PyYAML==6.0.1` and `patricia-trie==10`
- **Updated `MODULE.bazel`** - Added pip extension for hermetic Python dependencies
- **Created `rust/conformance/tests/BUILD.bazel`** - Added `py_binary` and `genrule` for hermetic TLD generation
**Build command:**
```bash
bazel build //rust/conformance/tests:generate_tld_grammar
```
### 2. Updated TLD List from IANA ✅
**Changes:**
- **Broke symlink** `rust/conformance/tests/tld_lib.yml` → now a real file
- **Updated with IANA data** from https://data.iana.org/TLD/tlds-alpha-by-domain.txt (Version 2025120100)
- **Added 70 new TLDs** including: `amazon`, `cpa`, `gay`, `kids`, `llp`, `music`, `spa`, plus many internationalized domains
- **Minimal diff** - Only new entries appended, existing entries preserved in original order
- **Left `confomance/` untouched** - No BUILD.bazel file, original tld_lib.yml unchanged
**Final stats:**
- 312 country TLDs
- 1,326 generic TLDs
- 1,638 total TLDs in rust copy
- Generates 3,349 lines of Pest grammar
The build is fully hermetic with zero local configuration required!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment