Core library and LGR data structure used to manipulate an LGR.
This version conforms to the specification RFC7940.
This library was implemented by Viagenie (Julien Bernard, Michel Bernier, Guillaume Blanchet, Marc Blanchet, Vincent Gonzalez, Audric Schiltknecht and Alexandre Taillon-Desrochers) and Wil Tan on an ICANN contract.
- Python 3.10 and above
- LibXML2 [MIT License] used by the lxml Python bindings
The main dependencies are defined in the requirements.txt file.
- language-tags [MIT License]
- lxml [BSD License]
- munidata for Unicode-related properties access [BSD License]
- picu [MIT/X License]
- pycountry [L-GPL License]
The dependencies to run the test suite are defined in the tests requirements.txt.
- idna [BSD License]
- pytest [MIT License]
- pytest-cov [MIT License]
The dependencies to build the documentation are defined in the doc requirements.txt file.
If your distribution does not package the required dependencies, the easiest way to get a working environment in no-time is to use Python's virtual environments.
-
Install virtualenv
-
Create a python virtualenv:
$ virtualenv venv -
Activate the environment:
$ source ./venv/bin/activate -
Download dependencies:
(venv) $ pip install -r requirements.txt
The tools directory contains some tools to exercise the library.
xml_dump.pyparses an XML LGR file, creates the LGR structure, and convert it back to XML.make_idna_repertoire.pygenerates the IDNA2008 starting repertoire, by parsing the IDNA2008 table registry available on IANA website, and collecting allPVALID,CONTEXTOandCONTEXTJcharacters.lgr_cli.pyparsed an XML LGR file, and validate it against configured MSR and Unicode version.rfcXXXX_dump.pyparses inputs in RFC XXXX format, and generate an XML LGR.one_per_line_dump.pyparses input in the "one per line" format, and generate an XML LGR.rfc7940_validate.pytakes an LGR and checks it for compliance with RFC 7940.
Other tools are available to manipulate LGR files and labels:
lgr_annotate.pytakes an LGR and a list of labels and output the list of labels with their respective disposition.lgr_collision.pytakes an LGR and a list of labels and check for collision(s) between the labels/variants.lgr_compare.pyis used to compare 2 LGR (output textual diff, merge, intersection).lgr_diff_collision.pytakes 2 LGR and one set of labels, and test for collisions between labels and generated variants from the 2 LGR.lgr_merge_set.pytakes some LGRs and create a merged LGR from the provided set.lgr_check_harmonizedchecks that variants code points from a list of LGRs are symmetric and transitive in each LGR, and list missing variants from one LGR to another.lgr_cross_script_variantstakes some LGRs and generate the list of cross-script variants.lgr_idn_table_review.pyreviews IDN tables against reference LGRs.
Tests and coverage report can be run as follows:
(venv) $ pip install tox
(venv) $ tox
Open htmlcov/index.html in a web browser for the coverage report.
To generate the documentation, go to the doc directory and run the following command:
(venv) $ make html
The generated documentation is available in doc/_build/html/index.html.