icukit 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. icukit-0.1.2/LICENSE +21 -0
  2. icukit-0.1.2/PKG-INFO +168 -0
  3. icukit-0.1.2/README.md +135 -0
  4. icukit-0.1.2/icukit/__init__.py +530 -0
  5. icukit-0.1.2/icukit/alpha_index.py +279 -0
  6. icukit-0.1.2/icukit/bidi.py +245 -0
  7. icukit-0.1.2/icukit/breaker.py +370 -0
  8. icukit-0.1.2/icukit/calendar.py +179 -0
  9. icukit-0.1.2/icukit/cli/__init__.py +5 -0
  10. icukit-0.1.2/icukit/cli/__main__.py +7 -0
  11. icukit-0.1.2/icukit/cli/base.py +87 -0
  12. icukit-0.1.2/icukit/cli/command/__init__.py +59 -0
  13. icukit-0.1.2/icukit/cli/command/alpha_index.py +141 -0
  14. icukit-0.1.2/icukit/cli/command/bidi.py +176 -0
  15. icukit-0.1.2/icukit/cli/command/breaker.py +263 -0
  16. icukit-0.1.2/icukit/cli/command/calendar.py +113 -0
  17. icukit-0.1.2/icukit/cli/command/collator.py +286 -0
  18. icukit-0.1.2/icukit/cli/command/compact.py +100 -0
  19. icukit-0.1.2/icukit/cli/command/datetime.py +702 -0
  20. icukit-0.1.2/icukit/cli/command/discover.py +215 -0
  21. icukit-0.1.2/icukit/cli/command/displayname.py +255 -0
  22. icukit-0.1.2/icukit/cli/command/duration.py +243 -0
  23. icukit-0.1.2/icukit/cli/command/help_cmd.py +86 -0
  24. icukit-0.1.2/icukit/cli/command/idna.py +118 -0
  25. icukit-0.1.2/icukit/cli/command/listfmt.py +94 -0
  26. icukit-0.1.2/icukit/cli/command/locale.py +757 -0
  27. icukit-0.1.2/icukit/cli/command/measure.py +433 -0
  28. icukit-0.1.2/icukit/cli/command/message.py +171 -0
  29. icukit-0.1.2/icukit/cli/command/parse.py +179 -0
  30. icukit-0.1.2/icukit/cli/command/plural.py +221 -0
  31. icukit-0.1.2/icukit/cli/command/regex.py +520 -0
  32. icukit-0.1.2/icukit/cli/command/region.py +209 -0
  33. icukit-0.1.2/icukit/cli/command/script.py +203 -0
  34. icukit-0.1.2/icukit/cli/command/search.py +293 -0
  35. icukit-0.1.2/icukit/cli/command/sort.py +117 -0
  36. icukit-0.1.2/icukit/cli/command/spoof.py +158 -0
  37. icukit-0.1.2/icukit/cli/command/timezone.py +160 -0
  38. icukit-0.1.2/icukit/cli/command/transliterate.py +391 -0
  39. icukit-0.1.2/icukit/cli/command/unicode.py +451 -0
  40. icukit-0.1.2/icukit/cli/command_trie.py +116 -0
  41. icukit-0.1.2/icukit/cli/locale_helpers.py +87 -0
  42. icukit-0.1.2/icukit/cli/logging_setup.py +35 -0
  43. icukit-0.1.2/icukit/cli/main.py +235 -0
  44. icukit-0.1.2/icukit/cli/output_helpers.py +55 -0
  45. icukit-0.1.2/icukit/cli/subcommand_base.py +306 -0
  46. icukit-0.1.2/icukit/collator.py +211 -0
  47. icukit-0.1.2/icukit/compact.py +91 -0
  48. icukit-0.1.2/icukit/datetime.py +657 -0
  49. icukit-0.1.2/icukit/discover.py +163 -0
  50. icukit-0.1.2/icukit/displayname.py +317 -0
  51. icukit-0.1.2/icukit/duration.py +297 -0
  52. icukit-0.1.2/icukit/errors.py +151 -0
  53. icukit-0.1.2/icukit/formatters.py +209 -0
  54. icukit-0.1.2/icukit/idna.py +237 -0
  55. icukit-0.1.2/icukit/list_format.py +133 -0
  56. icukit-0.1.2/icukit/locale.py +896 -0
  57. icukit-0.1.2/icukit/measure.py +601 -0
  58. icukit-0.1.2/icukit/message.py +182 -0
  59. icukit-0.1.2/icukit/parse.py +217 -0
  60. icukit-0.1.2/icukit/plural.py +243 -0
  61. icukit-0.1.2/icukit/regex.py +599 -0
  62. icukit-0.1.2/icukit/region.py +225 -0
  63. icukit-0.1.2/icukit/script.py +281 -0
  64. icukit-0.1.2/icukit/search.py +347 -0
  65. icukit-0.1.2/icukit/spoof.py +283 -0
  66. icukit-0.1.2/icukit/timezone.py +195 -0
  67. icukit-0.1.2/icukit/transliterator.py +280 -0
  68. icukit-0.1.2/icukit/unicode.py +380 -0
  69. icukit-0.1.2/icukit.egg-info/PKG-INFO +168 -0
  70. icukit-0.1.2/icukit.egg-info/SOURCES.txt +104 -0
  71. icukit-0.1.2/icukit.egg-info/dependency_links.txt +1 -0
  72. icukit-0.1.2/icukit.egg-info/entry_points.txt +3 -0
  73. icukit-0.1.2/icukit.egg-info/requires.txt +4 -0
  74. icukit-0.1.2/icukit.egg-info/top_level.txt +1 -0
  75. icukit-0.1.2/pyproject.toml +52 -0
  76. icukit-0.1.2/setup.cfg +4 -0
  77. icukit-0.1.2/tests/test_alpha_index.py +185 -0
  78. icukit-0.1.2/tests/test_bidi.py +209 -0
  79. icukit-0.1.2/tests/test_breaker.py +219 -0
  80. icukit-0.1.2/tests/test_calendar.py +183 -0
  81. icukit-0.1.2/tests/test_cli.py +263 -0
  82. icukit-0.1.2/tests/test_collator.py +261 -0
  83. icukit-0.1.2/tests/test_command_trie.py +110 -0
  84. icukit-0.1.2/tests/test_compact.py +175 -0
  85. icukit-0.1.2/tests/test_datetime.py +462 -0
  86. icukit-0.1.2/tests/test_displayname.py +302 -0
  87. icukit-0.1.2/tests/test_duration.py +267 -0
  88. icukit-0.1.2/tests/test_errors.py +46 -0
  89. icukit-0.1.2/tests/test_idna.py +165 -0
  90. icukit-0.1.2/tests/test_imports.py +73 -0
  91. icukit-0.1.2/tests/test_list_format.py +145 -0
  92. icukit-0.1.2/tests/test_locale.py +764 -0
  93. icukit-0.1.2/tests/test_locale_helpers.py +61 -0
  94. icukit-0.1.2/tests/test_measure.py +300 -0
  95. icukit-0.1.2/tests/test_message.py +161 -0
  96. icukit-0.1.2/tests/test_parse.py +192 -0
  97. icukit-0.1.2/tests/test_plural.py +243 -0
  98. icukit-0.1.2/tests/test_regex.py +213 -0
  99. icukit-0.1.2/tests/test_region.py +201 -0
  100. icukit-0.1.2/tests/test_script.py +179 -0
  101. icukit-0.1.2/tests/test_search.py +362 -0
  102. icukit-0.1.2/tests/test_smoke.py +32 -0
  103. icukit-0.1.2/tests/test_spoof.py +187 -0
  104. icukit-0.1.2/tests/test_timezone.py +196 -0
  105. icukit-0.1.2/tests/test_transliterator.py +94 -0
  106. icukit-0.1.2/tests/test_unicode.py +249 -0
icukit-0.1.2/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kevin Lenzo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
icukit-0.1.2/PKG-INFO ADDED
@@ -0,0 +1,168 @@
1
+ Metadata-Version: 2.4
2
+ Name: icukit
3
+ Version: 0.1.2
4
+ Summary: ICU toolkit - library and CLI for Unicode and internationalization
5
+ Author-email: Kevin Lenzo <kevinlenzo@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/lenzo-ka/icukit
8
+ Project-URL: Repository, https://github.com/lenzo-ka/icukit
9
+ Project-URL: Issues, https://github.com/lenzo-ka/icukit/issues
10
+ Keywords: icu,unicode,i18n,internationalization,localization,text,collation,formatting
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: MacOS
15
+ Classifier: Operating System :: POSIX :: Linux
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
23
+ Classifier: Topic :: Software Development :: Internationalization
24
+ Classifier: Topic :: Software Development :: Localization
25
+ Classifier: Topic :: Text Processing
26
+ Requires-Python: >=3.9
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ Requires-Dist: icukit-pyicu>=78.2.1
30
+ Provides-Extra: dev
31
+ Requires-Dist: pytest>=9.0; extra == "dev"
32
+ Dynamic: license-file
33
+
34
+ # icukit
35
+
36
+ A comprehensive Python toolkit for Unicode and internationalization, built on ICU (International Components for Unicode).
37
+
38
+ icukit provides a Pythonic interface to ICU's powerful text processing, localization, and internationalization capabilities. It includes both a library API and a command-line interface.
39
+
40
+ ## Installation
41
+
42
+ ```bash
43
+ pip install icukit
44
+ ```
45
+
46
+ icukit bundles ICU libraries via `icukit-pyicu`, so no system ICU installation is required.
47
+
48
+ ## Features
49
+
50
+ ### Text Processing
51
+
52
+ - **Transliteration**: Convert between scripts (Latin to Cyrillic, Hangul to Latin, etc.)
53
+ - **Normalization**: NFC, NFD, NFKC, NFKD Unicode normalization forms
54
+ - **Text Segmentation**: Break text into words, sentences, lines, or grapheme clusters
55
+ - **Unicode Regex**: Full Unicode-aware regular expressions with script and property support
56
+
57
+ ### Localization
58
+
59
+ - **Number Formatting**: Decimal, currency, percent, scientific, spelled-out numbers
60
+ - **Date/Time Formatting**: Locale-aware date and time formatting with multiple styles
61
+ - **Duration Formatting**: Human-readable time durations ("2 hours, 30 minutes")
62
+ - **List Formatting**: Locale-aware list formatting ("A, B, and C")
63
+ - **Plural Rules**: Determine plural categories (one, few, many, other) for any locale
64
+ - **Message Formatting**: ICU MessageFormat for complex localized strings
65
+
66
+ ### Internationalization Utilities
67
+
68
+ - **Collation**: Locale-aware string sorting and comparison
69
+ - **Locale Information**: Parse, validate, and query locale data
70
+ - **Script Detection**: Identify writing scripts in text
71
+ - **Bidirectional Text**: Detect and handle RTL/LTR text
72
+ - **IDNA**: Internationalized domain name encoding/decoding
73
+ - **Spoof Detection**: Detect confusable characters and homograph attacks
74
+
75
+ ### Reference Data
76
+
77
+ - **Regions**: Country and region codes with containment relationships
78
+ - **Scripts**: Writing system information and properties
79
+ - **Timezones**: Timezone data with offsets and equivalents
80
+ - **Calendars**: Calendar system information (Gregorian, Hebrew, Islamic, etc.)
81
+
82
+ ## Quick Start
83
+
84
+ ### Library API
85
+
86
+ ```python
87
+ from icukit import (
88
+ transliterate,
89
+ sort_strings,
90
+ format_number,
91
+ format_datetime,
92
+ get_plural_category,
93
+ break_words,
94
+ )
95
+
96
+ # Transliterate text between scripts
97
+ transliterate("Привет мир", "Russian-Latin/BGN") # "Privet mir"
98
+ transliterate("hello", "Latin-Cyrillic") # "хелло"
99
+
100
+ # Sort strings with locale-aware collation
101
+ sort_strings(["cafe", "café", "CAFE"], "en_US") # ['cafe', 'café', 'CAFE']
102
+ sort_strings(["Öl", "Ol", "öl"], "de_DE") # ['Ol', 'Öl', 'öl']
103
+
104
+ # Format numbers for different locales
105
+ format_number(1234567.89, "en_US") # "1,234,567.89"
106
+ format_number(1234567.89, "de_DE") # "1.234.567,89"
107
+ format_number(1234567.89, "hi_IN") # "12,34,567.89"
108
+
109
+ # Format dates
110
+ from datetime import datetime
111
+ now = datetime.now()
112
+ format_datetime(now, "en_US", style="LONG") # "January 19, 2026 at 4:00:00 PM PST"
113
+ format_datetime(now, "ja_JP", style="LONG") # "2026年1月19日 16:00:00 PST"
114
+
115
+ # Determine plural category
116
+ get_plural_category(1, "en") # "one"
117
+ get_plural_category(2, "en") # "other"
118
+ get_plural_category(2, "ru") # "few"
119
+ get_plural_category(5, "ru") # "many"
120
+
121
+ # Break text into words
122
+ break_words("Hello, world!") # ["Hello", ",", " ", "world", "!"]
123
+ ```
124
+
125
+ ### Command-Line Interface
126
+
127
+ icukit includes a full-featured CLI accessible via `icukit` or `ik`:
128
+
129
+ ```bash
130
+ # Transliterate text
131
+ ik transliterate "Москва" Russian-Latin/BGN
132
+ # Output: Moskva
133
+
134
+ # Format numbers
135
+ ik number 1234567.89 --locale de_DE
136
+ # Output: 1.234.567,89
137
+
138
+ # Get locale information
139
+ ik locale info en_US
140
+
141
+ # List available transliterators
142
+ ik transliterate --list
143
+
144
+ # Sort lines with locale collation
145
+ cat names.txt | ik sort --locale sv_SE
146
+
147
+ # Detect scripts in text
148
+ ik script detect "Hello Мир 世界"
149
+
150
+ # Get Unicode character information
151
+ ik unicode info "A"
152
+ ```
153
+
154
+ Run `ik help` or `ik <command> --help` for detailed usage information.
155
+
156
+ ## Supported Python Versions
157
+
158
+ - Python 3.9+
159
+ - Tested on Linux and macOS
160
+
161
+ ## Documentation
162
+
163
+ - [API Reference](https://github.com/lenzo-ka/icukit/blob/main/docs/api.md)
164
+ - [CLI Reference](https://github.com/lenzo-ka/icukit/blob/main/docs/cli.md)
165
+
166
+ ## License
167
+
168
+ MIT License
icukit-0.1.2/README.md ADDED
@@ -0,0 +1,135 @@
1
+ # icukit
2
+
3
+ A comprehensive Python toolkit for Unicode and internationalization, built on ICU (International Components for Unicode).
4
+
5
+ icukit provides a Pythonic interface to ICU's powerful text processing, localization, and internationalization capabilities. It includes both a library API and a command-line interface.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ pip install icukit
11
+ ```
12
+
13
+ icukit bundles ICU libraries via `icukit-pyicu`, so no system ICU installation is required.
14
+
15
+ ## Features
16
+
17
+ ### Text Processing
18
+
19
+ - **Transliteration**: Convert between scripts (Latin to Cyrillic, Hangul to Latin, etc.)
20
+ - **Normalization**: NFC, NFD, NFKC, NFKD Unicode normalization forms
21
+ - **Text Segmentation**: Break text into words, sentences, lines, or grapheme clusters
22
+ - **Unicode Regex**: Full Unicode-aware regular expressions with script and property support
23
+
24
+ ### Localization
25
+
26
+ - **Number Formatting**: Decimal, currency, percent, scientific, spelled-out numbers
27
+ - **Date/Time Formatting**: Locale-aware date and time formatting with multiple styles
28
+ - **Duration Formatting**: Human-readable time durations ("2 hours, 30 minutes")
29
+ - **List Formatting**: Locale-aware list formatting ("A, B, and C")
30
+ - **Plural Rules**: Determine plural categories (one, few, many, other) for any locale
31
+ - **Message Formatting**: ICU MessageFormat for complex localized strings
32
+
33
+ ### Internationalization Utilities
34
+
35
+ - **Collation**: Locale-aware string sorting and comparison
36
+ - **Locale Information**: Parse, validate, and query locale data
37
+ - **Script Detection**: Identify writing scripts in text
38
+ - **Bidirectional Text**: Detect and handle RTL/LTR text
39
+ - **IDNA**: Internationalized domain name encoding/decoding
40
+ - **Spoof Detection**: Detect confusable characters and homograph attacks
41
+
42
+ ### Reference Data
43
+
44
+ - **Regions**: Country and region codes with containment relationships
45
+ - **Scripts**: Writing system information and properties
46
+ - **Timezones**: Timezone data with offsets and equivalents
47
+ - **Calendars**: Calendar system information (Gregorian, Hebrew, Islamic, etc.)
48
+
49
+ ## Quick Start
50
+
51
+ ### Library API
52
+
53
+ ```python
54
+ from icukit import (
55
+ transliterate,
56
+ sort_strings,
57
+ format_number,
58
+ format_datetime,
59
+ get_plural_category,
60
+ break_words,
61
+ )
62
+
63
+ # Transliterate text between scripts
64
+ transliterate("Привет мир", "Russian-Latin/BGN") # "Privet mir"
65
+ transliterate("hello", "Latin-Cyrillic") # "хелло"
66
+
67
+ # Sort strings with locale-aware collation
68
+ sort_strings(["cafe", "café", "CAFE"], "en_US") # ['cafe', 'café', 'CAFE']
69
+ sort_strings(["Öl", "Ol", "öl"], "de_DE") # ['Ol', 'Öl', 'öl']
70
+
71
+ # Format numbers for different locales
72
+ format_number(1234567.89, "en_US") # "1,234,567.89"
73
+ format_number(1234567.89, "de_DE") # "1.234.567,89"
74
+ format_number(1234567.89, "hi_IN") # "12,34,567.89"
75
+
76
+ # Format dates
77
+ from datetime import datetime
78
+ now = datetime.now()
79
+ format_datetime(now, "en_US", style="LONG") # "January 19, 2026 at 4:00:00 PM PST"
80
+ format_datetime(now, "ja_JP", style="LONG") # "2026年1月19日 16:00:00 PST"
81
+
82
+ # Determine plural category
83
+ get_plural_category(1, "en") # "one"
84
+ get_plural_category(2, "en") # "other"
85
+ get_plural_category(2, "ru") # "few"
86
+ get_plural_category(5, "ru") # "many"
87
+
88
+ # Break text into words
89
+ break_words("Hello, world!") # ["Hello", ",", " ", "world", "!"]
90
+ ```
91
+
92
+ ### Command-Line Interface
93
+
94
+ icukit includes a full-featured CLI accessible via `icukit` or `ik`:
95
+
96
+ ```bash
97
+ # Transliterate text
98
+ ik transliterate "Москва" Russian-Latin/BGN
99
+ # Output: Moskva
100
+
101
+ # Format numbers
102
+ ik number 1234567.89 --locale de_DE
103
+ # Output: 1.234.567,89
104
+
105
+ # Get locale information
106
+ ik locale info en_US
107
+
108
+ # List available transliterators
109
+ ik transliterate --list
110
+
111
+ # Sort lines with locale collation
112
+ cat names.txt | ik sort --locale sv_SE
113
+
114
+ # Detect scripts in text
115
+ ik script detect "Hello Мир 世界"
116
+
117
+ # Get Unicode character information
118
+ ik unicode info "A"
119
+ ```
120
+
121
+ Run `ik help` or `ik <command> --help` for detailed usage information.
122
+
123
+ ## Supported Python Versions
124
+
125
+ - Python 3.9+
126
+ - Tested on Linux and macOS
127
+
128
+ ## Documentation
129
+
130
+ - [API Reference](https://github.com/lenzo-ka/icukit/blob/main/docs/api.md)
131
+ - [CLI Reference](https://github.com/lenzo-ka/icukit/blob/main/docs/cli.md)
132
+
133
+ ## License
134
+
135
+ MIT License