Getting started
Requirements
- Python 3.10 or newer
PyYAML,defusedxml,json5, andtomli-w(installed with the package)tomlion Python 3.10 (3.11+ uses stdlibtomllib)
Install
Then import the namespace:
The PyPI name is lupaxa-data-converter. The import path is
lupaxa.data_converter. lupaxa is a namespace package — there is no
lupaxa/__init__.py.
This is a library only. There is no console script and no
python -m lupaxa.data_converter entry point.
From source (development)
Editable install with dev extras (includes the MkDocs pins):
Site Markdown lives in mkdocs/ (not GitHub’s special docs/ directory).
After makefile-skills are installed:
First conversion
from lupaxa.data_converter import DataConverter
payload = {"name": "Lupaxa", "formats": ["json", "json5", "xml", "yaml", "toml"]}
converter = DataConverter(payload, data_type="dict")
print(converter.to_json())
print(converter.to_json5())
print(converter.to_xml())
print(converter.to_yaml())
print(converter.to_toml())
Load a document string by passing data_type as json, json5, xml,
yaml, or toml. The value is always stored as a dictionary, then any
to_* method can write it out.