diff options
author | Norbert Preining <norbert@preining.info> | 2023-11-21 03:02:55 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2023-11-21 03:02:55 +0000 |
commit | ff01be90452ac7aec530af4623f334ca21869cc5 (patch) | |
tree | c6cce3ca77cbf7d86029297394b55c965199c062 /macros/latex/contrib/latex2pydata/README | |
parent | 682900f29e7ea9d31046e9541be14fd749b2eb17 (diff) |
CTAN sync 202311210302
Diffstat (limited to 'macros/latex/contrib/latex2pydata/README')
-rw-r--r-- | macros/latex/contrib/latex2pydata/README | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/macros/latex/contrib/latex2pydata/README b/macros/latex/contrib/latex2pydata/README new file mode 100644 index 0000000000..678217ebc7 --- /dev/null +++ b/macros/latex/contrib/latex2pydata/README @@ -0,0 +1,29 @@ +latex2pydata - write data to file in Python literal format + +Author: Geoffrey M. Poore +License: LPPL v1.3c or later +Development: https://github.com/gpoore/latex2pydata_tex + + +latex2pydata is a LaTeX package for writing data to file using Python literal +syntax (https://docs.python.org/3/reference/lexical_analysis.html#literals). +The data may be loaded safely in Python using the ast.literal_eval() function +(https://docs.python.org/3/library/ast.html#ast.literal_eval) or the +latex2pydata Python package https://github.com/gpoore/latex2pydata_py). + +The top-level data structure can be configured as either a Python dict or a +list of dicts. Within dicts, all keys and values are written to file as +Python string literals. However, this does not limit the data types that can +be passed from LaTeX to Python. When data is loaded, the included schema +functionality makes it possible to convert string values into other Python +data types such as dicts, lists, sets, bools, and numbers. + +The data is suitable for direct loading in Python with ast.literal_eval(). +It is also possible to load data using the latex2pydata Python package +(https://github.com/gpoore/latex2pydata_py). This functions as a wrapper for +ast.literal_eval(). The package requires all keys to match the regex +"[A-Za-z_][0-9A-Za-z_]*". Periods in keys are interpreted as key paths and +indicate sub-dicts. For example, the key path "main.sub" represents a key +"main" in the main dict that maps to a sub-dict containing a key "sub". The +Python package supports the schema features provided by the LaTeX package, so +that data types other than dicts of strings are possible. |