Skip to main content

A modern dataclass & data conversion library, focused on speed and expressiveness.

Project description

pane

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

pane draws heavy inspiration from 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.

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:

>>> 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_pane-0.9.1.tar.gz (44.5 kB view details)

Uploaded Source

Built Distribution

py_pane-0.9.1-py3-none-any.whl (38.7 kB view details)

Uploaded Python 3

File details

Details for the file py_pane-0.9.1.tar.gz.

File metadata

  • Download URL: py_pane-0.9.1.tar.gz
  • Upload date:
  • Size: 44.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for py_pane-0.9.1.tar.gz
Algorithm Hash digest
SHA256 3334da63988bcce8bd463d054531368893bfab9203f7036ef15564e96ee7149a
MD5 f4f9442d17ee0240952c0c5f8a133c3e
BLAKE2b-256 7b8b0428882c063ac1590102ea6e938ded8b79c8377eb363d29e2d25cfbe54d1

See more details on using hashes here.

File details

Details for the file py_pane-0.9.1-py3-none-any.whl.

File metadata

  • Download URL: py_pane-0.9.1-py3-none-any.whl
  • Upload date:
  • Size: 38.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for py_pane-0.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 08d8f7e9eb7f018bfa4f88e4cf801906254a3196b3f3bb4065fde6c9f4f5a5aa
MD5 21da97cf71b604056b42f4accf908c05
BLAKE2b-256 4fb315f3234a23b6162e3741a76b8c4d52e94f7fe55fa0ea6ed617042b93235c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page