Debian Codegraph @

texmf-dist/doc/latex/latex2pydata/README

raw
1 latex2pydata - write data to file in Python literal format
2
3 Author: Geoffrey M. Poore
4 License: LPPL v1.3c or later
5 Development: https://github.com/gpoore/latex2pydata/tree/main/latex
6
7
8 latex2pydata is a LaTeX package for writing data to file using Python literal
9 syntax (https://docs.python.org/3/reference/lexical_analysis.html#literals).
10 The data may be loaded safely in Python using the ast.literal_eval() function
11 (https://docs.python.org/3/library/ast.html#ast.literal_eval) or the
12 latex2pydata Python package
13 https://github.com/gpoore/latex2pydata/tree/main/python).
14
15 The top-level data structure can be configured as either a Python dict or a
16 list of dicts. Within dicts, all keys and values are written to file as
17 Python string literals. However, this does not limit the data types that can
18 be passed from LaTeX to Python. When data is loaded, the included schema
19 functionality makes it possible to convert string values into other Python
20 data types such as dicts, lists, sets, bools, and numbers.
21
22 The data is suitable for direct loading in Python with ast.literal_eval().
23 It is also possible to load data using the latex2pydata Python package
24 (https://github.com/gpoore/latex2pydata/tree/main/python). This functions as
25 a wrapper for ast.literal_eval(). The package requires all keys to match the
26 regex "[A-Za-z_][0-9A-Za-z_]*". Periods in keys are interpreted as key paths
27 and indicate sub-dicts. For example, the key path "main.sub" represents a key
28 "main" in the main dict that maps to a sub-dict containing a key "sub". The
29 Python package supports the schema features provided by the LaTeX package, so
30 that data types other than dicts of strings are possible.