py-pane


Namepy-pane JSON
Version 0.8.2 PyPI version JSON
download
home_pageNone
SummaryA modern dataclass & data conversion library, focused on speed and expressiveness.
upload_time2024-05-10 18:06:35
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT License Copyright (c) 2023 Colin Gilgenbach 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 dataclass validation parsing conversion
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pane

`pane` is a modern Python library for dataclasses and data conversion, aiming
for speed and expressiveness.

[![][ci-badge]][ci-url] [![][commit-badge]][commit-url] [![][pypi-badge]][pypi-url] [![][docs-stable-badge]][docs-stable-url] [![][docs-dev-badge]][docs-dev-url]

`pane` draws heavy inspiration from [Pydantic][pydantic] (among others), but its goals
are quite different. For example, `pane` has first-class conversion to and from
all JSON datatypes, not just mappings (and no '__root__' hacks necessary).
In this sense `pane` is a library for general data conversion & validation,
while Pydantic is a dataclass-first library. In addition, `pane` is stricter
than Pydantic in several cases. For instance, `pane` [will not attempt to coerce
`3.14` or `"3"` to an integer](https://github.com/pydantic/pydantic/issues/578).

`pane` is designed to be used to create complex declarative configuration languages
in formats like JSON, TOML, and YAML. This requires full support for complex, nested
types like `t.Union[int, t.Tuple[int, str], list[int]]`. It also requires
useful error messages:

```python
>>> pane.convert('fail', t.Union[int, t.Tuple[int, str], list[int]])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pane/convert.py", line 489, in convert
    return from_data(data, ty)
           ^^^^^^^^^^^^^^^^^^^
  File "pane/convert.py", line 484, in from_data
    return converter.convert(val)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "pane/convert.py", line 128, in convert
    raise ConvertError(node)
pane.convert.ConvertError: Expected one of:
- an int
- tuple of length 2
- sequence
Instead got `fail` of type `str`
```

## Features

`pane` is a work in progress. The following is a roadmap of features:

| Feature                      | State   |
| :--------------------------- | :----   |
| Basic type conversions       | Done    |
| Numeric array types (numpy)  | Done    |
| Sum & product type support   | Done    |
| Tagged unions                | Partial |
| 'Flattened' fields           | Planned |
| Basic dataclasses            | Done    |
| Dataclass helpers            | Partial |
| Generic & inherited dataclasses | Done |
| Parameter aliases & renaming | Done    |
| Arbitrary validation logic   | Done    |
| Schema import/export         | Not planned |

[pydantic]: https://github.com/pydantic/pydantic
[ci-badge]: https://github.com/hexane360/pane/workflows/Tests/badge.svg
[ci-url]: https://github.com/hexane360/pane/actions?query=workflow%3ATests
[docs-dev-badge]: https://img.shields.io/badge/docs-dev-blue
[docs-dev-url]: https://hexane360.github.io/pane/dev/
[docs-stable-badge]: https://img.shields.io/badge/docs-stable-blue
[docs-stable-url]: https://hexane360.github.io/pane/latest/
[commit-badge]: https://img.shields.io/github/last-commit/hexane360/pane
[commit-url]: https://github.com/hexane360/pane/commits
[pypi-badge]: https://badge.fury.io/py/py-pane.svg
[pypi-url]: https://pypi.org/project/py-pane/

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "py-pane",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "dataclass, validation, parsing, conversion",
    "author": null,
    "author_email": "Colin Gilgenbach <hexane@mit.edu>",
    "download_url": "https://files.pythonhosted.org/packages/98/e6/f178bc058bccef5a0190f88148e05f1e5701dc34e719a69e0946406a62c5/py_pane-0.8.2.tar.gz",
    "platform": null,
    "description": "# pane\n\n`pane` is a modern Python library for dataclasses and data conversion, aiming\nfor speed and expressiveness.\n\n[![][ci-badge]][ci-url] [![][commit-badge]][commit-url] [![][pypi-badge]][pypi-url] [![][docs-stable-badge]][docs-stable-url] [![][docs-dev-badge]][docs-dev-url]\n\n`pane` draws heavy inspiration from [Pydantic][pydantic] (among others), but its goals\nare quite different. For example, `pane` has first-class conversion to and from\nall JSON datatypes, not just mappings (and no '__root__' hacks necessary).\nIn this sense `pane` is a library for general data conversion & validation,\nwhile Pydantic is a dataclass-first library. In addition, `pane` is stricter\nthan Pydantic in several cases. For instance, `pane` [will not attempt to coerce\n`3.14` or `\"3\"` to an integer](https://github.com/pydantic/pydantic/issues/578).\n\n`pane` is designed to be used to create complex declarative configuration languages\nin formats like JSON, TOML, and YAML. This requires full support for complex, nested\ntypes like `t.Union[int, t.Tuple[int, str], list[int]]`. It also requires\nuseful error messages:\n\n```python\n>>> pane.convert('fail', t.Union[int, t.Tuple[int, str], list[int]])\nTraceback (most recent call last):\n  File \"<stdin>\", line 1, in <module>\n  File \"pane/convert.py\", line 489, in convert\n    return from_data(data, ty)\n           ^^^^^^^^^^^^^^^^^^^\n  File \"pane/convert.py\", line 484, in from_data\n    return converter.convert(val)\n           ^^^^^^^^^^^^^^^^^^^^^^\n  File \"pane/convert.py\", line 128, in convert\n    raise ConvertError(node)\npane.convert.ConvertError: Expected one of:\n- an int\n- tuple of length 2\n- sequence\nInstead got `fail` of type `str`\n```\n\n## Features\n\n`pane` is a work in progress. The following is a roadmap of features:\n\n| Feature                      | State   |\n| :--------------------------- | :----   |\n| Basic type conversions       | Done    |\n| Numeric array types (numpy)  | Done    |\n| Sum & product type support   | Done    |\n| Tagged unions                | Partial |\n| 'Flattened' fields           | Planned |\n| Basic dataclasses            | Done    |\n| Dataclass helpers            | Partial |\n| Generic & inherited dataclasses | Done |\n| Parameter aliases & renaming | Done    |\n| Arbitrary validation logic   | Done    |\n| Schema import/export         | Not planned |\n\n[pydantic]: https://github.com/pydantic/pydantic\n[ci-badge]: https://github.com/hexane360/pane/workflows/Tests/badge.svg\n[ci-url]: https://github.com/hexane360/pane/actions?query=workflow%3ATests\n[docs-dev-badge]: https://img.shields.io/badge/docs-dev-blue\n[docs-dev-url]: https://hexane360.github.io/pane/dev/\n[docs-stable-badge]: https://img.shields.io/badge/docs-stable-blue\n[docs-stable-url]: https://hexane360.github.io/pane/latest/\n[commit-badge]: https://img.shields.io/github/last-commit/hexane360/pane\n[commit-url]: https://github.com/hexane360/pane/commits\n[pypi-badge]: https://badge.fury.io/py/py-pane.svg\n[pypi-url]: https://pypi.org/project/py-pane/\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 Colin Gilgenbach  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": "A modern dataclass & data conversion library, focused on speed and expressiveness.",
    "version": "0.8.2",
    "project_urls": {
        "Documentation": "https://hexane360.github.io/pane/",
        "Repository": "https://github.com/hexane360/pane.git"
    },
    "split_keywords": [
        "dataclass",
        " validation",
        " parsing",
        " conversion"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "53dbc9a217b587ef981ab371a0fe43b52a9526de0cd232027afd558e490b4290",
                "md5": "32fa853324f7772a70042bc6d073ad5e",
                "sha256": "31e6ecd4daf2e2efb7040781ffd11459cf25978fbb03999bb4bef8fbc07bd4d2"
            },
            "downloads": -1,
            "filename": "py_pane-0.8.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "32fa853324f7772a70042bc6d073ad5e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 36857,
            "upload_time": "2024-05-10T18:06:33",
            "upload_time_iso_8601": "2024-05-10T18:06:33.216828Z",
            "url": "https://files.pythonhosted.org/packages/53/db/c9a217b587ef981ab371a0fe43b52a9526de0cd232027afd558e490b4290/py_pane-0.8.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "98e6f178bc058bccef5a0190f88148e05f1e5701dc34e719a69e0946406a62c5",
                "md5": "45d43ad0101797097fbefc27be94bca6",
                "sha256": "ce8c8c3f215caca224a4e8fdaf874dc83bebca070113d7afc39c4924a5ff87ed"
            },
            "downloads": -1,
            "filename": "py_pane-0.8.2.tar.gz",
            "has_sig": false,
            "md5_digest": "45d43ad0101797097fbefc27be94bca6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 41917,
            "upload_time": "2024-05-10T18:06:35",
            "upload_time_iso_8601": "2024-05-10T18:06:35.518320Z",
            "url": "https://files.pythonhosted.org/packages/98/e6/f178bc058bccef5a0190f88148e05f1e5701dc34e719a69e0946406a62c5/py_pane-0.8.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-10 18:06:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hexane360",
    "github_project": "pane",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "py-pane"
}
        
Elapsed time: 0.25831s