Directory macros/latex/contrib/latex2pydata
README
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/tree/main/latex 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/tree/main/python). 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/tree/main/python). 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.
Download the contents of this package in one zip archive (297.7k).
latex2pydata – Write data to file in Python literal format
This package writes data to file using Python literal syntax. The data may be loaded safely in Python using the ast.literal_eval() function or the latex2pydata Python package. The data can also be hashed within LaTeX (mdfivesum) so that it is possible to check for the existence of external cached content generated with the data.
Package | latex2pydata |
Bug tracker | https://github.com/gpoore/latex2pydata/issues |
Repository | https://github.com/gpoore/latex2pydata |
Version | 0.3.0 2024-10-16 |
Licenses | The LaTeX Project Public License 1.3c |
Copyright | 2023–2024 Geoffrey M. Poore |
Maintainer | Geoffrey Poore |
Contained in | TeX Live as latex2pydata MiKTeX as latex2pydata |
Topics | Data manipulation |