shared


Nameshared JSON
Version 0.0.31 PyPI version JSON
download
home_pagehttps://github.com/pyrustic/shared
SummaryData exchange and persistence based on human-readable files
upload_time2024-11-30 17:35:51
maintainerPyrustic Architect
docs_urlNone
authorPyrustic Architect
requires_python>=3.5
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![PyPI package version](https://img.shields.io/pypi/v/shared)](https://pypi.org/project/shared)


⚠️⚠️   

**Shared** is an experimental data exchange and persistence solution based on human-readable files. It serves as a playground to test new ideas and then create stable derivative projects. I recently built a **multi-model embedded database for persisting arbitrary-sized data.** The project is called **[Jinbase](https://github.com/pyrustic/jinbase/)** and I strongly encourage you to give it a [try](https://github.com/pyrustic/jinbase/).

⚠️⚠️   


<!-- Cover -->
<div align="center">
    <img src="https://raw.githubusercontent.com/pyrustic/misc/master/assets/shared/cover.png" alt="Cover" width="630">
    <p align="center">
    <i> </i>
    </p>
</div>



# Pyrustic Shared
**Experimental data exchange and persistence based on human-readable files**

## Table of contents
- [Overview](#overview) 
- [Example](#example) 
- [Related projects](#related-projects)
- [Testing and contributing](#testing-and-contributing)
- [Installation](#installation) 

# Overview
**Shared** is a Python package created to be the programmer's companion when it comes to storing unstructured application data, managing configuration files, caching data, and exchanging data with other programs.

Under the hood, Shared uses [Paradict](https://github.com/pyrustic/paradict) to encode a dictionary populated with **strings**, **scalars** (integer, float, decimal float, complex, booleans), **date** and **time**, **null** value, **binary** data and nested **collections** (list, set, and dictionary).

> **Note:** This library doesn't perform any synchronization and thus simultaneous access to a file might lead to data corruption. **For a safe, more robust persistence solution, please consider [Jinbase](https://github.com/pyrustic/jinbase).**

# Example
```python
from shared import Dossier, HOME
from datetime import datetime
from pathlib import Path

# load a picture
with open("/home/alex/image.png", "rb") as file:
    photo = file.read()

# create a user profile dictionary embedding the picture
now = datetime.now()
profile = {"name": "alex", "access_datetime": now, "photo": photo,
           "pi": 3.14, "books": ["Seul sur Mars", "The Fall"],
           "is_author": True, "fingerprint": None}

# create a dossier (or access an existing one)
path = Path(HOME, "my_dossier")
dossier = Dossier(path)

# save profile dictionary in the dossier
dossier.set("my_profile", profile)

# retrieve profile dictionary
profile_bis = dossier.get("my_profile")

# let's compare the two profile objects !
assert profile == profile_bis  # True ;)
```


# Related projects
- [Jinbase](https://github.com/pyrustic/jinbase): Multi-model transactional embedded database
- [LiteDBC](https://github.com/pyrustic/litedbc): Lite database connector
- [KvF](https://github.com/pyrustic/kvf): The key-value file format with sections 
- [Paradict](https://github.com/pyrustic/paradict): Streamable multi-format serialization with schema 
- [Asyncpal](https://github.com/pyrustic/asyncpal): Preemptive concurrency and parallelism for sporadic workloads

# Testing and contributing
Feel free to **open an issue** to report a bug, suggest some changes, show some useful code snippets, or discuss anything related to this project. You can also directly email [me](https://pyrustic.github.io/#contact).

## Setup your development environment
Following are instructions to setup your development environment

```bash
# create and activate a virtual environment
python -m venv venv
source venv/bin/activate

# clone the project then change into its directory
git clone https://github.com/pyrustic/shared.git
cd shared

# install the package locally (editable mode)
pip install -e .

# run tests
python -m tests

# deactivate the virtual environment
deactivate
```

<p align="right"><a href="#readme">Back to top</a></p>

# Installation
**Shared** is **cross-platform**. It is built on [Ubuntu](https://ubuntu.com/download/desktop) and should work on **Python 3.5** or **newer**.

## Create and activate a virtual environment
```bash
python -m venv venv
source venv/bin/activate
```

## Install for the first time

```bash
pip install shared
```

## Upgrade the package
```bash
pip install shared --upgrade --upgrade-strategy eager
```

## Deactivate the virtual environment
```bash
deactivate
```

<p align="right"><a href="#readme">Back to top</a></p>

# About the author
Hello world, I'm Alex (😎️), a tech enthusiast and the architect of [Pyrustic](https://pyrustic.github.io) ! Feel free to get in touch with [me](https://pyrustic.github.io/#contact) !

<br>
<br>
<br>

[Back to top](#readme)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pyrustic/shared",
    "name": "shared",
    "maintainer": "Pyrustic Architect",
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": "rusticalex@yahoo.com",
    "keywords": null,
    "author": "Pyrustic Architect",
    "author_email": "rusticalex@yahoo.com",
    "download_url": "https://files.pythonhosted.org/packages/f7/7b/b9438749366ff706e273078d14fe2ee9f77f2f64911364c2a538fc6bf81b/shared-0.0.31.tar.gz",
    "platform": null,
    "description": "[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![PyPI package version](https://img.shields.io/pypi/v/shared)](https://pypi.org/project/shared)\n\n\n\u26a0\ufe0f\u26a0\ufe0f   \n\n**Shared** is an experimental data exchange and persistence solution based on human-readable files. It serves as a playground to test new ideas and then create stable derivative projects. I recently built a **multi-model embedded database for persisting arbitrary-sized data.** The project is called **[Jinbase](https://github.com/pyrustic/jinbase/)** and I strongly encourage you to give it a [try](https://github.com/pyrustic/jinbase/).\n\n\u26a0\ufe0f\u26a0\ufe0f   \n\n\n<!-- Cover -->\n<div align=\"center\">\n    <img src=\"https://raw.githubusercontent.com/pyrustic/misc/master/assets/shared/cover.png\" alt=\"Cover\" width=\"630\">\n    <p align=\"center\">\n    <i> </i>\n    </p>\n</div>\n\n\n\n# Pyrustic Shared\n**Experimental data exchange and persistence based on human-readable files**\n\n## Table of contents\n- [Overview](#overview) \n- [Example](#example) \n- [Related projects](#related-projects)\n- [Testing and contributing](#testing-and-contributing)\n- [Installation](#installation) \n\n# Overview\n**Shared** is a Python package created to be the programmer's companion when it comes to storing unstructured application data, managing configuration files, caching data, and exchanging data with other programs.\n\nUnder the hood, Shared uses [Paradict](https://github.com/pyrustic/paradict) to encode a dictionary populated with **strings**, **scalars** (integer, float, decimal float, complex, booleans), **date** and **time**, **null** value, **binary** data and nested **collections** (list, set, and dictionary).\n\n> **Note:** This library doesn't perform any synchronization and thus simultaneous access to a file might lead to data corruption. **For a safe, more robust persistence solution, please consider [Jinbase](https://github.com/pyrustic/jinbase).**\n\n# Example\n```python\nfrom shared import Dossier, HOME\nfrom datetime import datetime\nfrom pathlib import Path\n\n# load a picture\nwith open(\"/home/alex/image.png\", \"rb\") as file:\n    photo = file.read()\n\n# create a user profile dictionary embedding the picture\nnow = datetime.now()\nprofile = {\"name\": \"alex\", \"access_datetime\": now, \"photo\": photo,\n           \"pi\": 3.14, \"books\": [\"Seul sur Mars\", \"The Fall\"],\n           \"is_author\": True, \"fingerprint\": None}\n\n# create a dossier (or access an existing one)\npath = Path(HOME, \"my_dossier\")\ndossier = Dossier(path)\n\n# save profile dictionary in the dossier\ndossier.set(\"my_profile\", profile)\n\n# retrieve profile dictionary\nprofile_bis = dossier.get(\"my_profile\")\n\n# let's compare the two profile objects !\nassert profile == profile_bis  # True ;)\n```\n\n\n# Related projects\n- [Jinbase](https://github.com/pyrustic/jinbase): Multi-model transactional embedded database\n- [LiteDBC](https://github.com/pyrustic/litedbc): Lite database connector\n- [KvF](https://github.com/pyrustic/kvf): The key-value file format with sections \n- [Paradict](https://github.com/pyrustic/paradict): Streamable multi-format serialization with schema \n- [Asyncpal](https://github.com/pyrustic/asyncpal): Preemptive concurrency and parallelism for sporadic workloads\n\n# Testing and contributing\nFeel free to **open an issue** to report a bug, suggest some changes, show some useful code snippets, or discuss anything related to this project. You can also directly email [me](https://pyrustic.github.io/#contact).\n\n## Setup your development environment\nFollowing are instructions to setup your development environment\n\n```bash\n# create and activate a virtual environment\npython -m venv venv\nsource venv/bin/activate\n\n# clone the project then change into its directory\ngit clone https://github.com/pyrustic/shared.git\ncd shared\n\n# install the package locally (editable mode)\npip install -e .\n\n# run tests\npython -m tests\n\n# deactivate the virtual environment\ndeactivate\n```\n\n<p align=\"right\"><a href=\"#readme\">Back to top</a></p>\n\n# Installation\n**Shared** is **cross-platform**. It is built on [Ubuntu](https://ubuntu.com/download/desktop) and should work on **Python 3.5** or **newer**.\n\n## Create and activate a virtual environment\n```bash\npython -m venv venv\nsource venv/bin/activate\n```\n\n## Install for the first time\n\n```bash\npip install shared\n```\n\n## Upgrade the package\n```bash\npip install shared --upgrade --upgrade-strategy eager\n```\n\n## Deactivate the virtual environment\n```bash\ndeactivate\n```\n\n<p align=\"right\"><a href=\"#readme\">Back to top</a></p>\n\n# About the author\nHello world, I'm Alex (\ud83d\ude0e\ufe0f), a tech enthusiast and the architect of [Pyrustic](https://pyrustic.github.io) ! Feel free to get in touch with [me](https://pyrustic.github.io/#contact) !\n\n<br>\n<br>\n<br>\n\n[Back to top](#readme)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Data exchange and persistence based on human-readable files",
    "version": "0.0.31",
    "project_urls": {
        "Homepage": "https://github.com/pyrustic/shared"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3329da61f9fa5a82810f51a9fac2e5ba108a37bd545631570cae58fc8cafbc07",
                "md5": "fd092364fca3a78bf5c9c6a70fbb0d59",
                "sha256": "fc59e51b5f1da1881faf158e900fac4958baf111e9ecf4449423cd027924c505"
            },
            "downloads": -1,
            "filename": "shared-0.0.31-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fd092364fca3a78bf5c9c6a70fbb0d59",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.5",
            "size": 28814,
            "upload_time": "2024-11-30T17:35:41",
            "upload_time_iso_8601": "2024-11-30T17:35:41.064311Z",
            "url": "https://files.pythonhosted.org/packages/33/29/da61f9fa5a82810f51a9fac2e5ba108a37bd545631570cae58fc8cafbc07/shared-0.0.31-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f77bb9438749366ff706e273078d14fe2ee9f77f2f64911364c2a538fc6bf81b",
                "md5": "2f7b7a967a0be93e2bde2f709201d2aa",
                "sha256": "ab59785860d292919af7d6a71eb67792619f8568869ce8b4614a2acfb7f777d6"
            },
            "downloads": -1,
            "filename": "shared-0.0.31.tar.gz",
            "has_sig": false,
            "md5_digest": "2f7b7a967a0be93e2bde2f709201d2aa",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5",
            "size": 7341,
            "upload_time": "2024-11-30T17:35:51",
            "upload_time_iso_8601": "2024-11-30T17:35:51.102674Z",
            "url": "https://files.pythonhosted.org/packages/f7/7b/b9438749366ff706e273078d14fe2ee9f77f2f64911364c2a538fc6bf81b/shared-0.0.31.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-30 17:35:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pyrustic",
    "github_project": "shared",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "shared"
}
        
Elapsed time: 4.67099s