maci
The easy to use library for data serialization
maci is a python-styled serialization language & thin wrapper library that makes handling serialized data simple. It parses native python data types from any plain file, which can be safer than using an executable .py file for your stored save data or configuration data.
Focuses on reducing boilerplate by removing repetitive implementation, like code written for common file handling, or common libraries used like JSON, YAML, TOML, etc., and move towards concision.
It also introduces features like loading stored data back into your class object, or creating realistic constants for your name/value pairs by locking them, mapping a name to another to follow its value similar to a pointer, and much more.
maci on its own is a pure Python-based library. I've used variations of this library for many external projects, and I wanted to make a robust and stable public version. It has made common needs less painful and has solved simplicity in many ways. Hope it helps you!
insights
Use python data types for your data (literally use python data types as stored values loading them securely using any text file created.
Supports json, yaml, toml, xml, ini/conf using common & native libraries with the idea of simpler api abstraction.
Use built-in features for locking your data, referencing data by mapping names, loading stored data back into your class object, and other quick and easy tools like getting or comparing the hash of a file or easily formatting large data sets.
goals
To provide a simple and easy experience in loading/dumping serialized data, with convenient extras!
Support the freedom to load your own custom save file, config file, or data file using plain text with any file extension using python's native data types for your projects.
Make access convenient for other serialization libraries as well!
can't I just load .py files or use pickle you might ask?
The maci library language maintains a different more secure approach with techniques to ensure loading python data is not susceptible to code execution like what you would expect when you load a py or pickle file (as by design, and not to detract from their native power) to just access variables or attributes and their values. Python's documentation also states that pickle is insecure for that reason as well, but there are methods to make pickle secure for that purpose. It is more widely accepted to use common data serialization formats designed for storing values if you want to just load your values or data back whether you use maci or not, but maci does just that as well using python's native types to make your life easier with secure mechanics. Some of the techniques include only allowing the loading of primitive data types, name duplication protection so all name references in a file need to be unique, and name reference locking to protect against re-assignment (essentially creating a constant on any primitive type), and more.
You can pickle maci objects if you really wanted to as well.
install flavors
full -> maci, standard library, and 3rd-party packages included
standard lib -> maci and standard library based packages only
just maci -> maci package only
code
https://github.com/aaronater10/maci For more information on contributing, see CONTRIBUTING
pypi
https://pypi.org/project/maci/ https://pypi.org/project/maci-std/ https://pypi.org/project/maci-only/
Last updated