py-pane


Namepy-pane JSON
Version 0.9.1 PyPI version JSON
download
home_pageNone
SummaryA modern dataclass & data conversion library, focused on speed and expressiveness.
upload_time2024-10-28 20:32:54
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/7b/8b/0428882c063ac1590102ea6e938ded8b79c8377eb363d29e2d25cfbe54d1/py_pane-0.9.1.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.9.1",
    "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": "4fb315f3234a23b6162e3741a76b8c4d52e94f7fe55fa0ea6ed617042b93235c",
                "md5": "21da97cf71b604056b42f4accf908c05",
                "sha256": "08d8f7e9eb7f018bfa4f88e4cf801906254a3196b3f3bb4065fde6c9f4f5a5aa"
            },
            "downloads": -1,
            "filename": "py_pane-0.9.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "21da97cf71b604056b42f4accf908c05",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 38712,
            "upload_time": "2024-10-28T20:32:53",
            "upload_time_iso_8601": "2024-10-28T20:32:53.536662Z",
            "url": "https://files.pythonhosted.org/packages/4f/b3/15f3234a23b6162e3741a76b8c4d52e94f7fe55fa0ea6ed617042b93235c/py_pane-0.9.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7b8b0428882c063ac1590102ea6e938ded8b79c8377eb363d29e2d25cfbe54d1",
                "md5": "f4f9442d17ee0240952c0c5f8a133c3e",
                "sha256": "3334da63988bcce8bd463d054531368893bfab9203f7036ef15564e96ee7149a"
            },
            "downloads": -1,
            "filename": "py_pane-0.9.1.tar.gz",
            "has_sig": false,
            "md5_digest": "f4f9442d17ee0240952c0c5f8a133c3e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 44527,
            "upload_time": "2024-10-28T20:32:54",
            "upload_time_iso_8601": "2024-10-28T20:32:54.947419Z",
            "url": "https://files.pythonhosted.org/packages/7b/8b/0428882c063ac1590102ea6e938ded8b79c8377eb363d29e2d25cfbe54d1/py_pane-0.9.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-28 20:32:54",
    "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.38905s