jldc


Namejldc JSON
Version 0.0.5 PyPI version JSON
download
home_page
SummarySimplify using JSONLines files alongside dataclasses.
upload_time2024-02-07 21:38:23
maintainer
docs_urlNone
author
requires_python>=3.10
licenseMIT License Copyright (c) 2023 Luke Twist Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords jldc jsonlines dataclasses
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # **jldc**

Simplify using [JSON Lines](https://jsonlines.org/) files alongside 
[python dataclass](https://docs.python.org/3/library/dataclasses.html) ([PEP-557][pep-557]) objects, 
with convenient one-line reads/writes.

![check code workflow](https://github.com/itsluketwist/jldc/actions/workflows/check.yaml/badge.svg)
![release workflow](https://github.com/itsluketwist/jldc/actions/workflows/release.yaml/badge.svg)


<div>
    <!-- badges from : https://shields.io/ -->
    <!-- logos available : https://simpleicons.org/ -->
    <a href="https://opensource.org/licenses/MIT">
        <img alt="MIT License" src="https://img.shields.io/badge/Licence-MIT-yellow?style=for-the-badge&logo=docs&logoColor=white" />
    </a>
    <a href="https://www.python.org/">
        <img alt="Python 3.10+" src="https://img.shields.io/badge/Python_3.10+-blue?style=for-the-badge&logo=python&logoColor=white" />
    </a>
    <a href="https://jsonlines.org/">
        <img alt="JSON Lines" src="https://img.shields.io/badge/JSON Lines-black?style=for-the-badge&logo=JSON&logoColor=white" />
    </a>
</div>


## *usage*

Import the library and save/load lists of dataclasses or dictionaries with a single line.

```python
from jldc.core import load_jsonl, save_jsonl
from dataclasses import dataclass


@dataclass
class Person:
    name: str
    age: int


save_jsonl("people.jsonl", [Person("Alice", 24), Person("Bob", 32)])

data = load_jsonl("people.jsonl", [Person])

print(data)
```

## *installation*

Install directly from GitHub, using pip:

```shell
pip install 'git+https://github.com/itsluketwist/jldc'
```

Use the `ml` extra to encode/decode the `numpy.ndarray` type:

```shell
pip install 'jldc[ml]@git+https://github.com/itsluketwist/jldc'
```

## *development*

Clone the repository code:

```shell
git clone https://github.com/itsluketwist/jldc.git
```

Once cloned, install the package locally in a virtual environment:

```shell
python -m venv venv

. venv/bin/activate

pip install -e ".[dev,ml]"
```

Install and use pre-commit to ensure code is in a good state:

```shell
pre-commit install

pre-commit autoupdate

pre-commit run --all-files
```

## *testing*

Run the test suite using:

```shell
pytest .
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "jldc",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "",
    "keywords": "jldc,jsonlines,dataclasses",
    "author": "",
    "author_email": "Lukas Twist <itsluketwist@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/d0/88/9275fdcadd7e238170cf3047a75c67f7780eb7ce9a56701356ee15ff8252/jldc-0.0.5.tar.gz",
    "platform": null,
    "description": "# **jldc**\n\nSimplify using [JSON Lines](https://jsonlines.org/) files alongside \n[python dataclass](https://docs.python.org/3/library/dataclasses.html) ([PEP-557][pep-557]) objects, \nwith convenient one-line reads/writes.\n\n![check code workflow](https://github.com/itsluketwist/jldc/actions/workflows/check.yaml/badge.svg)\n![release workflow](https://github.com/itsluketwist/jldc/actions/workflows/release.yaml/badge.svg)\n\n\n<div>\n    <!-- badges from : https://shields.io/ -->\n    <!-- logos available : https://simpleicons.org/ -->\n    <a href=\"https://opensource.org/licenses/MIT\">\n        <img alt=\"MIT License\" src=\"https://img.shields.io/badge/Licence-MIT-yellow?style=for-the-badge&logo=docs&logoColor=white\" />\n    </a>\n    <a href=\"https://www.python.org/\">\n        <img alt=\"Python 3.10+\" src=\"https://img.shields.io/badge/Python_3.10+-blue?style=for-the-badge&logo=python&logoColor=white\" />\n    </a>\n    <a href=\"https://jsonlines.org/\">\n        <img alt=\"JSON Lines\" src=\"https://img.shields.io/badge/JSON Lines-black?style=for-the-badge&logo=JSON&logoColor=white\" />\n    </a>\n</div>\n\n\n## *usage*\n\nImport the library and save/load lists of dataclasses or dictionaries with a single line.\n\n```python\nfrom jldc.core import load_jsonl, save_jsonl\nfrom dataclasses import dataclass\n\n\n@dataclass\nclass Person:\n    name: str\n    age: int\n\n\nsave_jsonl(\"people.jsonl\", [Person(\"Alice\", 24), Person(\"Bob\", 32)])\n\ndata = load_jsonl(\"people.jsonl\", [Person])\n\nprint(data)\n```\n\n## *installation*\n\nInstall directly from GitHub, using pip:\n\n```shell\npip install 'git+https://github.com/itsluketwist/jldc'\n```\n\nUse the `ml` extra to encode/decode the `numpy.ndarray` type:\n\n```shell\npip install 'jldc[ml]@git+https://github.com/itsluketwist/jldc'\n```\n\n## *development*\n\nClone the repository code:\n\n```shell\ngit clone https://github.com/itsluketwist/jldc.git\n```\n\nOnce cloned, install the package locally in a virtual environment:\n\n```shell\npython -m venv venv\n\n. venv/bin/activate\n\npip install -e \".[dev,ml]\"\n```\n\nInstall and use pre-commit to ensure code is in a good state:\n\n```shell\npre-commit install\n\npre-commit autoupdate\n\npre-commit run --all-files\n```\n\n## *testing*\n\nRun the test suite using:\n\n```shell\npytest .\n```\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 Luke Twist  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Simplify using JSONLines files alongside dataclasses.",
    "version": "0.0.5",
    "project_urls": {
        "Homepage": "https://github.com/itsluketwist/jldc"
    },
    "split_keywords": [
        "jldc",
        "jsonlines",
        "dataclasses"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "440848003ddaf921b557f17e55559ddbb66b8aeefc11959f008f56326998bbd2",
                "md5": "44b578a5de1c0b794daa71f429bebc07",
                "sha256": "fba03ee73f74983ca4a2d85abd53003198a912fb0a8a43041c89afe5b43c1525"
            },
            "downloads": -1,
            "filename": "jldc-0.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "44b578a5de1c0b794daa71f429bebc07",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 6284,
            "upload_time": "2024-02-07T21:38:21",
            "upload_time_iso_8601": "2024-02-07T21:38:21.700215Z",
            "url": "https://files.pythonhosted.org/packages/44/08/48003ddaf921b557f17e55559ddbb66b8aeefc11959f008f56326998bbd2/jldc-0.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d0889275fdcadd7e238170cf3047a75c67f7780eb7ce9a56701356ee15ff8252",
                "md5": "518996035152e796452b230a4e2d4fbc",
                "sha256": "de9990a4fb34f8bfd8cb245cbdc1a9353ba155bde46496b7d7c8cfd0e2f43082"
            },
            "downloads": -1,
            "filename": "jldc-0.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "518996035152e796452b230a4e2d4fbc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 5822,
            "upload_time": "2024-02-07T21:38:23",
            "upload_time_iso_8601": "2024-02-07T21:38:23.335262Z",
            "url": "https://files.pythonhosted.org/packages/d0/88/9275fdcadd7e238170cf3047a75c67f7780eb7ce9a56701356ee15ff8252/jldc-0.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-07 21:38:23",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "itsluketwist",
    "github_project": "jldc",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "jldc"
}
        
Elapsed time: 3.14289s