{"id":15010054,"url":"https://github.com/aaronater10/maci","last_synced_at":"2026-03-15T21:23:43.967Z","repository":{"id":65263733,"uuid":"583462094","full_name":"aaronater10/maci","owner":"aaronater10","description":"An easy to use library for data serialization","archived":false,"fork":false,"pushed_at":"2023-12-02T21:54:54.000Z","size":3088,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-25T04:18:50.460Z","etag":null,"topics":["conf","config","data","data-serialization","dump","easy","export","file","import","ini","json","load","maci","parser","python","serialize","simple","toml","xml","yaml"],"latest_commit_sha":null,"homepage":"https://docs.macilib.org/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aaronater10.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-29T21:18:23.000Z","updated_at":"2023-12-02T22:34:24.000Z","dependencies_parsed_at":"2024-10-23T02:04:21.083Z","dependency_job_id":null,"html_url":"https://github.com/aaronater10/maci","commit_stats":{"total_commits":2,"total_committers":2,"mean_commits":1.0,"dds":0.5,"last_synced_commit":"1861093e9fe5b004caaeef70a3c766ecbb04f1b4"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaronater10%2Fmaci","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaronater10%2Fmaci/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaronater10%2Fmaci/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaronater10%2Fmaci/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aaronater10","download_url":"https://codeload.github.com/aaronater10/maci/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243258505,"owners_count":20262300,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["conf","config","data","data-serialization","dump","easy","export","file","import","ini","json","load","maci","parser","python","serialize","simple","toml","xml","yaml"],"created_at":"2024-09-24T19:29:43.791Z","updated_at":"2025-12-26T21:49:09.269Z","avatar_url":"https://github.com/aaronater10.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Docs](https://raw.githubusercontent.com/aaronater10/maci/main/ext/maci_cover.png)](https://docs.macilib.org/)\n\n# maci\nA Python-Styled Serialization Language \u0026 Thin Wrapper Library \n\n![maci-version](https://img.shields.io/pypi/v/maci.svg?label=maci\u0026color=blue)\n![maci-language-version](https://img.shields.io/badge/lang-v1.0.0-purple)\n[![qa-testing](https://github.com/aaronater10/maci/actions/workflows/maci_qa.yml/badge.svg)](https://github.com/aaronater10/maci/actions/workflows/maci_qa.yml)\n![coverage](https://img.shields.io/badge/coverage-100%25-red)\n![py-versions](https://img.shields.io/badge/py_versions-3.8_%7C_3.9_%7C_3.10_%7C_3.11_%7C_3.12_%7C_3.13-%23FFD43B)\n\n#\n\nmaci is an easy to use library for data serialization. It can parse native python data types from any plain file, which is safer than using an executable .py file for your stored or configuration data. There are useful language features built-in like 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.\n\nIts focus is to reduce boilerplate by removing repetitive code implementation, like code written for common file handling, or common libraries used like JSON, YAML, TOML, etc. maci on its own is a pure Python-based library, and I've used variations of this library on projects for many companies and decided 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\n\n# 🎓 tutorials \u0026 docs:\n**quick start: [tutorial video](https://docs.macilib.org/watch/quick-start)**\n\n**full tutorials: [all videos](https://docs.macilib.org/watch/full-training-series)**\n\n**docs: [maci docs](https://docs.macilib.org/)**\n\n**changelog: [update history](https://docs.macilib.org/updates/changelog)**\n\n**readme**\n\\\n[installing](#-install-flavors)\\\n[basic usage: maci](#-basic-usage)\\\n[basic usage: thin libs](#-basic-usage-thin-libs)\\\n[exceptions, hints, and built-in tools](#-helpful-extras)\\\n[performance](#%EF%B8%8F-performance)\\\n[testing \u0026 release](#-testing--release)\\\n[previous support](#-previous-project-support)\n\n\n# 🍨 install flavors\n\n**full --\u003e maci, standard library, and 3rd-party packages**\n```bash\npip install maci\n```\n**standard lib --\u003e maci and standard library based packages only**\n```bash\npip install maci-std\n```\n**just maci --\u003e maci package only**\n```bash\npip install maci-only\n```\n\n[back to top](#maci)\n\n# 📖 basic usage\n### maci\n\nExample file \"my.file\" with maci (Python-styled) data\n```python\n# Example maci data \"my.file\"\ndata1 = 'my data'\ndata2 = 1\ndata3 = [1,2,3]\ndata4 = {'k1': 1}\ndata5 = True\ndata6 = (1,2,3)\ndata7 = {1,2,3}\ndata8 = 1.0\ndata9 = None\ndata10 = b'\\ndata\\n'\n```\n#### Load\nload maci data from file\n```python\nmaci_data = maci.load('my.file')\nmaci_data.data1  # access data with attr name\n```\nload raw data from file\n```python\nraw_data = maci.loadraw('my.file')  # returns string (default)\n```\nload attributes names and their values back into your object from file\n```python\nmaci.loadattrs('my.file', my_obj)  # loads in-place\nmy_obj.data4  # access data in your object with attr name\n```\nload as dict data from file\n```python\ndict_data = maci.loaddict('my.file')\ndict_data['data3']  # access data as dict key name\n```\nload maci data from string\n```python\nmaci_data = maci.loadstr('data1 = \"data\"')\nmaci_data.data1  # access data with attr name\n```\nload as dict data from string\n```python\ndict_data = maci.loadstrdict('data3 = \"data\"')\ndict_data['data3']  # access data as dict key name\n```\n\n#### Dump\ndump data to file from maci object, dict, or your own object with attrs\n```python\nmaci.dump('my.file', maci_data or dict_data or my_obj)\n# creates new file with data formatted as maci syntax\n```\ndump raw data to file\n```python\nmaci.dumpraw('my.file', 'my data')\n# creates new file with data raw as-is to file\n```\ndump data to string from maci object, dict, or your own object with attrs\n```python\nstr_data = maci.dumpstr(maci_data or dict_data or my_obj)\n# returns string with data formatted as maci syntax\n```\n\n#### Build\nbuild maci data in code\n```python\nmaci_data = maci.build()\nmaci_data.data1 = 'my data'\nmaci_data.data2 = [1,2,3]\nmaci_data.data3 = 1\nmaci_data.data4 = True\n```\n#### In-File Language Features\nmaci supports varying in-file features. Here are some examples using a file named \"my.file\":\n\nLock an attr from re-assignment using a lock glyph\n```python\n# Example maci data in \"my.file\"\ndata1 +l= 'my data'\n```\nHard Lock an attr from re-assignment, deletion, and unlocking using a hard lock glyph\n```python\n# Example maci data in \"my.file\"\ndata1 +h= 'my data'\n```\nReference and follow another attr's value with an attr (like a pointer) using a map glyph\n```python\n# Example maci data in \"my.file\"\ndata1 = 'my data'\ndata2 +m= data1\n```\nDate and time parsing\n```python\n# Example maci data in \"my.file\"\n# Multiple options -\u003e returns datetime, date, or time object\ndate_time1 = 2023-03-13 22:06:00\ndate_time2 = 2023-03-13 22:06:00.50\ntime_date1 = 22:06:00 2023-03-13\ntime_date2 = 22:06:00.50 2023-03-13\ntime1 = 22:06:00\ntime2 = 22:06:00.50\ndate = 2023-03-13\ndate_time_iso8601 = 2023-03-13T22:06:00\n```\n\n#### In-Code Language Features\nThe in-file language features can also be handled in code with a maci object\n```python\nmaci_data.lock_attr('data1')\nmaci_data.hard_lock_attr('data2')\nmaci_data.map_attr('data3', 'data4')\n```\nYou may unlock attrs, unmap attrs, and much more with a maci object\n\nNote: if you dump your maci object back to a file, all language features will be retained and represented appropriately in the file\n\n[back to top](#maci)\n\n# 📖 basic usage: thin libs\n\n### json -\u003e based on [json standard library](https://docs.macilib.org/docs/json)\nload json data from file\n```python\ndata = maci.jsonload('file.json')\n```\nload json data from string\n```python\ndata = maci.jsonloadstr('{\"k1\": \"data\"}')\n```\ndump python data to file as json data\n```python\nmaci.jsondump('file.json', data)\n```\ndump data to string as json data\n```python\njson_data = maci.jsondumpstr(data)\n```\n### yaml -\u003e based on [pyyaml framework](https://docs.macilib.org/docs/yaml)\nload yaml data from file\n```python\ndata = maci.yamlload('file.yaml')\n```\nload yaml data from string\n```python\ndata = maci.yamlloadstr('k1: data')\n```\ndump python data to file as yaml data\n```python\nmaci.yamldump('file.yaml', data)\n```\ndump data to string as yaml data\n```python\nyaml_data = maci.yamldumpstr(data)\n```\nThere are also \"loadall\" and \"dumpall\" for multiple yaml docs in a file\n\n### toml -\u003e based on [tomli libraries](https://docs.macilib.org/docs/toml)\nload toml data from file\n```python\ndata = maci.tomlload('file.toml')\n```\nload toml data from string\n```python\ndata = maci.tomlloadstr('data1 = \"data1\"')\n```\ndump python data to file as toml data\n```python\nmaci.tomldump('file.toml', data)\n```\ndump data to string as toml data\n```python\ntoml_data = maci.tomldumpstr(data)\n```\n### ini -\u003e based on [configparser standard library](https://docs.macilib.org/docs/ini)\nload ini data from file\n```python\nconfigparser_data = maci.iniload('file.ini')\n```\ndump configparser data to file as ini data\n```python\nmaci.inidump('file.ini', configparser_data)\n```\nbuild ini data to configparser data automatically - learn more about [configparser objects](https://docs.python.org/3/library/configparser.html)\n```python\nconfigparser_data = maci.inibuildauto({'section1': {'k1': 'value1'}})\n```\nbuild configparser data manually - learn more about [configparser objects](https://docs.python.org/3/library/configparser.html)\n```python\nconfigparser_data = maci.inibuildmanual()\n```\n\n### xml -\u003e based on [xmltodict module \u0026 xml etree from standard library](https://docs.macilib.org/docs/xml)\n#### Dict (easiest)\n\nload xml data from file as dict\n```python\ndict_data = maci.xmlloaddict('file.xml')\n```\nload xml data from string as dict\n```python\ndict_data = maci.xmlloadstrdict('\u003ctag\u003edata\u003c/tag\u003e')\n```\ndump dict data to file as xml data\n```python\nmaci.xmldumpdict('file.xml', dict_data)\n```\ndump dict data to string as xml data\n```python\nxml_data = maci.xmldumpstrdict(dict_data)\n```\n#### ElementTree - learn more about [element tree objects](https://docs.python.org/3/library/xml.etree.elementtree.html)\nload xml data from file as element tree object\n```python\net_data = maci.xmlload('file.xml')\n```\nload xml data from string as element tree object\n```python\net_data = maci.xmlloadstr('\u003ctag\u003edata\u003c/tag\u003e')\n```\ndump element tree data to file as xml data\n```python\nmaci.xmldump('file.xml', et_data)\n```\ndump element tree data to string as xml data\n```python\nxml_data = maci.xmldumpstr(et_data)\n```\nbuild element tree data manually\n```python\net_data = maci.xmlbuildmanual()\n```\n\n[back to top](#maci)\n\n# 🪄 helpful extras\n### exceptions\nAll exceptions/errors thrown by maci and its thin wrapper libraries are conveniently accessible here:\n```python\nmaci.error\n```\nExamples of different load exceptions\n```python\nmaci.error.Load\nmaci.error.JsonLoad\nmaci.error.YamlLoad\nmaci.error.TomlLoad\n```\nTo catch/suppress all maci exceptions, use its base exception\n```python\nmaci.error.MaciError\n```\n### hinting\nFor type hinting/annotation needs, you can conveniently access the respective object types here:\n```python\nmaci.hint\n```\nExamples of different hint objects\n```python\nmaci.hint.MaciDataObj\nmaci.hint.ConfigParser\nmaci.hint.ElementTree\nmaci.hint.Element\n```\n### useful tools\n#### cleanformat\nformat nested data cleanly \n```python\nstr_data = maci.cleanformat([1,{'k1': 1, 'k2': 2},2])\n\nprint(str_data)\n\nOutput --\u003e\n[\n    1,\n    {\n        'k1': 1,\n        'k2': 2,\n    },\n    2,\n]\n```\n#### pickling\npickle your objects using a non-executable file concept with maci\n```python\n# Dump to file\nmaci_data.pickle_data = maci.pickledumpbytes(my_obj)\nmaci.dump('my.data', maci_data)\n\n# Load back from file\nmaci_data = maci.load('my.data')\nmy_obj = maci.pickleloadbytes(maci_data.pickle_data)\n```\nThis is better than having your whole file having the ability to be unpickled, especially if you cannot trust the file's integrity. More on this  from [python pickle docs](https://docs.python.org/3/library/pickle.html). Though this may help improve pickling needs, still use methods to verify integrity of your pickled data if required\n\n#### hashing\nEasily generate hash of a file and store hash - default hash is sha256\n```python\nmaci.createfilehash('my.data', 'my.data.hashed')\n# always returns string of file hash\n```\nNow simply compare the hash of the source file to check integrity when needed\n```python\nmaci.comparefilehash('my.data', 'my.data.hashed')\n# returns bool if hash is a valid match\n```\nCreate hash of data - default hash is sha256\n```python\nmaci.createhash('data')  # returns string of hash\n```\n\n[back to top](#maci)\n\n# ⏳️ performance\n\nPerformance tests each library loading **100,000 lines of data** each in their natural usage\n\nTests are done by loading a file with 100 lines of data 1000 times with the proper file syntax for each library. You may also consider this test about loading 1000 files within the time taken as well\n\nResults vary based on system spec, but you may simulate or prove the same difference in test results for your needs from the \"perf\" dir in this repo. Results below is running the test 3 times consecutively\n\n**libs tested:** json, pyyaml, tomli, xmltodict, maci\n\n---\n\n**Notes**\n\n*XML ElementTree type and INI Configparser tests were left out for now*\n\n*pyyaml loads much faster using its c-based safe loader, but using the native out of the box methods/functions provided as tests for fairness and potential compatibility issues for needing LibYAML bindings*\n\n\n---\n[//]: \u003c\u003e (chose yml for nice color syntax)\n```yml\n# Test 1\n$ python3 perf_load.py \nPerformance tests: \"load\" - loading file 1000 times with 100 lines of data\n\nxml: 0.225348\njson: 0.016725\nyaml: 3.625997\ntoml: 0.23937\nmaci: 0.807448\n\n# Test 2\n$ python3 perf_load.py \nPerformance tests: \"load\" - loading file 1000 times with 100 lines of data\n\nxml: 0.22595\njson: 0.016566\nyaml: 3.652053\ntoml: 0.242974\nmaci: 0.806545\n\n# Test 3\n$ python3 perf_load.py \nPerformance tests: \"load\" - loading file 1000 times with 100 lines of data\n\nxml: 0.225579\njson: 0.01695\nyaml: 3.611955\ntoml: 0.239593\nmaci: 0.802843\n```\n\n| place | lib |\n| ----- | --- |\n| 🥇 1st   | json - avg 0.016s |\n| 🥈 2nd   | xmltodict - avg 0.225s |\n| 🥉 3rd   | tomli - avg 0.240s |\n| 4th   | maci - avg 0.805s |\n| 5th   | pyyaml - avg 3.630s (4th if using CLoader) |\n\n*Current differences in load time results for 100k lines of data from maci compared to popular or modern libraries*\n\nLooking to continually improve maci's performance and update the results, but so far, not bad for pure python.\n\n[back to top](#maci)\n\n# 🚀 testing \u0026 release\n### 300+ tests and counting ⚡️\n\nA maci release is only deployed/released if all qa tests pass, and if the revision number is incremented.\n\nAll coverage testing must be at 100% or test pipeline will fail (badge is not auto-updated, and just indicates confidence in testing at 100%).\n\n[back to top](#maci)\n\n# ⏪ previous project support\nProject maci is derived from an older project called [sfcparse](https://github.com/aaronater10/sfcparse) that is no longer supported, and still provides forward ported support for most of the older API names as a courtesy. sfcparse uses the MIT license, and therefore, maci does not really need to associate itself with that older project, but out of notice for the reason of having the forward ported support is it being mentioned if desiring to migrate.\n\nReason for sfcparse's deprecation was merely for desire of re-branding and scrapping the old to make usage simpler and anew, thus, maci.\n\nThough maci does support the older API names as a courtesy, some names being attempted to use may throw exceptions. Also, functionality in a lot of the forward connected API names may require different parameter positional args or kwargs. See these files for API matched names and where they point to\n\nfunction names: [\\_\\_init\\_\\_.py](https://github.com/aaronater10/maci/blob/main/src/maci/__init__.py) under \\_\\_getattr\\_\\_\n\nexception names: [error.py](https://github.com/aaronater10/maci/blob/main/src/maci/error.py) under \\_\\_getattr\\_\\_\n\n[back to top](#maci)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faaronater10%2Fmaci","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faaronater10%2Fmaci","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faaronater10%2Fmaci/lists"}