{"id":13653040,"url":"https://github.com/intellimath/pyaxon","last_synced_at":"2025-04-23T06:31:13.021Z","repository":{"id":92172539,"uuid":"12541532","full_name":"intellimath/pyaxon","owner":"intellimath","description":"This is the mirror of pyaxon repository http://bitbucket.org/intellimath/pyaxon","archived":false,"fork":false,"pushed_at":"2016-08-06T15:58:22.000Z","size":17215,"stargazers_count":22,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-01-25T07:32:44.665Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":false,"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/intellimath.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2013-09-02T14:12:06.000Z","updated_at":"2023-02-23T07:27:10.000Z","dependencies_parsed_at":"2024-01-03T05:53:45.391Z","dependency_job_id":null,"html_url":"https://github.com/intellimath/pyaxon","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intellimath%2Fpyaxon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intellimath%2Fpyaxon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intellimath%2Fpyaxon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intellimath%2Fpyaxon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/intellimath","download_url":"https://codeload.github.com/intellimath/pyaxon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250384850,"owners_count":21421804,"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":[],"created_at":"2024-08-02T02:01:05.095Z","updated_at":"2025-04-23T06:31:08.009Z","avatar_url":"https://github.com/intellimath.png","language":"Python","funding_links":[],"categories":["Related formats"],"sub_categories":[],"readme":"======\nPYAXON\n======\n\n``pyaxon`` is an `MIT Licensed \u003chttp://opensource.org/licenses/MIT\u003e`_ python library\nfor `AXON \u003chttp://intellimath.bitbucket.org/axon\u003e`_. \nAXON is eXtended Object Notation. It's a simple text based format for interchanging\nobjects, documents and data.\nIt tries to combine the best of `JSON \u003chttp://www.json.org\u003e`_,\n`XML \u003chttp://www.w3.org/XML/\u003e`_ and `YAML \u003chttp://www.yaml.org\u003e`_.\n\nlinks\n-----\n\n* Main repository for ``pyaxon`` is on `bitbucket \u003chttps://bitbucket.org/intellimath/pyaxon\u003e`_.\n* Mirror on `github \u003chttps://github.com/intellimath/pyaxon\u003e`_\n* `Blog \u003chttp://intellimath.bitbucket.org/blog/categories/axon.html\u003e`_ about AXON.\n* History of `changes \u003chttp://intellimath.bitbucket.org/axon/changelog.html\u003e`_.\n\nInstallation\n------------\n\n``pyaxon`` runs under Python 2.7, 3.3, 3.4 and 3.5\n\nIt can be installed via pip::\n\n\tpip install pyaxon\n\t\nIt can be installed from sources::\n\n\tpython setup.py install\n\nQuick start\n-----------\n\nFirst import `axon` module::\n\n\t\u003e\u003e\u003e import axon\n\nLoad and dump lists, dicts, tuples::\n\n\t\u003e\u003e\u003e from decimal import Decimal\n\t\u003e\u003e\u003e from datetime import datetime, time, date\n\t\u003e\u003e\u003e text = axon.dumps([['abc абв', 1, 3.14, True],\n\t[datetime.now(), Decimal('3.14')]])\n\t\u003e\u003e\u003e print(text)\n\t[\"abc абв\" 1 3.14 true]\n\t[^2015-05-12T13:08:37.078189 3.14D]\n\t\n\t\u003e\u003e\u003e vals = [{'id':1, 'nickname':'nick', 'time':time(12, 31, 34), 'text':'hello!'},\n\t{'id':2, 'nickname':'mark', 'time':time(12, 32, 3), 'text':'hi!'}]\n\t\u003e\u003e\u003e text = axon.dumps(vals)\n\t\u003e\u003e\u003e print(text)\n\t{id:1 nickname:\"nick\" text:\"hello!\" time:^12:31:34}\n\t{id:2 nickname:\"mark\" text:\"hi!\" time:^12:32:03}\t\n\t\u003e\u003e\u003e text = axon.dumps(vals, pretty=1)\n\t\u003e\u003e\u003e print(text)\n\t{ id: 1\n\t  nickname: \"nick\"\n\t  text: \"hello!\"\n\t  time: ^12:31:34}\n\t{ id: 2\n\t  nickname: \"mark\"\n\t  text: \"hi!\"\n\t  time: ^12:32:03}\n\t\u003e\u003e\u003e vals == axon.loads(text)\n\tTrue\n\t  \n\t\u003e\u003e\u003e vals = [[{'a':1, 'b':2, 'c':3}, {'a':[1,2,3], 'b':(1,2,3), 'c':{1,2,3}}]]\n\t\u003e\u003e\u003e text = axon.dumps(vals)\n\t\u003e\u003e\u003e print(text)\n\t[{a:1 b:2 c:3} {a:[1 2 3] b:(1 2 3) c:{1 2 3}}]\n\t\u003e\u003e\u003e text = axon.dumps(vals, pretty=1)\n\t\u003e\u003e\u003e print(text)\n\t[ { a: 1\n\t    b: 2\n\t    c: 3}\n\t  { a: [1 2 3]\n\t    b: (1 2 3)\n\t    c: {1 2 3}}]\n\t\u003e\u003e\u003e vals == axon.loads(text)\n\tTrue\n\nDump, load objects in \"safe\" mode::\n\t\n    \u003e\u003e\u003e vals = axon.loads('person{name:\"nick\" age:32 email:\"nail@example.com\"}')\n    \u003e\u003e\u003e print(type(vals[0]))\n    \u003cclass 'axon._objects.Node'\u003e\n    \u003e\u003e\u003e print(vals[0])\n    node('person', {'email': 'nail@example.com', 'age': 32, 'name': 'nick'})\n\n    \u003e\u003e\u003e text = axon.dumps(vals)\n    \u003e\u003e\u003e print(text)\n    person{age:32 email:\"nail@example.com\" name:\"nick\"}\n    \u003e\u003e\u003e text = axon.dumps(vals, pretty=1)\n    \u003e\u003e\u003e print(text)\n    person\n      age: 32\n      email: \"nail@example.com\"\n      name: \"nick\"\n    \u003e\u003e\u003e text = axon.dumps(vals, pretty=1, braces=1)\n    \u003e\u003e\u003e print(text)\n    person {\n      age: 32\n      email: \"nail@example.com\"\n      name: \"nick\"}\n\nDump, load objects in unsafe mode::\n\n\tclass Person:\n\t    def __init__(self, name, age, email):\n\t        self.name = name\n\t        self.age = age\n\t        self.email = email\n        \n\t    def __str__(self):\n\t        return \"Person(name=%r, age=%r, email=%r)\" % (self.name, self.age, self.email)\n\n\t@axon.reduce(Person)\n\tdef reduce_Person(p):\n\t    return axon.node('person', {'name':p.name, 'age':p.age, 'email': p.email})\n\n\t@axon.factory('person')\n\tdef factory_Person(attrs, vals):\n\t    return Person(name=attrs['name'], age=attrs['age'], email=attrs['email'])\n\t\n\t\u003e\u003e\u003e p = Person('nick', 32, 'mail@example.com')\n\t\u003e\u003e\u003e text = axon.dumps([p])\n\t\u003e\u003e\u003e print(text)\n\tperson{age:32 email:\"mail@example.com\" name:\"nick\"}\n\t\u003e\u003e\u003e val = axon.loads(text, mode='strict')[0]\n\t\u003e\u003e\u003e print(val)\n\tPerson(name='nick', age=32, email='mail@example.com')\n\t\nFeatures\n--------\n\n1. Provide simple API for loading and dumping of objects in textual AXON format.\n2. Provide safe loading and dumping by default.\n3. Provide unsafe loading and dumping of objects on the base of registration of factory/reduce callables.\n4. Provide a way for fully controlled by application/framework/library unsafe loading and dumping.\n5. It's sufficiently fast so as to be useful.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintellimath%2Fpyaxon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fintellimath%2Fpyaxon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintellimath%2Fpyaxon/lists"}