Skip to main content

A YAML Parser for Python

Project description

PyPI Package PyPI Python Versions PyPI Package License See Build Status on Travis CI

A YAML Parser for Python

Installation

poyo is available for download from PyPI via pip:

$ pip install poyo

Poyo is 100% Python and does not require any additional libs.

Usage

Poyo comes with a neat function, named parse_string(), to parse string data into a Python dict.

import codecs

import poyo

with codecs.open('foobar.yml', encoding='utf-8') as ymlfile:
    config = poyo.parse_string(ymlfile.read())

Please note that Poyo only supports a limited set of YAML features.

See the example below to get a better idea of what Poyo is able to understand.

Example

In (YAML):

default_context: # foobar
    greeting: こんにちは
    email: "raphael@hackebrot.de"
    docs: true
    gui: FALSE
    123: 456.789
    someint: 1000000
    foo: "hallo #welt" #Inline comment :)
zZz: True


# Block
# Comment

Hello World:
    null: This is madness   # yo
    gh: https://github.com/{0}.git
"Yay #python": Cool!

Out (Python):

{
    u'default_context': {
        u'greeting': u'こんにちは',
        u'email': u'raphael@hackebrot.de',
        u'docs': True,
        u'gui': False,
        123: 456.789,
        u'someint': 1000000,
        u'foo': u'hallo #welt',
    },
    u'zZz': True,
    u'Hello World': {
        None: u'This is madness',
        u'gh': u'https://github.com/{0}.git',
    },
    u'Yay #python': u'Cool!'
}

WHY?!

Because a couple of cookiecutter users, including myself, ran into issues when installing well-known YAML parsers for Python on various platforms and Python versions.

Issues

If you encounter any problems, please file an issue along with a detailed description.

Code of Conduct

Everyone interacting in the Poyo project’s codebases, issue trackers, chat rooms, and mailing lists is expected to follow the PyPA Code of Conduct.

License

Distributed under the terms of the MIT license, poyo is free and open source software

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

poyo-0.1.0.tar.gz (6.6 kB view hashes)

Uploaded Source

Built Distribution

poyo-0.1.0-py2.py3-none-any.whl (8.2 kB view hashes)

Uploaded Python 2 Python 3

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