# pyon
PYON Reader - Python Object Nation
## Table of Contents
- [Installation](#installation)
- [How to use](#how-to-use)
- [Creating PYON File](#lets-create-our-bpyonb-file)
- [Reading File](#reading-file)
- [Writing File](#writing-file)
<!-- - [Built-in functions](#built-in-functions)
- [PYON Built-in Funtions](#pyon-built-in-functions)
- [fetch](#fetch)
- [Python Built-in Funtions](#python-built-in-functions)
- [Examples](#examples) -->
## Installation
```bash
pip install pyonr
```
## How to use
### Creating PYON file
let's create our <b>PYON</b> file,
i'm going to call it <b>friends.pyon</b>
<br>
```
{
"me": {
"name": "Nawaf",
"age": 15
}
}
```
### Reading File
```py
import pyonr
file = pyonr.read('friends.pyon') # Replace "friends.pyon" with your file name
fileData = file.read # {'me': {'name': 'Nawaf', 'age': 15}}
type(fileData) # <class 'dict'>
```
### Writing File
```py
import pyonr
file = pyonr.read('friends.pyon')
fileData = file.read
fileData['khayal'] = {
"name": "Khayal",
"age": 14
}
# This will update "fileData" only, we need to save it
file.write(fileData)
```
<p>File will get updated too</p>
```
{
'me': {
'name': 'Nawaf',
'age': 15
},
'khayal': {
'name': 'Khayal',
'age': 14
}
}
```
<!-- ## Built-in Functions
### PYON Built-in Functions
### `fetch`:
fetch is used to fetch any file/url content to the file
```python
{
'data_from_file_pyon': fetch(r'D:\very_secret_data.pyon')
}
```
`fetch` can fetch data from pyon or json files
```py
{
'data_from_file_json': fetch(r'D:\very_secret_data.json')
}
```
exact same result as above
fetching data from url
```py
fetch('https://example.com/api')
```
note: `fetch` won't change file content, it will only be changed inside a program
### Python Built-in Functions
every `Python` built-in function is supported in `PYON`
#### Examples
```py
{
"sum_example": sum([i for i in range(10)])
}
```
```py
{
"sum_with_map_example": sum(
map(lambda e:e ** 2, [i for i in range(10)])
)
}
``` -->
Raw data
{
"_id": null,
"home_page": "https://github.com/nawafalqari/pyon/",
"name": "pyonr",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "pyon,pyonr,json,pythonobjectnation,python object nation",
"author": "Nawaf Alqari",
"author_email": "nawafalqari13@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/19/1b/bf2f1fdd5a9731ff18ec7edf94932ee552773e618720c64aa91243e52deb/pyonr-2.1.7.tar.gz",
"platform": null,
"description": "# pyon\r\nPYON Reader - Python Object Nation\r\n\r\n## Table of Contents\r\n- [Installation](#installation)\r\n- [How to use](#how-to-use)\r\n - [Creating PYON File](#lets-create-our-bpyonb-file)\r\n - [Reading File](#reading-file)\r\n - [Writing File](#writing-file)\r\n<!-- - [Built-in functions](#built-in-functions)\r\n - [PYON Built-in Funtions](#pyon-built-in-functions)\r\n - [fetch](#fetch)\r\n - [Python Built-in Funtions](#python-built-in-functions)\r\n - [Examples](#examples) -->\r\n\r\n## Installation\r\n```bash\r\npip install pyonr\r\n```\r\n\r\n## How to use\r\n### Creating PYON file\r\nlet's create our <b>PYON</b> file,\r\ni'm going to call it <b>friends.pyon</b>\r\n<br>\r\n\r\n```\r\n{\r\n \"me\": {\r\n \"name\": \"Nawaf\",\r\n \"age\": 15\r\n }\r\n}\r\n```\r\n\r\n### Reading File\r\n```py\r\nimport pyonr\r\n\r\nfile = pyonr.read('friends.pyon') # Replace \"friends.pyon\" with your file name\r\n\r\nfileData = file.read # {'me': {'name': 'Nawaf', 'age': 15}}\r\ntype(fileData) # <class 'dict'>\r\n```\r\n\r\n### Writing File\r\n```py\r\nimport pyonr\r\n\r\nfile = pyonr.read('friends.pyon')\r\nfileData = file.read\r\n\r\nfileData['khayal'] = {\r\n \"name\": \"Khayal\",\r\n \"age\": 14\r\n}\r\n# This will update \"fileData\" only, we need to save it\r\n\r\nfile.write(fileData)\r\n```\r\n\r\n<p>File will get updated too</p>\r\n\r\n```\r\n{\r\n 'me': {\r\n 'name': 'Nawaf',\r\n 'age': 15\r\n },\r\n\r\n 'khayal': {\r\n 'name': 'Khayal',\r\n 'age': 14\r\n }\r\n}\r\n```\r\n\r\n<!-- ## Built-in Functions\r\n### PYON Built-in Functions\r\n### `fetch`:\r\nfetch is used to fetch any file/url content to the file\r\n```python\r\n{\r\n 'data_from_file_pyon': fetch(r'D:\\very_secret_data.pyon')\r\n}\r\n```\r\n`fetch` can fetch data from pyon or json files\r\n```py\r\n{\r\n 'data_from_file_json': fetch(r'D:\\very_secret_data.json')\r\n}\r\n```\r\nexact same result as above\r\n\r\nfetching data from url\r\n```py\r\nfetch('https://example.com/api')\r\n```\r\nnote: `fetch` won't change file content, it will only be changed inside a program\r\n\r\n\r\n### Python Built-in Functions\r\nevery `Python` built-in function is supported in `PYON`\r\n#### Examples\r\n```py\r\n{\r\n \"sum_example\": sum([i for i in range(10)])\r\n}\r\n```\r\n```py\r\n{\r\n \"sum_with_map_example\": sum(\r\n map(lambda e:e ** 2, [i for i in range(10)])\r\n )\r\n}\r\n``` -->\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "PYON Reader - Python Object Notation",
"version": "2.1.7",
"split_keywords": [
"pyon",
"pyonr",
"json",
"pythonobjectnation",
"python object nation"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "24e0ea6cdce67a624c9084c1f5f26b3f",
"sha256": "b77d94625ddec9a2a93a73cc36b46ffd3f4159c95efd6c44baa43b54ba740ea4"
},
"downloads": -1,
"filename": "pyonr-2.1.7.tar.gz",
"has_sig": false,
"md5_digest": "24e0ea6cdce67a624c9084c1f5f26b3f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 6033,
"upload_time": "2022-12-21T12:23:28",
"upload_time_iso_8601": "2022-12-21T12:23:28.495732Z",
"url": "https://files.pythonhosted.org/packages/19/1b/bf2f1fdd5a9731ff18ec7edf94932ee552773e618720c64aa91243e52deb/pyonr-2.1.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-21 12:23:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "nawafalqari",
"github_project": "pyon",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pyonr"
}