Skip to content

# The top-level preserves package

    import preserves

The main package re-exports a subset of the exports of its constituent modules:

- From preserves.values:

  - Annotated
  - Embedded
  - Float
  - ImmutableDict
  - Record
  - Symbol
  - annotate
  - is_annotated
  - preserve
  - strip_annotations

- From preserves.error:

  - DecodeError
  - EncodeError
  - ShortPacket

- From preserves.binary:

  - Decoder
  - Encoder
  - canonicalize
  - decode
  - decode_with_annotations
  - encode

- From preserves.text:

  - Formatter
  - Parser
  - parse
  - parse_with_annotations
  - stringify

- From preserves.compare:

  - cmp

- From preserves.merge:

  - merge

It also exports the compare and fold modules themselves, permitting patterns like

    >>> from preserves import *
    >>> compare.cmp(123, 234)
    -1

Finally, it provides a few utility aliases for common tasks:

## `dumps = stringify` `module-attribute`

This alias for `stringify` provides a familiar pythonesque name for converting a Preserves `Value` to a string.

## `loads = parse` `module-attribute`

This alias for `parse` provides a familiar pythonesque name for converting a string to a Preserves `Value`.

Last update: March 16, 2023
Created: March 16, 2023