Metadata-Version: 2.4
Name: xpon
Version: 0.0.1
Summary: Very convenient Python library for converting Python objects to and from a string representation
Home-page: https://tvoygit.ru/vi_is_lonely/pon
Author: Ivan Chetchasov
Author-email: vi.is.chapmann@gmail.com
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# 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)
