Name | xpon JSON |
Version |
0.0.1
JSON |
| download |
home_page | https://tvoygit.ru/vi_is_lonely/pon |
Summary | Very convenient Python library for converting Python objects to and from a string representation |
upload_time | 2025-07-21 18:41:20 |
maintainer | None |
docs_url | None |
author | Ivan Chetchasov |
requires_python | >=3.9 |
license | None |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# PON - Python Object Notation
This module provides a simple way to convert Python objects to and from
a string representation. The string representation is a JSON-like
representation of the object.
The module has four main methods:
+ `pon.to_str`
+ `pon.from_str`
+ `pon.to_file`
+ `pon.from_file`
The `pon.to_str` and `pon.from_str` methods are
the most commonly used methods. The `pon.to_file` and
`pon.from_file` methods are useful for serializing
objects to and from files.
The `pon.to_str` and `pon.to_file` methods
accept a keyword argument `indent` that controls the
indentation of the resulting string. The default value is
`4`.
## Example
```python
from pon import *
obj = dict(a=1, b=2, c=dict(d=3, e=4))
print(to_str(obj))
print(from_str(to_str(obj)))
to_file(obj, 'test.pon')
obj = from_file('test.pon')
print(obj)
print(to_str(obj, indent=2))
print(from_str(to_str(obj, indent=2)))
to_file(obj, 'test.pon', indent=2)
obj = from_file('test.pon')
print(obj)
```
Output:
```
{'a': 1, 'b': 2, 'c': {'d': 3, 'e': 4}}
{'a': 1, 'b': 2, 'c': {'d': 3, 'e': 4}}
{'a': 1, 'b': 2, 'c': {'d': 3, 'e': 4}}
{'a': 1, 'b': 2, 'c': {'d': 3, 'e': 4}}
{'a': 1, 'b': 2, 'c': {'d': 3, 'e': 4}}
{'a': 1, 'b': 2, 'c': {'d': 3, 'e': 4}}
```
## Installation
Install the module using `pip`:
pip install pon
Or clone the repository and install the module manually:
git clone https://tvoygit.ru/vi_is_lonely/pon
cd pon
python setup.py install
## License
This module is licensed under the GNU Affero General Public License v3.0.
See [LICENSE](LICENSE) for more information.
## Author
Vi Raven <vi.is.chapmann@gmail.com> (Ivan Chetchasov)<br/>
Telegram: [@vi_is_raven](https://t.me/vi_is_raven)
Raw data
{
"_id": null,
"home_page": "https://tvoygit.ru/vi_is_lonely/pon",
"name": "xpon",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Ivan Chetchasov",
"author_email": "vi.is.chapmann@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/7e/f8/4d30e1e62db8f9ece630c20c42e6e17df51f7ec0aef4f2721606bb1ca163/xpon-0.0.1.tar.gz",
"platform": null,
"description": "# PON - Python Object Notation\n\nThis module provides a simple way to convert Python objects to and from\na string representation. The string representation is a JSON-like\nrepresentation of the object.\n\nThe module has four main methods:\n\n+ `pon.to_str`\n+ `pon.from_str`\n+ `pon.to_file`\n+ `pon.from_file`\n\nThe `pon.to_str` and `pon.from_str` methods are\nthe most commonly used methods. The `pon.to_file` and\n`pon.from_file` methods are useful for serializing\nobjects to and from files.\n\nThe `pon.to_str` and `pon.to_file` methods\naccept a keyword argument `indent` that controls the\nindentation of the resulting string. The default value is\n`4`.\n\n## Example\n\n```python\nfrom pon import *\n\nobj = dict(a=1, b=2, c=dict(d=3, e=4))\n\nprint(to_str(obj))\nprint(from_str(to_str(obj)))\n\nto_file(obj, 'test.pon')\nobj = from_file('test.pon')\nprint(obj)\n\nprint(to_str(obj, indent=2))\nprint(from_str(to_str(obj, indent=2)))\n\nto_file(obj, 'test.pon', indent=2)\nobj = from_file('test.pon')\nprint(obj)\n```\n\nOutput:\n\n```\n{'a': 1, 'b': 2, 'c': {'d': 3, 'e': 4}}\n{'a': 1, 'b': 2, 'c': {'d': 3, 'e': 4}}\n{'a': 1, 'b': 2, 'c': {'d': 3, 'e': 4}}\n{'a': 1, 'b': 2, 'c': {'d': 3, 'e': 4}}\n{'a': 1, 'b': 2, 'c': {'d': 3, 'e': 4}}\n{'a': 1, 'b': 2, 'c': {'d': 3, 'e': 4}}\n```\n\n## Installation\n\nInstall the module using `pip`:\n\n pip install pon\n\nOr clone the repository and install the module manually:\n\n git clone https://tvoygit.ru/vi_is_lonely/pon\n cd pon\n python setup.py install\n\n## License\n\nThis module is licensed under the GNU Affero General Public License v3.0.\nSee [LICENSE](LICENSE) for more information.\n\n## Author\n\nVi Raven <vi.is.chapmann@gmail.com> (Ivan Chetchasov)<br/>\nTelegram: [@vi_is_raven](https://t.me/vi_is_raven)\n",
"bugtrack_url": null,
"license": null,
"summary": "Very convenient Python library for converting Python objects to and from a string representation",
"version": "0.0.1",
"project_urls": {
"Homepage": "https://tvoygit.ru/vi_is_lonely/pon"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "6cf6117ed05ecf8886ced0ff205b7c4662a1a41d2720e01e1c6144d6f4662837",
"md5": "f2f221737dc88bebac3de94b65c4de45",
"sha256": "7c2a291a3356cfcb2cfe433463c362e8379245f13dfbf171e4b966fe53efa74c"
},
"downloads": -1,
"filename": "xpon-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f2f221737dc88bebac3de94b65c4de45",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 13193,
"upload_time": "2025-07-21T18:41:18",
"upload_time_iso_8601": "2025-07-21T18:41:18.752466Z",
"url": "https://files.pythonhosted.org/packages/6c/f6/117ed05ecf8886ced0ff205b7c4662a1a41d2720e01e1c6144d6f4662837/xpon-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "7ef84d30e1e62db8f9ece630c20c42e6e17df51f7ec0aef4f2721606bb1ca163",
"md5": "259f87a994de717c1c2fbf39f01dc718",
"sha256": "9b800a575d84eb483aebe9ac5da84505b8dfde7cdbb824a3d84907e25e9a3742"
},
"downloads": -1,
"filename": "xpon-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "259f87a994de717c1c2fbf39f01dc718",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 13255,
"upload_time": "2025-07-21T18:41:20",
"upload_time_iso_8601": "2025-07-21T18:41:20.798739Z",
"url": "https://files.pythonhosted.org/packages/7e/f8/4d30e1e62db8f9ece630c20c42e6e17df51f7ec0aef4f2721606bb1ca163/xpon-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-21 18:41:20",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "xpon"
}