Skip to main content

Streamed YAML

Parse streamed (incomplete) single-level YAML

pip install streamed-yaml

Partial Parsing

Parse a partial, single-level YAML document. Returns values, done, where done[key] indicated whether values[key] is fully parsed.

from streamed_yaml import parse

parse('key: value') # { 'key': 'value }, { 'key': False }` (values, done)

parse('''
  key: value
  key2
''') # { 'key': 'value }, { 'key': True }

parse('''
  key: value
  key2:
''') # { 'key': 'value', 'key2': '' }, { 'key': True, 'key2': False }

parse('''
  key: value
  key2: "Val...
''') # { 'key': 'value', 'key2': 'Val...' }, { 'key': True, 'key2': False }

Streaming Updates

Parse an arbitrarily chunked stream of single-level YAML. Yields updates at the end of each chunk, s.t. concatenating them yields the full document.

from streamed_yaml import chunked_parse

async def stream():
  yield 'key'      # no update
  yield ': value'  # -> Update(key='key', value='value', done=False)
  yield '\nke'     # -> Update(key='key', value='', done=True)
  yield 'y2: '     # -> Update(key='key2', value='', done=False)
  yield 'value2\n' # -> Update(key='key2', value='value2', done=True)

async for update in chunked_parse(stream()):
  print(update)

Metadata

Release files for streamed-yaml 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for streamed-yaml 0.1.3
File Size Uploaded
streamed_yaml-0.1.3.tar.gz 3.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for streamed-yaml 0.1.3
File Interpreter ABI Platform
streamed_yaml-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 7.2 kB

Release files / streamed_yaml-0.1.3.tar.gz

Download URL streamed_yaml-0.1.3.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d01ea7527b31197941bb02d75bcd1b720651fbb639445dde96b2ace1c21e886b
BLAKE2b-256 checksum
How to use checksums
4f3a558393877c655b91760702716ff12a510bed98ccc0d80a2b30c7163fa577
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.10

Release files / streamed_yaml-0.1.3-py3-none-any.whl

Download URL streamed_yaml-0.1.3-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
45a0f7aad1067261e9184f098868953195216326e865d0abdcd2754f4385b7b6
BLAKE2b-256 checksum
How to use checksums
70fa5b1bc08c67286c254abf0c7ea230266dbdf62eafe99e2df94e983cc028e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.10

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page