Skip to content

Commit 9ca8424

Browse files
committed
Add dev notes for codegen script; drop uvx from hatch run command
1 parent 2bd8c23 commit 9ca8424

3 files changed

Lines changed: 28 additions & 3 deletions

File tree

DEVELOPER_NOTES.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,19 @@ pip install -e ".[docs]"
8888
sphinx-build docs docs/_build
8989
```
9090

91-
HTML documentation will be generated in `docs/_build/html`
91+
HTML documentation will be generated in `docs/_build/html`
92+
93+
94+
### Regenerating multilingual Gregorian month name parse file
95+
96+
The Gregorian Lark parser includes a script-generated file, which
97+
populates month names based on a list of language codes using the Babel
98+
library. To regenerate, run the script with hatch (which should
99+
be installed globally)::
100+
101+
hatch run codegen:generate
102+
103+
When the `.lark` file is modified by the script, it must be committed to git.
104+
105+
106+

scripts/generate_gregorian_grammar.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
#!/usr/bin/env python
2+
"""
3+
This script generates the gregorian_multilang.lark file
4+
with month names (full and abbreviated) based on the list of
5+
target languages.
6+
7+
Run this script with hatch to regeneate the file::
8+
9+
hatch run codegen:generate
10+
11+
"""
212

313
from collections import defaultdict
414
import pathlib
@@ -25,7 +35,7 @@
2535

2636
# warning to include at top of generated file
2737
warning_text = """// WARNING: This file is auto-generated. DO NOT EDIT.
28-
// To regenerate: uvx hatch run codegen:generate
38+
// To regenerate: hatch run codegen:generate
2939
3040
"""
3141

src/undate/converters/grammars/gregorian_multilang.lark

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// WARNING: This file is auto-generated. DO NOT EDIT.
2-
// To regenerate: uvx hatch run codegen:generate
2+
// To regenerate: hatch run codegen:generate
33

44
month_1: "January" | "Jan" | "enero" | "ene" | "janvier" | "janv" | "Januar" | "Mutarama" | "mut" | "Janwaliyo" | "ጥሪ"
55
month_2: "February" | "Feb" | "febrero" | "feb" | "février" | "févr" | "Februar" | "Gashyantare" | "gas" | "Febwaliyo" | "ለካቲት" | "ለካ"

0 commit comments

Comments
 (0)