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.11.4.tar.gz (47.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_pane-0.11.4-py3-none-any.whl (41.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: py_pane-0.11.4.tar.gz
  • Upload date:
  • Size: 47.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for py_pane-0.11.4.tar.gz
Algorithm Hash digest
SHA256 477b7d551e16c0e055e44beea89e20eae8734c248b5a771f89c80845cfef4e82
MD5 56780e3b41ab4172a6d87ab54b976caf
BLAKE2b-256 a8bc4cb6713741bbd41e161d8673516dd180601aa954f04a2c744a4ba7df5d82

See more details on using hashes here.

File details

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

File metadata

  • Download URL: py_pane-0.11.4-py3-none-any.whl
  • Upload date:
  • Size: 41.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for py_pane-0.11.4-py3-none-any.whl
Algorithm Hash digest
SHA256 375a4a6fcb3a453f25b542f8090386199724f1cfaa9f514929cdb48757a265e3
MD5 df1a6353ce2ba475343a85e56221ae02
BLAKE2b-256 a15696c5529d88e925e91c67c5b666b637fd4f48ddba7eef5634255faab5c0e4

See more details on using hashes here.

Supported by

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